Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

20
LINES

< > BotCompany Repo | #1032168 // PrecisePolygon

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (5025L/28K).

1  
import java.awt.geom.Path2D;
2  
3  
sclass PrecisePolygon extends Path2D.Double {
4  
  gettable L<DoublePt> points;
5  
  
6  
  *(double... points) {
7  
    this(toDoublePts(points));
8  
  }
9  
  
10  
  *(L<? extends IDoublePt> pts) {
11  
    points = iDoublePtsToDoublePts(pts);
12  
    var p = first(points);
13  
    moveTo(p.x, p.y);
14  
    for (int i = 1; i < l(points); i++) {
15  
      p = points.get(i);
16  
      lineTo(p.x, p.y);
17  
    }
18  
    closePath();
19  
  }
20  
}

Author comment

Began life as a copy of #1014967

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj, pyentgdyhuwx

No comments. add comment

Snippet ID: #1032168
Snippet name: PrecisePolygon
Eternal ID of this version: #1032168/9
Text MD5: a694ba0aacad3be36167ef4d899d75c8
Transpilation MD5: 251bfe71e37c03828c60324f69697f84
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-01-22 18:39:13
Source code size: 436 bytes / 20 lines
Pitched / IR pitched: No / No
Views / Downloads: 207 / 374
Version history: 8 change(s)
Referenced in: [show references]