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

15
LINES

< > BotCompany Repo | #1007400 // autoPositionCircles

JavaX fragment (include)

static void autoPositionCircles(CirclesAndLines cal) {
  int n = l(cal.circles);
  if (n == 0) ret;
  new L<DPt> l;
  if (n == 1) l.add(new DPt(0.5, 0.5));
  else if (n == 2) addAll(l, new DPt(0.3, 0.3), new DPt(0.7, 0.7));
  else for i to n: l.add(new DPt((i+0.5)/n, 0.5));
  
  for i to n: {
    Circle c = cal.circles.get(i);
    DPt p = l.get(i);
    c.x = p.x;
    c.y = p.y;
  }
}

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: 439 / 478
Version history: 1 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)