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.

1  
static L<PolarPt> onePathToPolarIntervals_v1(OnePath path, int nIntervals) {
2  
  if (path == null) null;
3  
  L<PolarPt> out = emptyList(nIntervals);
4  
  int iPath = 0, lPath = path.size();
5  
  double step = lPath/nIntervals;
6  
  var it = path.pointIterator();
7  
  Pt p = it.next(), lastPoint = p;
8  
  for i to nIntervals: {
9  
    int iPath2 = iround((i+1)*step);
10  
    while (iPath < iPath2) {
11  
      p = it.next();
12  
      iPath++;
13  
    }
14  
    out.add(PolarPt(p.minus(lastPoint)));
15  
    lastPoint = p;
16  
  }
17  
  ret out;
18  
}

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: 121 / 198
Version history: 5 change(s)
Referenced in: [show references]