Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 8026

Other programming languages • Re: JavaScript graph library, for embedding and drawing planar graphs in 2D and/or sphere surface

$
0
0
New version has some changes:
https://github.com/Hermann-SW/planar_gr ... ng.3D.2.js

First, the planar graph that is projected scaled onto the sphere via spherical projection is drawn scaled, so that you can "see" vertices of plane graph (now black) are projected where on the sphere. I did run this command for scale values of 2, 3 and 6:

Code:

./rjs node.straight_line_drawing.3D.2.js graphs/C20.a 6 bw
The "b" means that blue vertices are displayed as well, more on them below.
The "w" means that a big white sphere is drawn inside, hiding the vertices mapped to back of the sphere.

As said, these are screenshots for scale=2, 3 and 6.
For scale=2 the outside face vertices are on radius 2, and get projected at equator with radius 1 from north pole:
C20.scale_2_3_6.png
For each vertex a blue vertex position is determined and displayed.
It is the sum of adjacent vertex sphere coordinates, scaled to 1.
In a single iteration all blue positions are computed, and then become the new vertex positions.
After many iterations all vertices callapse either at bottom, or top.
For scale=5.13 at bottom, scale=5.15 at top.

For C60 with scale=8 it looked long as if no collaps happens.
But after more than 700 iteration the collaps happens at bottom.
This is frame 558, you can see in line "$vpr = ..." that it is multiplied with 10° for animation showing rotation around Z-axis:
frame.1.png
You can see collaps in <8s 25fps video here:
https://stamm-wilbrandt.de/videos/C60.d ... mation.mp4

There is a simple explanation why scale=8 collapses finally at bottom:
If you look at the screenshot, you see that each blue position is slightly below its corresponding vertex.
Not much, but a steady down pull for all vertices, and final collapse at bottom.

In case you play with the script, the "fastforward" variable allows you to skip chosen number of frames in the animation.
And "ms" variable defines the number of milliseconds between each iteration.

Statistics: Posted by HermannSW — Sat Aug 31, 2024 6:33 pm



Viewing all articles
Browse latest Browse all 8026

Trending Articles