<?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[JSCAD for planar graph embeddings onto (unit) sphere]]></title><description><![CDATA[<p dir="auto">Since some months I work on multi-language "planar graph playground":<br />
<a href="https://github.com/Hermann-SW/planar_graph_playground" rel="nofollow ugc">https://github.com/Hermann-SW/planar_graph_playground</a><br />
Libraries (undirected graph, ...) are implemented in JavaScript/NodeJS, Python and C++.<br />
<code>forall_edges(G, function(e) { ... });</code> is the JavaScript way of iterating over all edges of undirected graph G, <code>forall_edges(G, lambda e: ...)</code> the Python way, and <code>forall_edges(G, [&amp;G, &amp;visited, &amp;pftv](edge g) { ... });</code> the C++ way.</p>
<p dir="auto">First (2D) graph output was done with SVG in browser, then mostly as PostScript. Online demo for displaying fullerenes:<br />
<a href="https://hermann-sw.github.io/planar_graph_playground/" rel="nofollow ugc">https://hermann-sw.github.io/planar_graph_playground/</a></p>
<p dir="auto">Lately I created OpenSCAD output for planar embedding onto sphere (every planar graph can be embedded onto sphere, with non-crossing great circle arcs as edges, because of a bijection of plane and unit sphere minus north pole). Has lots of spherical computations inside and looks nice (embedding of C60 or "football" fullerene, 20 hexagons and 12 pentagons on 60 vertices):<br />
<a href="https://forums.raspberrypi.com/viewtopic.php?t=333342&amp;start=75#p2026845" rel="nofollow ugc">https://forums.raspberrypi.com/viewtopic.php?t=333342&amp;start=75#p2026845</a><br />
<img src="https://camo.nodebb.org/508f8fb2b3bf45507260f38fc83610ee60054ee8?url=https%3A%2F%2Fforums.raspberrypi.com%2Fdownload%2Ffile.php%3Fid%3D55989" alt="alt text" class=" img-fluid img-markdown" /></p>
<p dir="auto">Two days ago I overcame problems I had with getting JSCAD packages/web running locally, and since then I am on the way to produce same output using JSCAD. Sofar "vertex()", straight line "edge()" and great circle arc "edge2()" have been ported successfully to JSCAD, documented in further postings in that thread:<br />
<img src="https://camo.nodebb.org/b6c7709dd00005e6fe5ae4091fdbabe2d12f92d1?url=https%3A%2F%2Fforums.raspberrypi.com%2Fdownload%2Ffile.php%3Fid%3D56098" alt="alt text" class=" img-fluid img-markdown" /></p>
<p dir="auto">You can play live with C20 fullerene embedding in your browser:<br />
<a href="https://www.openjscad.xyz/?uri=https://stamm-wilbrandt.de/en/forum/JSCAD.vertex_edge2.js" rel="nofollow ugc">https://www.openjscad.xyz/?uri=https://stamm-wilbrandt.de/en/forum/JSCAD.vertex_edge2.js</a></p>
]]></description><link>https://openjscad.nodebb.com/topic/377/jscad-for-planar-graph-embeddings-onto-unit-sphere</link><generator>RSS for Node</generator><lastBuildDate>Thu, 13 Aug 2026 16:12:52 GMT</lastBuildDate><atom:link href="https://openjscad.nodebb.com/topic/377.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 11 Aug 2022 14:50:24 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to JSCAD for planar graph embeddings onto (unit) sphere on Thu, 18 Aug 2022 23:00:41 GMT]]></title><description><![CDATA[<p dir="auto">I implemented optional JSCAD output for planar graph playground "node.tetra.js", details here:<br />
<a href="https://forums.raspberrypi.com/viewtopic.php?p=2030546#p2030546" rel="nofollow ugc">https://forums.raspberrypi.com/viewtopic.php?p=2030546#p2030546</a></p>
<p dir="auto">Until now I played with C20 hand edited for JSCAD, this is newly created C60 fullerene with 60 vertices and 90 edges:<br />
<a href="https://www.openjscad.xyz/?uri=https://stamm-wilbrandt.de/en/forum/JSCAD.C60_vtype.js" rel="nofollow ugc">https://www.openjscad.xyz/?uri=https://stamm-wilbrandt.de/en/forum/JSCAD.C60_vtype.js</a></p>
<p dir="auto">More vertices and edges than for C20, but design regeneration still done in less than 10 seconds on Intel it Linux Chrome!<br />
<img src="https://camo.nodebb.org/331ede8f5745dfbbaf82eb062a4e62832f30214e?url=https%3A%2F%2Fforums.raspberrypi.com%2Fdownload%2Ffile.php%3Fid%3D56198" alt="https://forums.raspberrypi.com/download/file.php?id=56198" class=" img-fluid img-markdown" /></p>
]]></description><link>https://openjscad.nodebb.com/post/1247</link><guid isPermaLink="true">https://openjscad.nodebb.com/post/1247</guid><dc:creator><![CDATA[Hermann-SW]]></dc:creator><pubDate>Thu, 18 Aug 2022 23:00:41 GMT</pubDate></item><item><title><![CDATA[Reply to JSCAD for planar graph embeddings onto (unit) sphere on Mon, 15 Aug 2022 22:42:35 GMT]]></title><description><![CDATA[<p dir="auto">I answered the question on whether JSCAD will be performant enough for low design regeneration with 12 spherical pentagons (it is, takes less than 5 seconds on Intel i7 Chrome, with carefully chosen values for gray points/segments), because all fullerenes have exactly 12 pentagons (<code>12*3*2=72</code> <code>sp_tria2()</code> calls, ...), details here:<br />
<a href="https://forums.raspberrypi.com/viewtopic.php?p=2029576#p2029576" rel="nofollow ugc">https://forums.raspberrypi.com/viewtopic.php?p=2029576#p2029576</a></p>
<p dir="auto"><a href="https://www.openjscad.xyz/?uri=https://stamm-wilbrandt.de/en/forum/JSCAD.C20_params.js" rel="nofollow ugc">https://www.openjscad.xyz/?uri=https://stamm-wilbrandt.de/en/forum/JSCAD.C20_params.js</a><br />
<img src="https://camo.nodebb.org/49073393bfd3ea5e15b5b38ea29a3daa968fd0c4?url=https%3A%2F%2Fforums.raspberrypi.com%2Fdownload%2Ffile.php%3Fid%3D56147" alt="alt text" class=" img-fluid img-markdown" /></p>
]]></description><link>https://openjscad.nodebb.com/post/1244</link><guid isPermaLink="true">https://openjscad.nodebb.com/post/1244</guid><dc:creator><![CDATA[Hermann-SW]]></dc:creator><pubDate>Mon, 15 Aug 2022 22:42:35 GMT</pubDate></item><item><title><![CDATA[Reply to JSCAD for planar graph embeddings onto (unit) sphere on Sun, 14 Aug 2022 21:39:41 GMT]]></title><description><![CDATA[<p dir="auto">Done, now "vertex()" optional 3rd parameter "half" works as well:<br />
<a href="https://www.openjscad.xyz/?uri=https://stamm-wilbrandt.de/en/forum/JSCAD.vertex_half.js" rel="nofollow ugc">https://www.openjscad.xyz/?uri=https://stamm-wilbrandt.de/en/forum/JSCAD.vertex_half.js</a></p>
<p dir="auto">Green vertices 1, 2, 15 and 16 are forced as "half" vertices, that is a cube of right size gets subtracted from inside. Subtraction can be seen for vertex 1 at "look_inside" hole border. Vertex 2, 15 and 16 cannot be seen on inside anymore, unlike the other vertices with default "half=false":</p>
<pre><code>...
    vertex(0, [1,0,0])
    ,vertex(1, [0,1,0], true)
    ,vertex(2, [0,1,0], true)
...
    ,vertex(15, [0,1,0], true)
    ,vertex(16, [0,1,0], true)
...
</code></pre>
<p dir="auto"><img src="https://camo.nodebb.org/3ed3f6af3de24bf4630a356558b5d26478f490e3?url=https%3A%2F%2Fstamm-wilbrandt.de%2Fen%2Fforum%2FJSCAD.vertex_half.js.png" alt="https://stamm-wilbrandt.de/en/forum/JSCAD.vertex_half.js.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://openjscad.nodebb.com/post/1243</link><guid isPermaLink="true">https://openjscad.nodebb.com/post/1243</guid><dc:creator><![CDATA[Hermann-SW]]></dc:creator><pubDate>Sun, 14 Aug 2022 21:39:41 GMT</pubDate></item><item><title><![CDATA[Reply to JSCAD for planar graph embeddings onto (unit) sphere on Sun, 14 Aug 2022 20:45:30 GMT]]></title><description><![CDATA[<p dir="auto">Not perfect, but "vtxt()" works now in JSCAD as well:<br />
<a href="https://www.openjscad.xyz/?uri=https://stamm-wilbrandt.de/en/forum/JSCAD.vtxt.js" rel="nofollow ugc">https://www.openjscad.xyz/?uri=https://stamm-wilbrandt.de/en/forum/JSCAD.vtxt.js</a></p>
<p dir="auto"><img src="https://camo.nodebb.org/6aca976e99f78bb93c086e34975af58c11fd544c?url=https%3A%2F%2Fstamm-wilbrandt.de%2Fen%2Fforum%2FJSCAD.vtxt.js.png" alt="https://stamm-wilbrandt.de/en/forum/JSCAD.vtxt.js.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://openjscad.nodebb.com/post/1242</link><guid isPermaLink="true">https://openjscad.nodebb.com/post/1242</guid><dc:creator><![CDATA[Hermann-SW]]></dc:creator><pubDate>Sun, 14 Aug 2022 20:45:30 GMT</pubDate></item><item><title><![CDATA[Reply to JSCAD for planar graph embeddings onto (unit) sphere on Sun, 14 Aug 2022 15:10:52 GMT]]></title><description><![CDATA[<p dir="auto">After a problem with spherical triangle implementation (my problem, not JSCAD problem) ...<br />
<a href="https://openjscad.nodebb.com/topic/378/problem-with-subtract-ing-hull-is-this-a-bug/3?_=1660487451987">https://openjscad.nodebb.com/topic/378/problem-with-subtract-ing-hull-is-this-a-bug/3?_=1660487451987</a></p>
<p dir="auto">... now spherical triangle works. I called it three times to fill one spherical pentagon:</p>
<pre><code class="language-...">,sp_tria(2,1,15)
,sp_tria(2,15,16)
,sp_tria(2,16,3)
...
</code></pre>
<p dir="auto">You can see spherical gray polygon from outside, and nothing of spherical polygon breaks into white sphere difference on the inside:<br />
<img src="https://camo.nodebb.org/ebf7640e2e5afedc284fcc9a81cd41a75f4115ad?url=https%3A%2F%2Fstamm-wilbrandt.de%2Fen%2Fforum%2FJSCAD.spherical_polygon.js.png" alt="https://stamm-wilbrandt.de/en/forum/JSCAD.spherical_polygon.js.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">Click for view+rotate+zoom, design regeneration takes less than 3 seconds on Intel i7 Chrome<br />
(normally I use chromium-browser on Raspberry Pi OS, will test that in 2 weeks):<br />
<a href="https://www.openjscad.xyz/?uri=https://stamm-wilbrandt.de/en/forum/JSCAD.spherical_polygon.js" rel="nofollow ugc">https://www.openjscad.xyz/?uri=https://stamm-wilbrandt.de/en/forum/JSCAD.spherical_polygon.js</a><br />
Clicking "Enable Auoto-zoom" and "Enable Auto-rotate" results in nice animation ...</p>
<p dir="auto">P.S:<br />
Next step is to port "vtxt()" for adding text labels to vertex sphere, and "half()" for subtracting cube from inner side of vertex sphere, avoiding vertex to shine through to inside for 3Dprinting later.<br />
After that is done, I will make "node.tetra.js" create JSCAD output as alternative to sofar OpenSCAD output. Creating C60 with 12 spherical pentagons JSCAD file and measuring design regeneration time for it will answer whether JSCAD is usable for great circle arc edge embedding of planar graphs onto sphere:   12 spherical pentagons is 12*3=36 spherical triangles, is 72 "sp_tria2()" and 36 differences with "hull()" of 6 points (mini cubes) ...</p>
]]></description><link>https://openjscad.nodebb.com/post/1241</link><guid isPermaLink="true">https://openjscad.nodebb.com/post/1241</guid><dc:creator><![CDATA[Hermann-SW]]></dc:creator><pubDate>Sun, 14 Aug 2022 15:10:52 GMT</pubDate></item><item><title><![CDATA[Reply to JSCAD for planar graph embeddings onto (unit) sphere on Sun, 14 Aug 2022 03:34:12 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/z3dev" aria-label="Profile: z3dev">@<bdi>z3dev</bdi></a> said in <a href="/post/1233">JSCAD for planar graph embeddings onto (unit) sphere</a>:</p>
<blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/hermann-sw" aria-label="Profile: Hermann-SW">@<bdi>Hermann-SW</bdi></a> WOW! Very nice!</p>
<p dir="auto">I'm very impressed with the speed of the algorithms! I was expecting to wait for minutes before viewing. But the design was viewable almost immediately!</p>
<p dir="auto">Do you think that any 3D shape can be 'fitted' to a sphere? How about to a cylinder?</p>
</blockquote>
<p dir="auto">Sure, just calculate the correct (3D) coordinates and place whatever you like on sphere. For cylinder just 3D coordinate determination will be different [(theta, phi) polar coordinates for sphere, (h, phi) for cylinder coordinate at height h].<br />
Here I placed text onto the vertex spheres on the sphere for debugging:<br />
<a href="https://forums.raspberrypi.com/viewtopic.php?t=333342&amp;start=50#p2023738" rel="nofollow ugc">https://forums.raspberrypi.com/viewtopic.php?t=333342&amp;start=50#p2023738</a><br />
<img src="https://camo.nodebb.org/d681c411d30fa3ad5340cf36297b1a77abff1260?url=https%3A%2F%2Fforums.raspberrypi.com%2Fdownload%2Ffile.php%3Fid%3D55817" alt="alt text" class=" img-fluid img-markdown" /></p>
]]></description><link>https://openjscad.nodebb.com/post/1235</link><guid isPermaLink="true">https://openjscad.nodebb.com/post/1235</guid><dc:creator><![CDATA[Hermann-SW]]></dc:creator><pubDate>Sun, 14 Aug 2022 03:34:12 GMT</pubDate></item><item><title><![CDATA[Reply to JSCAD for planar graph embeddings onto (unit) sphere on Fri, 12 Aug 2022 12:40:26 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/hermann-sw" aria-label="Profile: Hermann-SW">@<bdi>Hermann-SW</bdi></a> I'm not surprised. The boolean functions require memory and CPU, so high resolution spheres will be very slow. However, newer computers are extremely fast now, so please keep making cool designs!</p>
]]></description><link>https://openjscad.nodebb.com/post/1234</link><guid isPermaLink="true">https://openjscad.nodebb.com/post/1234</guid><dc:creator><![CDATA[z3dev]]></dc:creator><pubDate>Fri, 12 Aug 2022 12:40:26 GMT</pubDate></item><item><title><![CDATA[Reply to JSCAD for planar graph embeddings onto (unit) sphere on Fri, 12 Aug 2022 12:36:57 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/hermann-sw" aria-label="Profile: Hermann-SW">@<bdi>Hermann-SW</bdi></a> WOW! Very nice!</p>
<p dir="auto">I'm very impressed with the speed of the algorithms! I was expecting to wait for minutes before viewing. But the design was viewable almost immediately!</p>
<p dir="auto">Do you think that any 3D shape can be 'fitted' to a sphere? How about to a cylinder?</p>
]]></description><link>https://openjscad.nodebb.com/post/1233</link><guid isPermaLink="true">https://openjscad.nodebb.com/post/1233</guid><dc:creator><![CDATA[z3dev]]></dc:creator><pubDate>Fri, 12 Aug 2022 12:36:57 GMT</pubDate></item><item><title><![CDATA[Reply to JSCAD for planar graph embeddings onto (unit) sphere on Fri, 12 Aug 2022 07:21:21 GMT]]></title><description><![CDATA[<p dir="auto">Added debug feature "look_inside" for the white sphere:<br />
<a href="https://forums.raspberrypi.com/viewtopic.php?p=2028520#p2028520" rel="nofollow ugc">https://forums.raspberrypi.com/viewtopic.php?p=2028520#p2028520</a><br />
<img src="https://camo.nodebb.org/8685c949fae2072ea19302608d6385890b8965d6?url=https%3A%2F%2Fforums.raspberrypi.com%2Fdownload%2Ffile.php%3Fid%3D56103" alt="alt text" class=" img-fluid img-markdown" /></p>
<p dir="auto">Learned that number of segments for white sphere is a problem when "subtract()" another sphere with radius reduced by 0.1. 180 segments was no problem for OpenSCAD, for JSCAD I did set parameter default to 30.</p>
]]></description><link>https://openjscad.nodebb.com/post/1232</link><guid isPermaLink="true">https://openjscad.nodebb.com/post/1232</guid><dc:creator><![CDATA[Hermann-SW]]></dc:creator><pubDate>Fri, 12 Aug 2022 07:21:21 GMT</pubDate></item></channel></rss>