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

9
LINES

< > BotCompany Repo | #1006781 // circlePoints - enumerate points on a circle [TODO: not good - use proper circle algorithm]

JavaX fragment (include)

static L<Pt> circlePoints(int x, int y, int radius) {
  new L<Pt> points;
  int steps = iround(radius*2*pi());
  for i to steps: {
    double phi = i*2*pi()/steps;
    points.add(new Pt(iround(x+radius*sin(phi)), iround(y+radius*cos(phi)));
  }
  ret points;
}

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: #1006781
Snippet name: circlePoints - enumerate points on a circle [TODO: not good - use proper circle algorithm]
Eternal ID of this version: #1006781/7
Text MD5: 8d70e4f00e906e1143497bf5598f2d5f
Author: stefan
Category: javax / maths
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-06-02 01:20:33
Source code size: 268 bytes / 9 lines
Pitched / IR pitched: No / No
Views / Downloads: 461 / 514
Version history: 6 change(s)
Referenced in: [show references]