org.jmol.jvxl.readers
Class SurfaceReader

java.lang.Object
  extended by org.jmol.jvxl.readers.SurfaceReader
All Implemented Interfaces:
VertexDataServer
Direct Known Subclasses:
SurfaceFileReader, VolumeDataReader

public abstract class SurfaceReader
extends java.lang.Object
implements VertexDataServer


Field Summary
protected  boolean allowSigma
           
(package private) static float ANGSTROMS_PER_BOHR
           
protected  float[] anisotropy
           
private  float assocCutoff
           
protected  javax.vecmath.Point3f center
           
protected  char cJvxlEdgeNaN
           
protected  int colorFractionBase
           
protected  int colorFractionRange
           
private static java.lang.String[] colorPhases
           
protected  int contourVertexCount
           
protected  float dataMax
           
protected  float dataMean
           
protected  float dataMin
           
(package private) static float defaultCutoff
           
(package private) static float defaultMappedDataMax
           
(package private) static float defaultMappedDataMin
           
protected  javax.vecmath.Matrix3f eccentricityMatrix
           
protected  javax.vecmath.Matrix3f eccentricityMatrixInverse
           
protected  float eccentricityRatio
           
protected  float eccentricityScale
           
private  int edgeCount
           
private  java.lang.String edgeData
           
protected  int edgeFractionBase
           
protected  int edgeFractionRange
           
protected  java.lang.StringBuffer fractionData
           
(package private)  boolean hasColorData
           
private  boolean haveSetAnisotropy
           
protected  boolean haveSurfaceAtoms
           
protected  boolean isAnisotropic
           
protected  boolean isEccentric
           
protected  boolean isJvxl
           
protected  boolean isProgressive
           
protected  boolean isQuiet
           
protected  boolean isXLowToHigh
           
protected  java.lang.String jvxlColorDataRead
           
protected  float jvxlCutoff
           
protected  JvxlData jvxlData
           
protected  boolean jvxlDataIs2dContour
           
protected  boolean jvxlDataIsColorMapped
           
protected  boolean jvxlDataIsPrecisionColor
           
protected  java.lang.String jvxlEdgeDataRead
           
protected  java.lang.StringBuffer jvxlFileHeaderBuffer
           
protected  int jvxlNSurfaceInts
           
protected  java.util.BitSet jvxlVoxelBitSet
           
protected  MarchingCubes marchingCubes
           
protected  MarchingSquares marchingSquares
           
protected  MeshData meshData
           
protected  MeshDataServer meshDataServer
           
protected  float[] minMax
           
protected  long nBytes
           
protected  int nDataPoints
           
protected  int nPointsX
           
protected  int nPointsY
           
protected  int nPointsZ
           
protected  Parameters params
           
protected  javax.vecmath.Point3f ptTemp
           
protected  QuantumPlaneCalculationInterface qpc
           
protected  SurfaceGenerator sg
           
(package private)  boolean vertexDataOnly
           
protected  VolumeData volumeData
           
protected  javax.vecmath.Point3f volumetricOrigin
           
protected  javax.vecmath.Vector3f[] volumetricVectors
           
protected  int[] voxelCounts
           
protected  float[][][] voxelData
           
protected  javax.vecmath.Point3f xyzMax
           
protected  javax.vecmath.Point3f xyzMin
           
protected  int yzCount
           
protected  float[][] yzPlanes
           
 
Constructor Summary
SurfaceReader(SurfaceGenerator sg)
           
 
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(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.
(package private)  void applyColorScale()
           
protected abstract  void closeReader()
           
private  void colorData()
           
(package private)  void colorIsosurface()
           
(package private)  boolean createIsosurface(boolean justForPlane)
           
(package private)  void discardTempData(boolean discardAll)
           
(package private)  void excludeMaximumSet()
           
(package private)  void excludeMinimumSet()
           
protected  void finalizeMapping()
           
private  void generateSurfaceData()
           
(package private) static int getColorPhaseIndex(java.lang.String color)
           
 float[] getMinMaxMappedValues(boolean haveData)
           
private  float getPhase(javax.vecmath.Point3f pt)
           
 float[] getPlane(int x)
           
 int getSurfaceAtomIndex()
           
protected  float getSurfacePointAndFraction(float cutoff, boolean isCutoffAbsolute, float valueA, float valueB, javax.vecmath.Point3f pointA, javax.vecmath.Vector3f edgeVector, int x, int y, int z, int vA, int vB, float[] fReturn, javax.vecmath.Point3f ptReturn)
           
 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
 float getValueAtPoint(javax.vecmath.Point3f pt)
           
protected  boolean gotoAndReadVoxelData(boolean isMapData)
           
protected  void gotoData(int n, int nPoints)
           
protected  void initializeMapping()
           
protected  void initializeVolumetricData()
           
protected  void initPlanes()
           
(package private)  void jvxlUpdateInfo()
           
protected  void newVoxelDataCube()
           
protected  void postProcessVertices()
           
(package private)  boolean readAndSetVolumeParameters(boolean isMapData)
           
protected  java.lang.String readColorData()
           
protected abstract  void readSurfaceData(boolean isMapData)
           
protected abstract  boolean readVolumeData(boolean isMapData)
           
protected abstract  boolean readVolumeParameters(boolean isMapData)
           
(package private)  void resetIsosurface()
           
 void selectPocket(boolean doExclude)
           
private  void setBoundingBox()
           
protected  void setBoundingBox(javax.vecmath.Point3f pt, float margin)
           
protected  void setOutputStream(java.io.OutputStream os)
           
protected  void setVectorAnisotropy(javax.vecmath.Vector3f v)
           
protected  void setVertexAnisotropy(javax.vecmath.Point3f pt)
           
protected  void setVolumeData(VolumeData v)
           
protected  void setVolumetricAnisotropy()
           
protected  void setVolumetricOriginAnisotropy()
           
 void slabIsosurface(java.util.List<java.lang.Object[]> slabInfo)
           
(package private)  void updateSurfaceData()
           
(package private)  void updateTriangles()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sg

protected SurfaceGenerator sg

meshDataServer

protected MeshDataServer meshDataServer

params

protected Parameters params

meshData

protected MeshData meshData

jvxlData

protected JvxlData jvxlData

volumeData

protected VolumeData volumeData

edgeData

private java.lang.String edgeData

haveSurfaceAtoms

protected boolean haveSurfaceAtoms

allowSigma

protected boolean allowSigma

isProgressive

protected boolean isProgressive

isXLowToHigh

protected boolean isXLowToHigh

assocCutoff

private float assocCutoff

isQuiet

protected boolean isQuiet

vertexDataOnly

boolean vertexDataOnly

hasColorData

boolean hasColorData

dataMin

protected float dataMin

dataMax

protected float dataMax

dataMean

protected float dataMean

xyzMin

protected javax.vecmath.Point3f xyzMin

xyzMax

protected javax.vecmath.Point3f xyzMax

center

protected javax.vecmath.Point3f center

anisotropy

protected float[] anisotropy

isAnisotropic

protected boolean isAnisotropic

eccentricityMatrix

protected javax.vecmath.Matrix3f eccentricityMatrix

eccentricityMatrixInverse

protected javax.vecmath.Matrix3f eccentricityMatrixInverse

isEccentric

protected boolean isEccentric

eccentricityScale

protected float eccentricityScale

eccentricityRatio

protected float eccentricityRatio

ANGSTROMS_PER_BOHR

static final float ANGSTROMS_PER_BOHR
See Also:
Constant Field Values

defaultMappedDataMin

static final float defaultMappedDataMin
See Also:
Constant Field Values

defaultMappedDataMax

static final float defaultMappedDataMax
See Also:
Constant Field Values

defaultCutoff

static final float defaultCutoff
See Also:
Constant Field Values

edgeCount

private int edgeCount

volumetricOrigin

protected javax.vecmath.Point3f volumetricOrigin

volumetricVectors

protected javax.vecmath.Vector3f[] volumetricVectors

voxelCounts

protected int[] voxelCounts

voxelData

protected float[][][] voxelData

nBytes

protected long nBytes

nDataPoints

protected int nDataPoints

nPointsX

protected int nPointsX

nPointsY

protected int nPointsY

nPointsZ

protected int nPointsZ

isJvxl

protected boolean isJvxl

edgeFractionBase

protected int edgeFractionBase

edgeFractionRange

protected int edgeFractionRange

colorFractionBase

protected int colorFractionBase

colorFractionRange

protected int colorFractionRange

jvxlFileHeaderBuffer

protected java.lang.StringBuffer jvxlFileHeaderBuffer

fractionData

protected java.lang.StringBuffer fractionData

jvxlEdgeDataRead

protected java.lang.String jvxlEdgeDataRead

jvxlColorDataRead

protected java.lang.String jvxlColorDataRead

jvxlVoxelBitSet

protected java.util.BitSet jvxlVoxelBitSet

jvxlDataIsColorMapped

protected boolean jvxlDataIsColorMapped

jvxlDataIsPrecisionColor

protected boolean jvxlDataIsPrecisionColor

jvxlDataIs2dContour

protected boolean jvxlDataIs2dContour

jvxlCutoff

protected float jvxlCutoff

jvxlNSurfaceInts

protected int jvxlNSurfaceInts

cJvxlEdgeNaN

protected char cJvxlEdgeNaN

contourVertexCount

protected int contourVertexCount

marchingSquares

protected MarchingSquares marchingSquares

marchingCubes

protected MarchingCubes marchingCubes

yzPlanes

protected float[][] yzPlanes

yzCount

protected int yzCount

qpc

protected QuantumPlaneCalculationInterface qpc

ptTemp

protected final javax.vecmath.Point3f ptTemp

colorPhases

private static final java.lang.String[] colorPhases

minMax

protected float[] minMax

haveSetAnisotropy

private boolean haveSetAnisotropy
Constructor Detail

SurfaceReader

SurfaceReader(SurfaceGenerator sg)
Method Detail

closeReader

protected abstract void closeReader()

setOutputStream

protected void setOutputStream(java.io.OutputStream os)
Parameters:
os -

newVoxelDataCube

protected void newVoxelDataCube()

setVolumeData

protected void setVolumeData(VolumeData v)

readVolumeParameters

protected abstract boolean readVolumeParameters(boolean isMapData)

readVolumeData

protected abstract boolean readVolumeData(boolean isMapData)

jvxlUpdateInfo

void jvxlUpdateInfo()

readAndSetVolumeParameters

boolean readAndSetVolumeParameters(boolean isMapData)

createIsosurface

boolean createIsosurface(boolean justForPlane)

resetIsosurface

void resetIsosurface()

discardTempData

void discardTempData(boolean discardAll)

initializeVolumetricData

protected void initializeVolumetricData()

readSurfaceData

protected abstract void readSurfaceData(boolean isMapData)
                                 throws java.lang.Exception
Throws:
java.lang.Exception

gotoAndReadVoxelData

protected boolean gotoAndReadVoxelData(boolean isMapData)

gotoData

protected void gotoData(int n,
                        int nPoints)
                 throws java.lang.Exception
Parameters:
n -
nPoints -
Throws:
java.lang.Exception

readColorData

protected java.lang.String readColorData()

getPlane

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

initPlanes

protected void initPlanes()

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]

generateSurfaceData

private void generateSurfaceData()

postProcessVertices

protected void postProcessVertices()

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

getSurfacePointAndFraction

protected float getSurfacePointAndFraction(float cutoff,
                                           boolean isCutoffAbsolute,
                                           float valueA,
                                           float valueB,
                                           javax.vecmath.Point3f pointA,
                                           javax.vecmath.Vector3f edgeVector,
                                           int x,
                                           int y,
                                           int z,
                                           int vA,
                                           int vB,
                                           float[] fReturn,
                                           javax.vecmath.Point3f ptReturn)
Parameters:
cutoff -
isCutoffAbsolute -
valueA -
valueB -
pointA -
edgeVector -
x - TODO
y - TODO
z - TODO
vA -
vB -
fReturn -
ptReturn -
Returns:
fractional distance from A to B

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

colorIsosurface

void colorIsosurface()

applyColorScale

void applyColorScale()

colorData

private void colorData()

getColorPhaseIndex

static int getColorPhaseIndex(java.lang.String color)

getPhase

private float getPhase(javax.vecmath.Point3f pt)

getMinMaxMappedValues

public float[] getMinMaxMappedValues(boolean haveData)

updateTriangles

void updateTriangles()

updateSurfaceData

void updateSurfaceData()

selectPocket

public void selectPocket(boolean doExclude)
Parameters:
doExclude -

excludeMinimumSet

void excludeMinimumSet()

excludeMaximumSet

void excludeMaximumSet()

slabIsosurface

public void slabIsosurface(java.util.List<java.lang.Object[]> slabInfo)

setVertexAnisotropy

protected void setVertexAnisotropy(javax.vecmath.Point3f pt)

setVectorAnisotropy

protected void setVectorAnisotropy(javax.vecmath.Vector3f v)

setVolumetricAnisotropy

protected void setVolumetricAnisotropy()

setVolumetricOriginAnisotropy

protected void setVolumetricOriginAnisotropy()

setBoundingBox

private void setBoundingBox()

setBoundingBox

protected void setBoundingBox(javax.vecmath.Point3f pt,
                              float margin)

getValueAtPoint

public float getValueAtPoint(javax.vecmath.Point3f pt)
Parameters:
pt -
Returns:
value

initializeMapping

protected void initializeMapping()

finalizeMapping

protected void finalizeMapping()

getSurfaceAtomIndex

public int getSurfaceAtomIndex()