1 | static L<Pt> circlePoints(int x, int y, int radius) { |
2 | new L<Pt> points; |
3 | int steps = iround(radius*2*pi()); |
4 | for i to steps: { |
5 | double phi = i*2*pi()/steps; |
6 | points.add(new Pt(iround(x+radius*sin(phi)), iround(y+radius*cos(phi))); |
7 | } |
8 | ret points; |
9 | } |
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: | 463 / 517 |
Version history: | 6 change(s) |
Referenced in: | [show references] |