Signature
polygonX(o, sides, radius, centerX, stepsPerEdge)
Description
Returns the x-coordinate of a point tracing the edges of a regular polygon with sides
sides and radius
radius, centered at centerX
.
The step index o
advances along edges, subdivided by stepsPerEdge
.
Formula
Let \(e=\lfloor o/s \rfloor\), \(t=(o \bmod s)/s\), \(\theta_1=\tfrac{2\pi e}{n}\), \(\theta_2=\tfrac{2\pi(e+1)}{n}\).
Then \[ x = (1-t)(R\cos\theta_1 + C_x) + t(R\cos\theta_2 + C_x). \]
Usage in Funebra
// Example: hexagon
Steps: 6*40
X(o): polygonX(o, 6, 140, 360, 40)
Y(o): polygonY(o, 6, 140, 260, 40)
Z(o): 0
