Libraryless. Click here for Pure Java version (5504L/30K).
1 | // rotation: rotation in degrees (clockwise) |
2 | static PrecisePolygon regularPolygon(IDoublePt etc center, double radius, int sides, double rotation default 0) { |
3 | double angle = twoPi()/sides; |
4 | reMutable rotation = degToRadian(-rotation); |
5 | ret new PrecisePolygon(countIteratorToList(sides, i -> |
6 | addDoublePts(center, scaleDoublePt(radius, |
7 | doublePt(sin(rotation+angle*i), cos(rotation+angle*i)))))); |
8 | } |
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: | 222 / 366 |
Version history: | 11 change(s) |
Referenced in: | [show references] |