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:
LcaoCartoon, MolecularOrbital, Pmesh

public class Isosurface
extends MeshCollection
implements MeshDataServer


Field Summary
private  boolean associateNormals
           
private  int atomIndex
           
private  Point3f center
           
private  short defaultColix
           
private  boolean explicitContours
           
private  boolean iHaveBitSets
           
private  int indexColorNegative
           
private  int indexColorPositive
           
private  boolean isColorExplicit
           
private  IsosurfaceMesh[] isomeshes
           
private  boolean isPhaseColored
           
protected  JvxlData jvxlData
           
private  Point4f lcaoDir
           
private  int lighting
           
private static int MAX_OBJECT_CLICK_DISTANCE_SQUARED
           
private  short meshColix
           
private  int moNumber
           
private  int nLCAO
           
private  Point3f offset
           
private  Point3i ptXY
           
private  float scale3d
           
protected  SurfaceGenerator sg
           
protected  IsosurfaceMesh thisMesh
           
private  float withinDistance
           
private  List withinPoints
           
 
Fields inherited from class org.jmol.shape.MeshCollection
actualID, allowContourLines, allowMesh, colix, currentMesh, explicitID, haveContours, htObjects, iHaveModelIndex, isFixed, linkedMesh, meshCount, meshes, modelCount, modelIndex, myType, nUnnamed, pickedMesh, pickedModel, pickedVertex, previousMeshID, script, 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
 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(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(String thisID, Mesh m)
           
 Point3f[] calculateGeodesicSurface(BitSet bsSelected, float envelopeRadius)
           
 Point3fi checkObjectClicked(int x, int y, int action, BitSet bsVisible)
           
 boolean checkObjectHovered(int x, int y, BitSet bsVisible)
           
private  boolean checkWithin(Point3f pti)
           
protected  void clearSg()
           
private  void createLcaoLobe(Vector3f lobeAxis, float factor, int nElectrons)
           
private  void discardTempData(boolean discardAll)
           
private  void drawLcaoCartoon(Vector3f z, Vector3f x, Vector3f rotAxis, int nElectrons)
           
 void fillMeshData(MeshData meshData, int mode, IsosurfaceMesh mesh)
           
private  String findValue(int x, int y, boolean isPicking, BitSet bsVisible)
           
protected  void getCapSlabInfo(String script)
           
private  Object getCapSlabObject(int i, String script)
           
private  boolean getClosestNormal(IsosurfaceMesh m, Point3f toPt, Point3f ptRet, Vector3f normalRet)
           
private  void getClosestPoint(IsosurfaceMesh m, int imin, Point3f toPt, Point3f ptRet, Vector3f normalRet)
           
private  void getColorState(StringBuffer sb, Mesh mesh)
           
private  short getDefaultColix()
           
private  void getMeshCommand(StringBuffer sb, int i)
           
 void getPlane(int x)
           
static String getPolygonColorData(int ccount, short[] colixes)
           
 Object getProperty(String property, int index)
           
 boolean getProperty(String property, Object[] data)
           
private  boolean getScriptBitSets(String script, BitSet[] bsCmd)
           
 List getShapeDetail()
           
 String getShapeState()
           
 int getSurfacePointIndexAndFraction(float cutoff, boolean isCutoffAbsolute, int x, int y, int z, Point3i offset, int vA, int vB, float valueA, float valueB, Point3f pointA, 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 initializeIsosurface()
           
 void initShape()
           
private  void initState()
           
 void invalidateTriangles()
           
private  boolean isPickable(IsosurfaceMesh m, BitSet bsVisible)
           
 void merge(Shape shape)
          called by ParallelProcessor at completion
private  void navigate(int dz)
           
private  void newSg()
           
 void notifySurfaceGenerationCompleted()
           
 void notifySurfaceMappingCompleted()
           
private  void remapColors(ColorEncoder ce)
           
private  void setColorCommand(ColorEncoder ce)
           
private  void setHeading(Point3f pt, Vector3f vNorm, int nSeconds)
           
private  void setJvxlInfo()
           
private  void setModelIndex()
           
 void setProperty(String propertyName, Object value, BitSet bs)
          may come from any source -- executed AFTER a shape's own setProperty method
private  void setPropertySuper(String propertyName, Object value, BitSet bs)
           
protected  void setScriptInfo(String strCommand)
           
 
Methods inherited from class org.jmol.shape.MeshCollection
checkExplicit, clean, deleteMesh, deleteMesh, getIndexFromName, getMesh, getModelIndex, setModelIndex, 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

lighting

private int lighting

iHaveBitSets

private boolean iHaveBitSets

explicitContours

private boolean explicitContours

atomIndex

private int atomIndex

moNumber

private int moNumber

defaultColix

private short defaultColix

meshColix

private short meshColix

center

private Point3f center

offset

private Point3f offset

scale3d

private float scale3d

isPhaseColored

private boolean isPhaseColored

isColorExplicit

private boolean isColorExplicit

sg

protected SurfaceGenerator sg

jvxlData

protected JvxlData jvxlData

withinDistance

private float withinDistance

withinPoints

private List withinPoints

indexColorPositive

private int indexColorPositive

indexColorNegative

private int indexColorNegative

nLCAO

private int nLCAO

lcaoDir

private Point4f lcaoDir

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 Point3i ptXY
Constructor Detail

Isosurface

public Isosurface()
Method Detail

allocMesh

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

initShape

public void initShape()
Overrides:
initShape in class MeshCollection

newSg

private void newSg()

clearSg

protected void clearSg()

setProperty

public void setProperty(String propertyName,
                        Object value,
                        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

setPropertySuper

private void setPropertySuper(String propertyName,
                              Object value,
                              BitSet bs)

getProperty

public boolean getProperty(String property,
                           Object[] data)
Overrides:
getProperty in class MeshCollection

getProperty

public Object getProperty(String property,
                          int index)
Overrides:
getProperty in class MeshCollection

getPolygonColorData

public static String getPolygonColorData(int ccount,
                                         short[] colixes)

getShapeState

public String getShapeState()
Overrides:
getShapeState in class Shape

getMeshCommand

private void getMeshCommand(StringBuffer sb,
                            int i)

getColorState

private void getColorState(StringBuffer sb,
                           Mesh mesh)

getScriptBitSets

private boolean getScriptBitSets(String script,
                                 BitSet[] bsCmd)

getCapSlabInfo

protected void getCapSlabInfo(String script)

getCapSlabObject

private Object getCapSlabObject(int i,
                                String script)

initializeIsosurface

private void initializeIsosurface()

initState

private void initState()

discardTempData

private void discardTempData(boolean discardAll)

getDefaultColix

private short getDefaultColix()

drawLcaoCartoon

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

createLcaoLobe

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

invalidateTriangles

public void invalidateTriangles()
Specified by:
invalidateTriangles 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

setColorCommand

private void setColorCommand(ColorEncoder ce)

calculateGeodesicSurface

public Point3f[] calculateGeodesicSurface(BitSet bsSelected,
                                          float envelopeRadius)
Specified by:
calculateGeodesicSurface in interface MeshDataServer

getSurfacePointIndexAndFraction

public int getSurfacePointIndexAndFraction(float cutoff,
                                           boolean isCutoffAbsolute,
                                           int x,
                                           int y,
                                           int z,
                                           Point3i offset,
                                           int vA,
                                           int vB,
                                           float valueA,
                                           float valueB,
                                           Point3f pointA,
                                           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(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

checkWithin

private boolean checkWithin(Point3f pti)

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

setModelIndex

private void setModelIndex()

setScriptInfo

protected void setScriptInfo(String strCommand)

setJvxlInfo

private void setJvxlInfo()

getShapeDetail

public List getShapeDetail()
Overrides:
getShapeDetail in class Shape

remapColors

private void remapColors(ColorEncoder ce)

getPlane

public void 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,
                                  BitSet bsVisible)
Overrides:
checkObjectHovered in class Shape

checkObjectClicked

public Point3fi checkObjectClicked(int x,
                                   int y,
                                   int action,
                                   BitSet bsVisible)
Overrides:
checkObjectClicked in class Shape

isPickable

private boolean isPickable(IsosurfaceMesh m,
                           BitSet bsVisible)

navigate

private void navigate(int dz)

setHeading

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

getClosestNormal

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

getClosestPoint

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

findValue

private String findValue(int x,
                         int y,
                         boolean isPicking,
                         BitSet bsVisible)

merge

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

Overrides:
merge in class MeshCollection