<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Regular polygons example]]></title><description><![CDATA[<p dir="auto">Hello, I'm making some code examples, here is a regular polygon generator. it can be used to demo the function or make a polygon with it. It can be viewed here<br />
<a href="https://openjscad.org/#https://raw.githubusercontent.com/gilboonet/designs/master/regularPolygons.jscad" rel="nofollow ugc">https://openjscad.org/#https://raw.githubusercontent.com/gilboonet/designs/master/regularPolygons.jscad</a></p>
<p dir="auto">My intention is to do the same for common polyhedrons (icosahedron and so on), so users could start a design from one of those volumes, just by picking the corresponding function.</p>
<p dir="auto">I'm using a function (simpleRotate) to rotate my points, but was there a way to use an internal function to do the same ?</p>
<p dir="auto"><img src="/assets/uploads/files/1558346450293-capture-d-%C3%A9cran-de-2019-05-20-11-59-09-resized.png" alt="0_1558346448584_Capture d’écran de 2019-05-20 11-59-09.png" class=" img-responsive img-markdown" /></p>
]]></description><link>https://openjscad.nodebb.com/topic/90/regular-polygons-example</link><generator>RSS for Node</generator><lastBuildDate>Mon, 20 Apr 2026 21:40:42 GMT</lastBuildDate><atom:link href="https://openjscad.nodebb.com/topic/90.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 20 May 2019 10:09:49 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Regular polygons example on Mon, 20 May 2019 11:38:22 GMT]]></title><description><![CDATA[<p dir="auto">This new star primitive looks promising. Thank you for the code sample, I will try to use .fromAngleRadians().</p>
]]></description><link>https://openjscad.nodebb.com/post/129</link><guid isPermaLink="true">https://openjscad.nodebb.com/post/129</guid><dc:creator><![CDATA[gilboonet]]></dc:creator><pubDate>Mon, 20 May 2019 11:38:22 GMT</pubDate></item><item><title><![CDATA[Reply to Regular polygons example on Mon, 20 May 2019 10:32:38 GMT]]></title><description><![CDATA[<p dir="auto">There are many ways to do anything. <img src="https://openjscad.nodebb.com/assets/plugins/nodebb-plugin-emoji/emoji/android/270c.png?v=k4h1pp0pk3c" class="not-responsive emoji emoji-android emoji--v" title=":v:" alt="✌" /></p>
<p dir="auto">The simpleRotate() function isn’t wrong but reminded me of a small piece in the new star primitive (new in V2).</p>
<p dir="auto">const getPoints = (vertices, radius, startAngle, center) =&gt; {<br />
var a1 = degToRad(startAngle)<br />
var a = 2 * Math.PI / vertices<br />
var points = []<br />
for (var i = 0; i &lt; vertices; i++) {<br />
let point = vec2.fromAngleRadians(a * i + a1)<br />
vec2.scale(point, radius, point)<br />
vec2.add(point, center, point)<br />
points.push(point)<br />
}<br />
return points<br />
}</p>
<p dir="auto">I hope this provides some encouragement.</p>
]]></description><link>https://openjscad.nodebb.com/post/128</link><guid isPermaLink="true">https://openjscad.nodebb.com/post/128</guid><dc:creator><![CDATA[z3dev]]></dc:creator><pubDate>Mon, 20 May 2019 10:32:38 GMT</pubDate></item></channel></rss>