org.jmol.geodesic

Class 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
static short[][]faceVertexesArrays
static short[]faceVertexesIcosahedron
static floathalfRoot5
static HashtablehtVertex
static intmaxLevel
static short[][]neighborVertexesArrays
static short[]neighborVertexesIcosahedron
static floatoneFifth
static floatoneTenth
static intstandardLevel
5 levels, 0 through 4
static short[]vertexCounts
static shortvertexNext
static Vector3f[]vertexVectors
static booleanVALIDATE
Method Summary
static voidaddNeighboringVertexes(short[] neighborVertexes, short v1, short v2)
static voidcreateGeodesic()
static short[]getFaceVertexes(int level)
static short[][]getFaceVertexesArrays()
static short[][]getNeighborVertexesArrays()
static shortgetVertex(short v1, short v2)
static intgetVertexCount(int level)
static Vector3fgetVertexVector(int i)
static Vector3f[]getVertexVectors()
static intgetVertexVectorsCount()
static voidquadruple(int level, short[] counts)

Field Detail

faceVertexesArrays

private static short[][] faceVertexesArrays

faceVertexesIcosahedron

static final short[] faceVertexesIcosahedron

halfRoot5

static final float halfRoot5

htVertex

private static Hashtable htVertex

maxLevel

private static final int maxLevel

neighborVertexesArrays

private static short[][] neighborVertexesArrays

neighborVertexesIcosahedron

static final short[] neighborVertexesIcosahedron

oneFifth

static final float oneFifth

oneTenth

static final float oneTenth

standardLevel

public static final int standardLevel
5 levels, 0 through 4

vertexCounts

private static short[] vertexCounts

vertexNext

private static short vertexNext

vertexVectors

private static Vector3f[] vertexVectors

VALIDATE

private static final boolean VALIDATE

Method Detail

addNeighboringVertexes

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

createGeodesic

private static void createGeodesic()

getFaceVertexes

public static short[] getFaceVertexes(int level)

getFaceVertexesArrays

public static short[][] getFaceVertexesArrays()

getNeighborVertexesArrays

public static short[][] getNeighborVertexesArrays()

getVertex

private static short getVertex(short v1, short v2)

getVertexCount

public static int getVertexCount(int level)

getVertexVector

public static Vector3f getVertexVector(int i)

getVertexVectors

public static Vector3f[] getVertexVectors()

getVertexVectorsCount

public static int getVertexVectorsCount()

quadruple

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