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

15
LINES

< > BotCompany Repo | #1007400 // autoPositionCircles

JavaX fragment (include)

1  
static void autoPositionCircles(CirclesAndLines cal) {
2  
  int n = l(cal.circles);
3  
  if (n == 0) ret;
4  
  new L<DPt> l;
5  
  if (n == 1) l.add(new DPt(0.5, 0.5));
6  
  else if (n == 2) addAll(l, new DPt(0.3, 0.3), new DPt(0.7, 0.7));
7  
  else for i to n: l.add(new DPt((i+0.5)/n, 0.5));
8  
  
9  
  for i to n: {
10  
    Circle c = cal.circles.get(i);
11  
    DPt p = l.get(i);
12  
    c.x = p.x;
13  
    c.y = p.y;
14  
  }
15  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1007400
Snippet name: autoPositionCircles
Eternal ID of this version: #1007400/2
Text MD5: 9aeb2d07ce56af25d34f7ea2bae9f789
Author: stefan
Category: javax / a.i. / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-03-21 23:17:44
Source code size: 400 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 440 / 479
Version history: 1 change(s)
Referenced in: [show references]