Package org.jmol.jvxl.readers
Class SurfaceReader
- java.lang.Object
-
- 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
Fields Modifier and Type Field Description protected booleanallowSigma(package private) static floatANGSTROMS_PER_BOHRprotected float[]anisotropyprivate floatassocCutoffprotected javajs.util.P3centerprotected charcJvxlEdgeNaNprotected intcolorFractionBaseprotected intcolorFractionRangeprivate static java.lang.String[]colorPhasesprotected intcontourVertexCountprotected floatdataMaxprotected floatdataMeanprotected floatdataMin(package private) static floatdefaultCutoff(package private) static floatdefaultMappedDataMax(package private) static floatdefaultMappedDataMinprotected javajs.util.M3eccentricityMatrixprotected javajs.util.M3eccentricityMatrixInverseprotected floateccentricityRatioprotected floateccentricityScaleprivate intedgeCountprivate java.lang.StringedgeDataprotected intedgeFractionBaseprotected intedgeFractionRangeprotected javajs.util.SBfractionData(package private) booleanhasColorDataprivate booleanhaveSetAnisotropyprotected booleanhaveSurfaceAtomsprotected booleanisAnisotropicprotected booleanisEccentricprotected booleanisJvxlprotected booleanisPeriodicprotected booleanisProgressiveprotected booleanisQuietprotected booleanisXLowToHighprotected java.lang.StringjvxlColorDataReadprotected floatjvxlCutoffprotected JvxlDatajvxlDataprotected booleanjvxlDataIs2dContourprotected booleanjvxlDataIsColorDensityprotected booleanjvxlDataIsColorMappedprotected booleanjvxlDataIsPrecisionColorprotected java.lang.StringjvxlEdgeDataReadprotected javajs.util.SBjvxlFileHeaderBufferprotected intjvxlNSurfaceIntsprotected BSjvxlVoxelBitSetprotected MarchingCubesmarchingCubesprotected MarchingSquaresmarchingSquaresprotected MeshDatameshDataprotected MeshDataServermeshDataServerprotected float[]minMaxprotected longnBytesprotected intnDataPointsprotected intnPointsXprotected intnPointsYprotected intnPointsZprotected Parametersparamsprotected javajs.util.P3ptTempprotected QuantumPlaneCalculationqpcprotected SurfaceGeneratorsg(package private) booleanvertexDataOnly(package private) VolumeDatavolumeDataprotected javajs.util.P3volumetricOriginprotected javajs.util.V3[]volumetricVectorsprotected int[]voxelCountsprotected float[][][]voxelDataprotected javajs.util.P3xyzMaxprotected javajs.util.P3xyzMinprotected intyzCountprotected float[][]yzPlanes
-
Constructor Summary
Constructors Constructor Description SurfaceReader()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description intaddTriangleCheck(int iA, int iB, int iC, int check, int iContour, 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)protected intaddVC(javajs.util.T3 vertexXYZ, float value, int assocVertex, boolean asCopy)intaddVertexCopy(javajs.util.T3 vertexXYZ, float value, int assocVertex, boolean asCopy)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) voidapplyColorScale()protected abstract voidcloseReader()private voidcolorData()(package private) voidcolorIsosurface()(package private) booleancreateIsosurface(boolean justForPlane)(package private) voiddiscardTempData(boolean discardAll)protected voiddiscardTempDataSR(boolean discardAll)(package private) voidexcludeMaximumSet()(package private) voidexcludeMinimumSet()protected voidfinalizeMapping()private voidgenerateSurfaceData()(package private) static intgetColorPhaseIndex(java.lang.String color)float[]getMinMaxMappedValues(boolean haveData)private floatgetPhase(javajs.util.T3 pt)float[]getPlane(int x)protected float[]getPlaneSR(int x)protected floatgetSPF(float cutoff, boolean isCutoffAbsolute, float valueA, float valueB, javajs.util.T3 pointA, javajs.util.V3 edgeVector, int x, int y, int z, int vA, int vB, float[] fReturn, javajs.util.T3 ptReturn)intgetSurfaceAtomIndex()protected floatgetSurfacePointAndFraction(float cutoff, boolean isCutoffAbsolute, float valueA, float valueB, javajs.util.T3 pointA, javajs.util.V3 edgeVector, int x, int y, int z, int vA, int vB, float[] fReturn, javajs.util.T3 ptReturn)intgetSurfacePointIndexAndFraction(float cutoff, boolean isCutoffAbsolute, int x, int y, int z, javajs.util.P3i offset, int vA, int vB, float valueA, float valueB, javajs.util.T3 pointA, javajs.util.V3 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.floatgetValue(int x, int y, int z, int ptyz)for readers onlyprotected floatgetValue2(int x, int y, int z, int ptyz)floatgetValueAtPoint(javajs.util.T3 pt, boolean getSource)protected booleangotoAndReadVoxelData(boolean isMapData)protected voidgotoData(int n, int nPoints)(package private) abstract voidinit(SurfaceGenerator sg)implemented in SurfaceFileReader and(package private) voidinitializeMapping()(package private) voidinitializeVolumetricData()(package private) voidinitPlanes()(package private) voidinitSR(SurfaceGenerator sg)(package private) voidjvxlUpdateInfo()protected voidnewVoxelDataCube()protected voidpostProcessVertices()(package private) booleanreadAndSetVolumeParameters(boolean isMapData)protected java.lang.StringreadColorData()protected abstract voidreadSurfaceData(boolean isMapData)protected abstract booleanreadVolumeData(boolean isMapData)protected abstract booleanreadVolumeParameters(boolean isMapData)(package private) voidresetIsosurface()voidselectPocket(boolean doExclude)protected voidsetBBox(javajs.util.T3 pt, float margin)private voidsetBBoxAll()protected voidsetOutputChannel(javajs.util.OC out)protected voidsetVectorAnisotropy(javajs.util.T3 v)protected voidsetVertexAnisotropy(javajs.util.T3 pt)protected voidsetVolumeDataV(VolumeData v)protected voidsetVolumetricAnisotropy()protected voidsetVolumetricOriginAnisotropy()voidslabIsosurface(javajs.util.Lst<java.lang.Object[]> slabInfo)(package private) voidupdateSurfaceData()(package private) voidupdateTriangles()
-
-
-
Field Detail
-
sg
protected SurfaceGenerator sg
-
meshDataServer
protected MeshDataServer meshDataServer
-
params
protected Parameters params
-
meshData
protected MeshData meshData
-
jvxlData
protected JvxlData jvxlData
-
volumeData
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
-
isPeriodic
protected boolean isPeriodic
-
vertexDataOnly
boolean vertexDataOnly
-
hasColorData
boolean hasColorData
-
dataMin
protected float dataMin
-
dataMax
protected float dataMax
-
dataMean
protected float dataMean
-
xyzMin
protected javajs.util.P3 xyzMin
-
xyzMax
protected javajs.util.P3 xyzMax
-
center
protected javajs.util.P3 center
-
anisotropy
protected float[] anisotropy
-
isAnisotropic
protected boolean isAnisotropic
-
eccentricityMatrix
protected javajs.util.M3 eccentricityMatrix
-
eccentricityMatrixInverse
protected javajs.util.M3 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 javajs.util.P3 volumetricOrigin
-
volumetricVectors
protected javajs.util.V3[] 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 javajs.util.SB jvxlFileHeaderBuffer
-
fractionData
protected javajs.util.SB fractionData
-
jvxlEdgeDataRead
protected java.lang.String jvxlEdgeDataRead
-
jvxlColorDataRead
protected java.lang.String jvxlColorDataRead
-
jvxlVoxelBitSet
protected BS jvxlVoxelBitSet
-
jvxlDataIsColorMapped
protected boolean jvxlDataIsColorMapped
-
jvxlDataIsPrecisionColor
protected boolean jvxlDataIsPrecisionColor
-
jvxlDataIs2dContour
protected boolean jvxlDataIs2dContour
-
jvxlDataIsColorDensity
protected boolean jvxlDataIsColorDensity
-
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 QuantumPlaneCalculation qpc
-
ptTemp
protected final javajs.util.P3 ptTemp
-
colorPhases
private static final java.lang.String[] colorPhases
-
minMax
protected float[] minMax
-
haveSetAnisotropy
private boolean haveSetAnisotropy
-
-
Method Detail
-
init
abstract void init(SurfaceGenerator sg)
implemented in SurfaceFileReader and- Parameters:
sg-
-
initSR
void initSR(SurfaceGenerator sg)
-
closeReader
protected abstract void closeReader()
-
setOutputChannel
protected void setOutputChannel(javajs.util.OC out)
- Parameters:
out-
-
newVoxelDataCube
protected void newVoxelDataCube()
-
setVolumeDataV
protected void setVolumeDataV(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)
-
discardTempDataSR
protected void discardTempDataSR(boolean discardAll)
-
initializeVolumetricData
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:
getPlanein interfaceVertexDataServer
-
getPlaneSR
protected float[] getPlaneSR(int x)
-
initPlanes
void initPlanes()
-
getValue
public float getValue(int x, int y, int z, int ptyz)Description copied from interface:VertexDataServerfor readers only- Specified by:
getValuein interfaceVertexDataServer- Returns:
- value[x][y][z]
-
getValue2
protected float getValue2(int x, int y, int z, int ptyz)
-
generateSurfaceData
private void generateSurfaceData()
-
postProcessVertices
protected void postProcessVertices()
-
getSurfacePointIndexAndFraction
public int getSurfacePointIndexAndFraction(float cutoff, boolean isCutoffAbsolute, int x, int y, int z, javajs.util.P3i offset, int vA, int vB, float valueA, float valueB, javajs.util.T3 pointA, javajs.util.V3 edgeVector, boolean isContourType, float[] fReturn)Description copied from interface:VertexDataServergetSurfacePointIndex 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:
getSurfacePointIndexAndFractionin interfaceVertexDataServervA- [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, javajs.util.T3 pointA, javajs.util.V3 edgeVector, int x, int y, int z, int vA, int vB, float[] fReturn, javajs.util.T3 ptReturn)
-
getSPF
protected float getSPF(float cutoff, boolean isCutoffAbsolute, float valueA, float valueB, javajs.util.T3 pointA, javajs.util.V3 edgeVector, int x, int y, int z, int vA, int vB, float[] fReturn, javajs.util.T3 ptReturn)- Parameters:
cutoff-isCutoffAbsolute-valueA-valueB-pointA-edgeVector-x- TODOy- TODOz- TODOvA-vB-fReturn-ptReturn-- Returns:
- fractional distance from A to B
-
addVertexCopy
public int addVertexCopy(javajs.util.T3 vertexXYZ, float value, int assocVertex, boolean asCopy)Description copied from interface:VertexDataServeraddVertexCopy 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:
addVertexCopyin interfaceVertexDataServerassocVertex- unique association vertex or -1- Returns:
- new vertex index
-
addVC
protected int addVC(javajs.util.T3 vertexXYZ, float value, int assocVertex, boolean asCopy)
-
addTriangleCheck
public int addTriangleCheck(int iA, int iB, int iC, int check, int iContour, boolean isAbsolute, int color)Description copied from interface:VertexDataServeraddTriangleCheck 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:
addTriangleCheckin interfaceVertexDataServeriContour- 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(javajs.util.T3 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(javajs.util.Lst<java.lang.Object[]> slabInfo)
-
setVertexAnisotropy
protected void setVertexAnisotropy(javajs.util.T3 pt)
-
setVectorAnisotropy
protected void setVectorAnisotropy(javajs.util.T3 v)
-
setVolumetricAnisotropy
protected void setVolumetricAnisotropy()
-
setVolumetricOriginAnisotropy
protected void setVolumetricOriginAnisotropy()
-
setBBoxAll
private void setBBoxAll()
-
setBBox
protected void setBBox(javajs.util.T3 pt, float margin)
-
getValueAtPoint
public float getValueAtPoint(javajs.util.T3 pt, boolean getSource)- Parameters:
pt-getSource- TODO- Returns:
- value
-
initializeMapping
void initializeMapping()
-
finalizeMapping
protected void finalizeMapping()
-
getSurfaceAtomIndex
public int getSurfaceAtomIndex()
-
-