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).

import java.awt.geom.Path2D;

sclass PrecisePolygon extends Path2D.Double {
  gettable L<DoublePt> points;
  
  *(double... points) {
    this(toDoublePts(points));
  }
  
  *(L<? extends IDoublePt> pts) {
    points = iDoublePtsToDoublePts(pts);
    var p = first(points);
    moveTo(p.x, p.y);
    for (int i = 1; i < l(points); i++) {
      p = points.get(i);
      lineTo(p.x, p.y);
    }
    closePath();
  }
}

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: 129 / 272
Version history: 8 change(s)
Referenced in: [show references]