org.jmol.geodesic
Class Geodesic

java.lang.Object
  extended by org.jmol.geodesic.Geodesic

public class Geodesic
extends Object

Consolidated Geodesic from dotsRenderer 3/19/07 Bob Hanson Constructs a canonical geodesic sphere of unit radius.

The Normix3D code quantizes arbitrary vectors to the vectors of this unit sphere. normix values are then used for high performance surface normal lighting

The vertices of the geodesic sphere can be used for constructing vanderWaals and Connolly dot surfaces.

One geodesic sphere is constructed. It is a unit sphere with radius of 1.0

Many times a sphere is constructed with lines of latitude and longitude. With this type of rendering, the atom has north and south poles. And the faces are not regularly shaped ... at the poles they are triangles but elsewhere they are quadrilaterals.

A geodesic sphere is more appropriate for this type of application. The geodesic sphere does not have poles and looks the same in all orientations ... as a sphere should. All faces are equilateral triangles.

The geodesic sphere is constructed by starting with an icosohedron, a platonic solid with 12 vertices and 20 equilateral triangles for faces. The internal call to the private method quadruple will split each triangular face into 4 faces by creating a new vertex at the midpoint of each edge. These midpoints are still in the plane, so they are then 'pushed out' to the surface of the enclosing sphere by normalizing their length back to 1.0

The sequence of vertex counts is 12, 42, 162, 642, 2562. These are identified by 'levels', that run from 0 through 4; The vertices are stored so that when spheres are small they can choose to display only the first n bits where n is one of the above vertex counts. Faces + Vertices = Edges + 2 Faces: 20, 80, 320, 1280, 5120, 20480 start with 20 faces ... at each level multiply by 4 Edges: 30, 120, 480, 1920, 7680, 30720 start with 30 edges ... also multipy by 4 ... strange, but true Vertices: 12, 42, 162, 642, 2562, 10242 start with 12 vertices and 30 edges. when you subdivide, each edge contributes one vertex 12 + 30 = 42 vertices at the next level 80 faces + 42 vertices - 2 = 120 edges at the next level geodesic level 0 vertexCount= 12 faceCount=20 edgeCount=30 geodesic level 1 vertexCount= 42 faceCount=80 edgeCount=120 geodesic level 2 vertexCount= 162 faceCount=320 edgeCount=480 geodesic level 3 vertexCount= 642 faceCount=1280 edgeCount=1920

The vertices of the 'one true canonical sphere' are rotated to the current molecular rotation at the beginning of the repaint cycle. That way, individual atoms only need to scale the unit vector to the vdw radius for that atom.

Notes 27 Sep 2005
If I were to switch the representation to staring with a tetrahedron instead of an icosohedron we would get: Faces: 4, 16, 64, 256, 1024 Edges: 6, 24, 96, 384, 1536 Vertices: 4, 10, 34, 130, 514 If I switched to face-centered normixes then I could efficiently Regardless, I think that face-centered normixes would also reduce ambiguity and would speed up the normal to normix process. I could also start with an octahedron that placed one triangle in each 3D cartesian octant. That would push to 512 faces instead of 256 faces, leaving me with shorts. But, it would be easier to quantize at the first level because it would be based upon sign. And perhaps it would be easier to take advantage of symmetry in the process of converting from normal to normix.


Field Summary
private static short[][] faceVertexesArrays
           
private static short[] faceVertexesIcosahedron
           
private static float halfRoot5
           
private static Hashtable htVertex
           
private static int maxLevel
           
private static short[][] neighborVertexesArrays
           
private static short[] neighborVertexesIcosahedron
           
private static float oneFifth
           
private static float oneTenth
           
static int standardLevel
          5 levels, 0 through 4
private static boolean VALIDATE
           
private static short[] vertexCounts
           
private static short vertexNext
           
private static Vector3f[] vertexVectors
           
 
Constructor Summary
Geodesic()
           
 
Method Summary
private static void addNeighboringVertexes(short[] neighborVertexes, short v1, short v2)
           
private static void createGeodesic()
           
static short[] getFaceVertexes(int level)
           
static short[][] getFaceVertexesArrays()
           
static short[][] getNeighborVertexesArrays()
           
private static short getVertex(short v1, short v2)
           
static int getVertexCount(int level)
           
static Vector3f getVertexVector(int i)
           
static Vector3f[] getVertexVectors()
           
static int getVertexVectorsCount()
           
private static void quadruple(int level, short[] counts)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

halfRoot5

private static final float halfRoot5

oneFifth

private static final float oneFifth
See Also:
Constant Field Values

oneTenth

private static final float oneTenth
See Also:
Constant Field Values

faceVertexesIcosahedron

private static final short[] faceVertexesIcosahedron

neighborVertexesIcosahedron

private static final short[] neighborVertexesIcosahedron

standardLevel

public static final int standardLevel
5 levels, 0 through 4

See Also:
Constant Field Values

maxLevel

private static final int maxLevel
See Also:
Constant Field Values

vertexCounts

private static short[] vertexCounts

vertexVectors

private static Vector3f[] vertexVectors

faceVertexesArrays

private static short[][] faceVertexesArrays

neighborVertexesArrays

private static short[][] neighborVertexesArrays

vertexNext

private static short vertexNext

htVertex

private static Hashtable htVertex

VALIDATE

private static final boolean VALIDATE
See Also:
Constant Field Values
Constructor Detail

Geodesic

public Geodesic()
Method Detail

getFaceVertexesArrays

public static short[][] getFaceVertexesArrays()

getNeighborVertexesArrays

public static short[][] getNeighborVertexesArrays()

getVertexCount

public static int getVertexCount(int level)

getVertexVectors

public static Vector3f[] getVertexVectors()

getVertexVectorsCount

public static int getVertexVectorsCount()

getVertexVector

public static Vector3f getVertexVector(int i)

getFaceVertexes

public static short[] getFaceVertexes(int level)

createGeodesic

private static void createGeodesic()

quadruple

private static void quadruple(int level,
                              short[] counts)

addNeighboringVertexes

private static void addNeighboringVertexes(short[] neighborVertexes,
                                           short v1,
                                           short v2)

getVertex

private static short getVertex(short v1,
                               short v2)