Libraryless. Click here for Pure Java version (5504L/30K).
// rotation: rotation in degrees (clockwise) static PrecisePolygon regularPolygon(IDoublePt etc center, double radius, int sides, double rotation default 0) { double angle = twoPi()/sides; reMutable rotation = degToRadian(-rotation); ret new PrecisePolygon(countIteratorToList(sides, i -> addDoublePts(center, scaleDoublePt(radius, doublePt(sin(rotation+angle*i), cos(rotation+angle*i)))))); }
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): bhatertpkbcr, ekrmjmnbrukm, mqqgnosmbjvj
No comments. add comment
| Snippet ID: | #1033748 |
| Snippet name: | regularPolygon |
| Eternal ID of this version: | #1033748/12 |
| Text MD5: | acfcca96a741fa9027cbb5afdd40cda5 |
| Transpilation MD5: | eaaa58839cac91561c2d80deb5ec54a8 |
| Author: | stefan |
| Category: | javax / imaging |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2022-03-17 19:03:51 |
| Source code size: | 416 bytes / 8 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 475 / 671 |
| Version history: | 11 change(s) |
| Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) |