# Class SurfaceReader

java.lang.Object
org.jmol.jvxl.readers.SurfaceReader

All Implemented Interfaces:
  `VertexDataServer`

Direct Known Subclasses:
  `JvxlXmlReader, PeriodicVolumeFileReader`

public abstract class SurfaceReader extends Object implements VertexDataServer

## Field Summary

Fields
Modifier and Type
Field
Description
`protected boolean`
`allowSigma`
`protected float[]`
`anisotropy`
`protected P3`
`center`
`protected char`
`cJvxlEdgeNaN`
`protected int`
`colorFractionBase`
`protected int`
`colorFractionRange`
`protected int`
`contourVertexCount`
`protected float`
`dataMax`
`protected float`
`dataMean`
`protected float`
`dataMin`
`protected M3`
`eccentricityMatrix`
`protected M3`
`eccentricityMatrixInverse`
`protected float`
`eccentricityRatio`
`protected float`
`eccentricityScale`
`protected int`
`edgeFractionBase`
`protected int`
`edgeFractionRange`
`protected SB`
`fractionData`
`protected boolean`
`haveSurfaceAtoms`
`protected boolean`
`isAnisotropic`
`protected boolean`
`isEccentric`
`protected boolean`
`isJvxl`
`protected boolean`
`isPeriodic`
`protected boolean`
`isProgressive`
`protected boolean`
`isQuiet`
`protected boolean`
`isXLowToHigh`
`protected String`
`jvxlColorDataRead`
`protected float`
`jvxlCutoff`
`protected float[]`
`jvxlCutoffRange`
`protected JvxlData`
`jvxlData`
`protected boolean`
`jvxlDataIs2dContour`
`protected boolean`
`jvxlDataIsColorDensity`
`protected boolean`
`jvxlDataIsColorMapped`
`protected boolean`
`jvxlDataIsPrecisionColor`
`protected String`
`jvxlEdgeDataRead`
`protected SB`
`jvxlFileHeaderBuffer`
`protected int`
`jvxlNSurfaceInts`
`protected BS`
`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 final P3`
`ptTemp`
////////////// MarchingReader Interface Methods ///////////////////
`protected QuantumPlaneCalculation`
`qpc`
`protected SurfaceGenerator`
`sg`
`protected P3`
`volumetricOrigin`
`protected V3[]`
`volumetricVectors`
`protected int[]`
`voxelCounts`
`protected float[][][]`
`voxelData`
`protected P3`
`xyzMax`
`protected P3`
`xyzMin`
`protected int`
`yzCount`
`protected float[][]`
`yzPlanes`

## Method Summary

Modifier and Type
Method
Description
`int`
`addTriangleCheck(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 int`
`addVC(T3 vertexXYZ, float value, int assocVertex, boolean asCopy)`
`int`
`addVertexCopy(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.
`protected abstract void`
`closeReader()`
`protected void`
`discardTempDataSR(boolean discardAll)`
`protected void`
`finalizeMapping()`
`float[]`
`getMinMaxMappedValues(boolean haveData)`
`float[]`
`getPlane(int x)`
`protected float[]`
`getPlaneSR(int x)`
`protected float`
`getSPF(float cutoff, boolean isCutoffAbsolute, float valueA, float valueB, T3 pointA, V3 edgeVector, int x, int y, int z, int vA, int vB, float[] fReturn, T3 ptReturn)`
`int`
`getSurfaceAtomIndex()`
`protected float`
`getSurfacePointAndFraction(float cutoff, boolean isCutoffAbsolute, float valueA, float valueB, T3 pointA, V3 edgeVector, int x, int y, int z, int vA, int vB, float[] fReturn, T3 ptReturn)`
`int`
`getSurfacePointIndexAndFraction(float cutoff, boolean isCutoffAbsolute, int x, int y, int z, P3i offset, int vA, int vB, float valueA, float valueB, T3 pointA, 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.
`float`
`getValue(int x, int y, int z, int ptyz)`
for readers only
`protected float`
`getValue2(int x, int y, int z, int ptyz)`
`float`
`getValueAtPoint(T3 pt, boolean getSource)`
`protected boolean`
`gotoAndReadVoxelData(boolean isMapData)`
`protected void`
`gotoData(int n, int nPoints)`
`protected void`
`newVoxelDataCube()`
`protected void`
`postProcessVertices()`
`protected String`
`readColorData()`
`protected abstract void`
`readSurfaceData(boolean isMapData)`
`protected abstract boolean`
`readVolumeData(boolean isMapData)`
`protected abstract boolean`
`readVolumeParameters(boolean isMapData)`
`void`
`selectPocket(boolean doExclude)`
`protected void`
`setBBox(T3 pt, float margin)`
`protected void`
`setOutputChannel(OC out)`
`protected void`
`setVectorAnisotropy(T3 v)`
`protected void`
`setVertexAnisotropy(T3 pt)`
`protected void`
`setVolumeDataV(VolumeData v)`
`protected void`
`setVolumetricAnisotropy()`
`protected void`
`setVolumetricOriginAnisotropy()`
`void`
`slabIsosurface(Lst<Object[]> slabInfo)`

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### sg

protected SurfaceGenerator sg

### meshDataServer

protected MeshDataServer meshDataServer

### params

protected Parameters params

### meshData

protected MeshData meshData

### jvxlData

protected JvxlData jvxlData

### haveSurfaceAtoms

protected boolean haveSurfaceAtoms

### allowSigma

protected boolean allowSigma

### isProgressive

protected boolean isProgressive

### isXLowToHigh

protected boolean isXLowToHigh

### isQuiet

protected boolean isQuiet

### isPeriodic

protected boolean isPeriodic

### dataMin

protected float dataMin

### dataMax

protected float dataMax

### dataMean

protected float dataMean

### xyzMin

protected P3 xyzMin

### xyzMax

protected P3 xyzMax

### center

protected P3 center

### anisotropy

protected float[] anisotropy

### isAnisotropic

protected boolean isAnisotropic

### eccentricityMatrix

protected M3 eccentricityMatrix

### eccentricityMatrixInverse

protected M3 eccentricityMatrixInverse

### isEccentric

protected boolean isEccentric

### eccentricityScale

protected float eccentricityScale

### eccentricityRatio

protected float eccentricityRatio

### volumetricOrigin

protected P3 volumetricOrigin

### volumetricVectors

protected 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 SB jvxlFileHeaderBuffer

### fractionData

protected SB fractionData

### jvxlEdgeDataRead

protected String jvxlEdgeDataRead

### jvxlColorDataRead

protected 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

### jvxlCutoffRange

protected float[] jvxlCutoffRange

### 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 P3 ptTemp
////////////// MarchingReader Interface Methods ///////////////////

### minMax

protected float[] minMax

## Method Details

### closeReader

protected abstract void closeReader()

### setOutputChannel

protected void setOutputChannel(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)

### discardTempDataSR

protected void discardTempDataSR(boolean discardAll)

### readSurfaceData

protected abstract void readSurfaceData(boolean isMapData) throws Exception

Throws:
  `Exception`

### gotoAndReadVoxelData

protected boolean gotoAndReadVoxelData(boolean isMapData)

### gotoData

protected void gotoData(int n, int nPoints) throws Exception

Parameters:
  `n` -
  `nPoints` -
Throws:
  `Exception`

### readColorData

protected String readColorData()

### getPlane

public float[] getPlane(int x)

Specified by:
  `getPlane` in interface `VertexDataServer`

### getPlaneSR

protected float[] getPlaneSR(int x)

### 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`
Parameters:
  `x` -
  `y` -
  `z` -
  `ptyz` -
Returns:
  value[x][y][z]

### getValue2

protected float getValue2(int x, int y, int z, int ptyz)

### postProcessVertices

protected void postProcessVertices()

### getSurfacePointIndexAndFraction

public int getSurfacePointIndexAndFraction(float cutoff, boolean isCutoffAbsolute, int x, int y, int z, P3i offset, int vA, int vB, float valueA, float valueB, T3 pointA, V3 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 invalid input: '&'invalid input: '&' (fraction invalid input: '<' 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`
Parameters:
  `cutoff` -
  `isCutoffAbsolute` -
  `x` -
  `y` -
  `z` -
  `offset` -
  `vA` - [0:7]
  `vB` - [0:7]
  `valueA` -
  `valueB` -
  `pointA` -
  `edgeVector` - vector from A to B
  `isContourType` -
  `fReturn` -
Returns:
  new vertex index or Integer.MAX_VALUE

### getSurfacePointAndFraction

protected float getSurfacePointAndFraction(float cutoff, boolean isCutoffAbsolute, float valueA, float valueB, T3 pointA, V3 edgeVector, int x, int y, int z, int vA, int vB, float[] fReturn, T3 ptReturn)

### getSPF

protected float getSPF(float cutoff, boolean isCutoffAbsolute, float valueA, float valueB, T3 pointA, V3 edgeVector, int x, int y, int z, int vA, int vB, float[] fReturn, T3 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(T3 vertexXYZ, float value, int assocVertex, boolean asCopy)
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`
Parameters:
  `vertexXYZ` -
  `value` -
  `assocVertex` - unique association vertex or -1
  `asCopy` -
Returns:
  new vertex index

### addVC

protected int addVC(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: `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`
Parameters:
  `iA` -
  `iB` -
  `iC` -
  `check` -
  `iContour` - TODO
  `isAbsolute` -
  `color` -
Returns:
  polygon index or -1

### getMinMaxMappedValues

public float[] getMinMaxMappedValues(boolean haveData)

### selectPocket

public void selectPocket(boolean doExclude)

Parameters:
  `doExclude` -

### slabIsosurface

public void slabIsosurface(Lst<Object[]> slabInfo)

### setVertexAnisotropy

protected void setVertexAnisotropy(T3 pt)

### setVectorAnisotropy

protected void setVectorAnisotropy(T3 v)

### setVolumetricAnisotropy

protected void setVolumetricAnisotropy()

### setVolumetricOriginAnisotropy

protected void setVolumetricOriginAnisotropy()

### setBBox

protected void setBBox(T3 pt, float margin)

### getValueAtPoint

public float getValueAtPoint(T3 pt, boolean getSource)

Parameters:
  `pt` -
  `getSource` - TODO
Returns:
  value

### finalizeMapping

protected void finalizeMapping()

### getSurfaceAtomIndex

public int getSurfaceAtomIndex()