org.jmol.shapesurface
Class Isosurface

java.lang.Object
  extended by org.jmol.shape.Shape
      extended by org.jmol.shape.MeshCollection
          extended by org.jmol.shapesurface.Isosurface
All Implemented Interfaces:
MeshDataServer, VertexDataServer
Direct Known Subclasses:
Contact, LcaoCartoon, MolecularOrbital, Pmesh

public class Isosurface
extends MeshCollection
implements MeshDataServer


Field Summary
private  java.lang.String actualID
           
(package private)  boolean allowMesh
           
private  boolean associateNormals
           
private  int atomIndex
           
private  javax.vecmath.Point3f center
           
private  float[] cutoffRange
           
private  short defaultColix
           
private  boolean explicitContours
           
protected  boolean iHaveBitSets
           
private  boolean iHaveModelIndex
           
private  boolean isColorExplicit
           
private  IsosurfaceMesh[] isomeshes
           
private  boolean isPhaseColored
           
private  boolean isWithinNot
           
protected  JvxlData jvxlData
           
(package private)  int[] keyXy
           
private  javax.vecmath.Point4f lcaoDir
           
private static int MAX_OBJECT_CLICK_DISTANCE_SQUARED
           
private  short meshColix
           
private  float[] moLinearCombination
           
private  int moNumber
           
private  int nLCAO
           
private  javax.vecmath.Point3f offset
           
private  double privateKey
           
private  javax.vecmath.Point3i ptXY
           
private  float scale3d
           
private  java.lang.String script
           
private  java.lang.String scriptAppendix
           
protected  SurfaceGenerator sg
           
protected  IsosurfaceMesh thisMesh
           
private  float withinDistance2
           
private  java.util.List<javax.vecmath.Point3f> withinPoints
           
 
Fields inherited from class org.jmol.shape.MeshCollection
bsDisplay, colix, color, connections, currentMesh, displayWithinDistance2, displayWithinPoints, explicitID, htObjects, isDisplayWithinNot, isFixed, linkedMesh, meshCount, meshes, modelIndex, myType, nUnnamed, pickedMesh, pickedModel, pickedVertex, PREVIOUS_MESH_ID, previousMeshID, title
 
Fields inherited from class org.jmol.shape.Shape
g3d, isBioShape, modelSet, myVisibilityFlag, RADIUS_MAX, shapeID, translucentAllowed, translucentLevel, viewer, xmlProperties
 
Constructor Summary
Isosurface()
           
 
Method Summary
protected  void addMeshInfo(IsosurfaceMesh mesh, java.util.Map<java.lang.String,java.lang.Object> info)
           
 void addRequiredFile(java.lang.String fileName)
           
 int addTriangleCheck(int iA, int iB, int iC, int check, int check2, boolean isAbsolute, int color)
          addTriangleCheck adds a triangle along with a 3-bit check indicating which edges to draw in mesh mode: 1 (iA-iB) + 2 (iB-iC) + 4 (iC-iA)
 int addVertexCopy(javax.vecmath.Point3f vertexXYZ, float value, int assocVertex)
          addVertexCopy is used by the Marching Squares algorithm to uniquely identify a new vertex when an edge is crossed in the 2D plane.
 void allocMesh(java.lang.String thisID, Mesh m)
           
 javax.vecmath.Point3f[] calculateGeodesicSurface(java.util.BitSet bsSelected, float envelopeRadius)
           
private  java.lang.Object calculateVolumeOrArea(boolean isArea)
           
 Point3fi checkObjectClicked(int x, int y, int action, java.util.BitSet bsVisible)
           
 boolean checkObjectHovered(int x, int y, java.util.BitSet bsVisible)
           
protected  void clearSg()
           
private  void createLcaoLobe(javax.vecmath.Vector3f lobeAxis, float factor, int nElectrons)
           
protected  void discardTempData(boolean discardAll)
           
private  void drawLcaoCartoon(javax.vecmath.Vector3f z, javax.vecmath.Vector3f x, javax.vecmath.Vector3f rotAxis, int nElectrons)
           
 void fillMeshData(MeshData meshData, int mode, IsosurfaceMesh mesh)
           
private  java.lang.String findValue(int x, int y, boolean isPicking, java.util.BitSet bsVisible)
           
protected  void getCapSlabInfo(java.lang.String script)
           
private  boolean getClosestNormal(IsosurfaceMesh m, javax.vecmath.Point3f toPt, javax.vecmath.Point3f ptRet, javax.vecmath.Vector3f normalRet)
           
private  void getClosestPoint(IsosurfaceMesh m, int imin, javax.vecmath.Point3f toPt, javax.vecmath.Point3f ptRet, javax.vecmath.Vector3f normalRet)
           
 java.lang.String getCmd(int index)
           
private  short getDefaultColix()
           
private  void getMeshCommand(java.lang.StringBuffer sb, int i)
           
 float[] getPlane(int x)
           
static java.lang.String getPolygonColorData(int ccount, short[] colixes, java.util.BitSet bsSlabDisplay)
           
 java.lang.Object getProperty(java.lang.String property, int index)
           
 boolean getProperty(java.lang.String property, java.lang.Object[] data)
           
private  boolean getScriptBitSets(java.lang.String script, java.util.BitSet[] bsCmd)
           
 java.util.List<java.util.Map<java.lang.String,java.lang.Object>> getShapeDetail()
           
 java.lang.String getShapeState()
           
 int getSurfacePointIndexAndFraction(float cutoff, boolean isCutoffAbsolute, int x, int y, int z, javax.vecmath.Point3i offset, int vA, int vB, float valueA, float valueB, javax.vecmath.Point3f pointA, javax.vecmath.Vector3f edgeVector, boolean isContourType, float[] fReturn)
          getSurfacePointIndex is used by the Marching Cubes algorithm and must return a unique integer identifier for a vertex created by the Marching Cube algorithm when it finds an edge.
 float getValue(int x, int y, int z, int ptyz)
          for readers only
private  void hoverKey(int x, int y)
           
private  void initializeIsosurface()
           
 void initShape()
           
private  void initState()
           
 void invalidateTriangles()
           
private  boolean isPickable(IsosurfaceMesh m, java.util.BitSet bsVisible)
           
 void merge(Shape shape)
          called by ParallelProcessor at completion
private  void navigate(int dz)
           
protected  void newSg()
           
 void notifySurfaceGenerationCompleted()
           
 void notifySurfaceMappingCompleted()
           
private  void setBsVdw()
           
private  void setHeading(javax.vecmath.Point3f pt, javax.vecmath.Vector3f vNorm, int nSeconds)
           
private  void setJvxlInfo()
           
private  void setMesh()
           
 void setOutputStream(BinaryDocument binaryDoc, java.io.OutputStream os)
           
 void setProperty(java.lang.String propertyName, java.lang.Object value, java.util.BitSet bs)
          may come from any source -- executed AFTER a shape's own setProperty method
private  void setPropertySuper(java.lang.String propertyName, java.lang.Object value, java.util.BitSet bs)
           
protected  void setScriptInfo(java.lang.String strCommand)
           
protected  void slabPolygons(java.lang.Object[] slabInfo)
           
 
Methods inherited from class org.jmol.shape.MeshCollection
checkExplicit, clean, deleteMesh, deleteMesh, getIndexFromName, getMesh, setStatusPicked, setVisibilityFlags
 
Methods inherited from class org.jmol.shape.Shape
appendCmd, checkBoundsMinMax, checkObjectDragged, coordinateInRange, findNearestAtomIndex, getColix, getColorCommand, getColorCommand, getFontCommand, getShapeCommands, getShapeCommands, getSize, getSize, getViewer, initializeShape, initModelSet, setColix, setColix, setColix, setModelClickability, setModelSet, setShapeProperty, setShapeSize, setSize, setSize, setStateInfo, setStateInfo, wasClicked
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

isomeshes

private IsosurfaceMesh[] isomeshes

thisMesh

protected IsosurfaceMesh thisMesh

actualID

private java.lang.String actualID

iHaveBitSets

protected boolean iHaveBitSets

explicitContours

private boolean explicitContours

atomIndex

private int atomIndex

moNumber

private int moNumber

moLinearCombination

private float[] moLinearCombination

defaultColix

private short defaultColix

meshColix

private short meshColix

center

private javax.vecmath.Point3f center

offset

private javax.vecmath.Point3f offset

scale3d

private float scale3d

isPhaseColored

private boolean isPhaseColored

isColorExplicit

private boolean isColorExplicit

scriptAppendix

private java.lang.String scriptAppendix

sg

protected SurfaceGenerator sg

jvxlData

protected JvxlData jvxlData

withinDistance2

private float withinDistance2

isWithinNot

private boolean isWithinNot

withinPoints

private java.util.List<javax.vecmath.Point3f> withinPoints

cutoffRange

private float[] cutoffRange

allowMesh

boolean allowMesh

script

private java.lang.String script

iHaveModelIndex

private boolean iHaveModelIndex

nLCAO

private int nLCAO

lcaoDir

private javax.vecmath.Point4f lcaoDir

privateKey

private double privateKey

associateNormals

private boolean associateNormals

MAX_OBJECT_CLICK_DISTANCE_SQUARED

private static final int MAX_OBJECT_CLICK_DISTANCE_SQUARED
See Also:
Constant Field Values

ptXY

private final javax.vecmath.Point3i ptXY

keyXy

int[] keyXy
Constructor Detail

Isosurface

public Isosurface()
Method Detail

allocMesh

public void allocMesh(java.lang.String thisID,
                      Mesh m)
Overrides:
allocMesh in class MeshCollection

initShape

public void initShape()
Overrides:
initShape in class MeshCollection

newSg

protected void newSg()

clearSg

protected void clearSg()

setProperty

public void setProperty(java.lang.String propertyName,
                        java.lang.Object value,
                        java.util.BitSet bs)
Description copied from class: Shape
may come from any source -- executed AFTER a shape's own setProperty method

Overrides:
setProperty in class MeshCollection

slabPolygons

protected void slabPolygons(java.lang.Object[] slabInfo)

setPropertySuper

private void setPropertySuper(java.lang.String propertyName,
                              java.lang.Object value,
                              java.util.BitSet bs)

getProperty

public boolean getProperty(java.lang.String property,
                           java.lang.Object[] data)
Overrides:
getProperty in class MeshCollection
Returns:
true if serviced

getProperty

public java.lang.Object getProperty(java.lang.String property,
                                    int index)
Overrides:
getProperty in class MeshCollection
Returns:
true if serviced

calculateVolumeOrArea

private java.lang.Object calculateVolumeOrArea(boolean isArea)

getPolygonColorData

public static java.lang.String getPolygonColorData(int ccount,
                                                   short[] colixes,
                                                   java.util.BitSet bsSlabDisplay)

getShapeState

public java.lang.String getShapeState()
Overrides:
getShapeState in class Shape

getMeshCommand

private void getMeshCommand(java.lang.StringBuffer sb,
                            int i)

getScriptBitSets

private boolean getScriptBitSets(java.lang.String script,
                                 java.util.BitSet[] bsCmd)

getCapSlabInfo

protected void getCapSlabInfo(java.lang.String script)

initializeIsosurface

private void initializeIsosurface()

initState

private void initState()

setMesh

private void setMesh()

discardTempData

protected void discardTempData(boolean discardAll)

getDefaultColix

private short getDefaultColix()

drawLcaoCartoon

private void drawLcaoCartoon(javax.vecmath.Vector3f z,
                             javax.vecmath.Vector3f x,
                             javax.vecmath.Vector3f rotAxis,
                             int nElectrons)

createLcaoLobe

private void createLcaoLobe(javax.vecmath.Vector3f lobeAxis,
                            float factor,
                            int nElectrons)

invalidateTriangles

public void invalidateTriangles()
Specified by:
invalidateTriangles in interface MeshDataServer

setOutputStream

public void setOutputStream(BinaryDocument binaryDoc,
                            java.io.OutputStream os)
Specified by:
setOutputStream in interface MeshDataServer

fillMeshData

public void fillMeshData(MeshData meshData,
                         int mode,
                         IsosurfaceMesh mesh)
Specified by:
fillMeshData in interface MeshDataServer

notifySurfaceGenerationCompleted

public void notifySurfaceGenerationCompleted()
Specified by:
notifySurfaceGenerationCompleted in interface MeshDataServer

notifySurfaceMappingCompleted

public void notifySurfaceMappingCompleted()
Specified by:
notifySurfaceMappingCompleted in interface MeshDataServer

setBsVdw

private void setBsVdw()

calculateGeodesicSurface

public javax.vecmath.Point3f[] calculateGeodesicSurface(java.util.BitSet bsSelected,
                                                        float envelopeRadius)
Specified by:
calculateGeodesicSurface in interface MeshDataServer

getSurfacePointIndexAndFraction

public int getSurfacePointIndexAndFraction(float cutoff,
                                           boolean isCutoffAbsolute,
                                           int x,
                                           int y,
                                           int z,
                                           javax.vecmath.Point3i offset,
                                           int vA,
                                           int vB,
                                           float valueA,
                                           float valueB,
                                           javax.vecmath.Point3f pointA,
                                           javax.vecmath.Vector3f edgeVector,
                                           boolean isContourType,
                                           float[] fReturn)
Description copied from interface: VertexDataServer
getSurfacePointIndex is used by the Marching Cubes algorithm and must return a unique integer identifier for a vertex created by the Marching Cube algorithm when it finds an edge. If a vertex is discarded, then Integer.MAX_VALUE should be returned. the 3D coordinate of the point can be calculated using surfacePoint.scaleAdd(fraction, edgeVector, pointA); where fraction is generally calculated as: fraction = (cutoff - valueA) / (valueB - valueA); if (isCutoffAbsolute && (fraction < 0 || fraction > 1)) fraction = (-cutoff - valueA) / (valueB - valueA); This method is also used by MarchingCubes to deliver the appropriate oblique planar coordinate to MarchingSquares for later contouring.

Specified by:
getSurfacePointIndexAndFraction in interface VertexDataServer
vA - [0:7]
vB - [0:7]
edgeVector - vector from A to B
Returns:
new vertex index or Integer.MAX_VALUE

addVertexCopy

public int addVertexCopy(javax.vecmath.Point3f vertexXYZ,
                         float value,
                         int assocVertex)
Description copied from interface: VertexDataServer
addVertexCopy is used by the Marching Squares algorithm to uniquely identify a new vertex when an edge is crossed in the 2D plane. The implementing method should COPY the Point3f using Point3f.set(). The data consumer can use the association key to group this vertex with others near the same gridpoint.

Specified by:
addVertexCopy in interface VertexDataServer
assocVertex - unique association vertex or -1
Returns:
new vertex index

addTriangleCheck

public int addTriangleCheck(int iA,
                            int iB,
                            int iC,
                            int check,
                            int check2,
                            boolean isAbsolute,
                            int color)
Description copied from interface: VertexDataServer
addTriangleCheck adds a triangle along with a 3-bit check indicating which edges to draw in mesh mode: 1 (iA-iB) + 2 (iB-iC) + 4 (iC-iA)

Specified by:
addTriangleCheck in interface VertexDataServer
check2 - TODO
Returns:
polygon index or -1

setScriptInfo

protected void setScriptInfo(java.lang.String strCommand)

addRequiredFile

public void addRequiredFile(java.lang.String fileName)
Specified by:
addRequiredFile in interface MeshDataServer

setJvxlInfo

private void setJvxlInfo()

getShapeDetail

public java.util.List<java.util.Map<java.lang.String,java.lang.Object>> getShapeDetail()
Overrides:
getShapeDetail in class Shape

addMeshInfo

protected void addMeshInfo(IsosurfaceMesh mesh,
                           java.util.Map<java.lang.String,java.lang.Object> info)

getPlane

public float[] getPlane(int x)
Specified by:
getPlane in interface VertexDataServer

getValue

public float getValue(int x,
                      int y,
                      int z,
                      int ptyz)
Description copied from interface: VertexDataServer
for readers only

Specified by:
getValue in interface VertexDataServer
Returns:
value[x][y][z]

checkObjectHovered

public boolean checkObjectHovered(int x,
                                  int y,
                                  java.util.BitSet bsVisible)
Overrides:
checkObjectHovered in class Shape
Returns:
T/F

hoverKey

private void hoverKey(int x,
                      int y)

checkObjectClicked

public Point3fi checkObjectClicked(int x,
                                   int y,
                                   int action,
                                   java.util.BitSet bsVisible)
Overrides:
checkObjectClicked in class Shape
Returns:
pt clicked

isPickable

private boolean isPickable(IsosurfaceMesh m,
                           java.util.BitSet bsVisible)

navigate

private void navigate(int dz)

setHeading

private void setHeading(javax.vecmath.Point3f pt,
                        javax.vecmath.Vector3f vNorm,
                        int nSeconds)

getClosestNormal

private boolean getClosestNormal(IsosurfaceMesh m,
                                 javax.vecmath.Point3f toPt,
                                 javax.vecmath.Point3f ptRet,
                                 javax.vecmath.Vector3f normalRet)

getClosestPoint

private void getClosestPoint(IsosurfaceMesh m,
                             int imin,
                             javax.vecmath.Point3f toPt,
                             javax.vecmath.Point3f ptRet,
                             javax.vecmath.Vector3f normalRet)

findValue

private java.lang.String findValue(int x,
                                   int y,
                                   boolean isPicking,
                                   java.util.BitSet bsVisible)
Parameters:
x -
y -
isPicking - IGNORED
bsVisible -
Returns:
value found

merge

public void merge(Shape shape)
Description copied from class: MeshCollection
called by ParallelProcessor at completion

Overrides:
merge in class MeshCollection

getCmd

public java.lang.String getCmd(int index)