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

26
LINES

< > BotCompany Repo | #1034415 // OnePathWithOrigin - OnePath plus starting position

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

Libraryless. Click here for Pure Java version (8853L/49K).

sclass OnePathWithOrigin > OnePath {
  settable Pt origin = pt(0, 0);
  
  *() {}
  *(S path) { super(path); }
  *(Pt *origin, S path) { super(path); }
  *(int originX, int originY, S path) { super(path); origin = pt(originX, originY); }
  *(Iterable<Pt> points, bool close) {
    var l = asList(points);
    origin = first(l);
    fromPoints(l, close);
  }
  
  *(OnePathWithOrigin path) {
    super(path);
    origin = path.origin;
  }
  
  toString {
    ret "Origin (" + origin + "), path: " + super.toString();
  }
  
  OnePathWithOrigin reversed() {
    ret new OnePathWithOrigin(reversedList(pointList()), false);
  }
}

Author comment

Began life as a copy of #1034075

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1034415
Snippet name: OnePathWithOrigin - OnePath plus starting position
Eternal ID of this version: #1034415/11
Text MD5: 80afb4c8abaed22f63e69f016d8aa4fa
Transpilation MD5: 299d9851b8ba2d75b399687dff59f109
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-05-06 20:05:10
Source code size: 651 bytes / 26 lines
Pitched / IR pitched: No / No
Views / Downloads: 179 / 351
Version history: 10 change(s)
Referenced in: [show references]