This is a
playground to test code. It runs a full
Node.js environment and already has all of
npm’s 400,000 packages pre-installed, including
icosahedron with all
npm packages installed. Try it out:
This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.
IsoSphere reads and writes data from a THREE.js Icosahedron into and out of Mongo and JSON files. It saves the point, face and sector data into independent records and unifies them into JSON collections.
It also breaks data for Icosahedron into 20 sectors based on the original faces and associates points into these sectors.
These three seemingly identical measurements are not --- and its kind of funny why.
When Icosahedrons are created they are often created with duplicate points as they are subdivided. Before identical points are removed, they are indexed, and this index is therefore saved to the point record, but is NOT the same as its index in the vertices array.
Thankfully, this is not the value that
The true index of a point is saved by this module as a seperate field,
As for the
Points in higher resolution Ico's are NOT identical to the same points in a given order. that is, point order=20 of
a res 3 Icosahedron is not the same as point order=20 of a res 2 polyhedron.
(the first 12 "seed" points seem the same but the rest are a crap shoot. )
link_identical_points script sets a
real_order field that ensures that every point of a given index
in any resolution Ico is the same. Of course not all Ico will have a point for a given index, but if it does,
it should have the same coordinates.
The Schema for the registry information is stored in lib/model/.json* files.
Point data has the following schema:
the id of the point based on its original order and level of detail. see the point_id static method of the Point class:
'point_detail_<%= detail %>_order<%= order %>'
the level of detail
the order the point is found in (see above).
the consistent identity of the point across all resolutions (see above).
the _id of the point one level higher in resolution. Not all points have parents.
the _id of the point one level lower in resolution. Not all points have children ... because at some point you are at the highest resolution stored.
the 3D coordinates of the point; in -1...1.
the 2D (UV) coordinates of the point in 0..1.
data on the points connected to the point
a number 0..19 indicating what sector (see below) the point belongs to. Note that the first 12 (original) points will have five neighbors. All other points will have two (if on a border) or one sector.