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

18
LINES

< > BotCompany Repo | #1034112 // onePathToPolarIntervals_v1 - intervals calculated by steps, not very accurate

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

Transpiled version (6041L) is out of date.

static L<PolarPt> onePathToPolarIntervals_v1(OnePath path, int nIntervals) {
  if (path == null) null;
  L<PolarPt> out = emptyList(nIntervals);
  int iPath = 0, lPath = path.size();
  double step = lPath/nIntervals;
  var it = path.pointIterator();
  Pt p = it.next(), lastPoint = p;
  for i to nIntervals: {
    int iPath2 = iround((i+1)*step);
    while (iPath < iPath2) {
      p = it.next();
      iPath++;
    }
    out.add(PolarPt(p.minus(lastPoint)));
    lastPoint = p;
  }
  ret out;
}

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1034112
Snippet name: onePathToPolarIntervals_v1 - intervals calculated by steps, not very accurate
Eternal ID of this version: #1034112/6
Text MD5: 844058147dab6eec46d45ad8a43f2b71
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-01-22 17:57:31
Source code size: 512 bytes / 18 lines
Pitched / IR pitched: No / No
Views / Downloads: 120 / 197
Version history: 5 change(s)
Referenced in: [show references]