Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

OpenSCAD User Manual/example module regular polygon()

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

Example: regular_polygon() Module A user defined module can generate the same shapes using some basic math and the polygon() module: module regular_polygon(order = 4, r=1) { // default parameters give a unit square // first divide 360 to make a vector of angles between vertices angles=[ for (i = [0:order-1]) i*(360/order) ]; // use trigonometry to calculate Cartesian coordinates coords=[ for (th=angles) [r*cos(th), r*sin(th)] ]; polygon(coords); // generate the polygon } regular_polygon(); // generate a default <code>regular_polygon</code> Polygon shapes generated by circle() are drawn inscribed in a circle of the given radius, starting from a first point on the positive X axis.