With a framework like Three.js, it is pretty easy to display the faces of simple polyhedrons using WebGL. But a polyhedron, considered less as a physical and more as a topological object, consists not only of its faces. Instead often its vertices and edges are equaly interesting, and it would be nice to have an easy way to display them, perhaps assigning them different colors, to distinguish different kinds of vertices or different kinds of edges. Within the program Stella, vertices can be displayed as small balls and edges as thin tubes, and I wrote a function to be used in conjunction with Three.js which makes it a bit easier to construct similar graphical objects, following a similar visual style, within WebGL.
In the following examples, I’ll assume that we have set up all the usual Three.js stuff with renderers and virtual cameras and mouse controls and lights and that we have defined a Scene-object. Furthermore, I’ll assume that we imported my helper file JAN3D.js which contains the function JAN3D.stella() (among other stuff; I also included JAN3D.TinyTrackballControls). I’ll show, using four examples, how to use this function.
…