IsosurfaceMesh
Date: 2019-10-22

org.jmol.shapesurface

## Class IsosurfaceMesh

- java.lang.Object
- - org.jmol.util.MeshSurface
  - - org.jmol.shape.Mesh
    - - org.jmol.shapesurface.IsosurfaceMesh

-     public class IsosurfaceMesh
      extends Mesh

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private java.util.Map<java.lang.Integer,java.lang.Integer>` | `assocGridPointMap`
    `private java.util.Map<java.lang.Integer,javajs.util.V3>` | `assocGridPointNormals`
    `(package private) javajs.util.BS` | `bsVdw`
    `(package private) java.lang.Object` | `calculatedArea`
    `(package private) java.lang.Object` | `calculatedVolume`
    `(package private) javajs.util.P3[]` | `centers`
    `ColorEncoder` | `colorEncoder`
    `boolean` | `colorPhased`
    `(package private) short[]` | `contourColixes`
    `(package private) float[]` | `contourValues`
    `int` | `dataType`
    `int` | `firstRealVertex`
    `boolean` | `hasGridPoints`
    `(package private) java.lang.Object` | `info`
    `JvxlData` | `jvxlData`
    `private int` | `mergeAssociatedNormalCount`
    `int` | `vertexIncrement`

    - ### Fields inherited from class org.jmol.shape.Mesh

      `atomIndex, bsTemp, cappingObject, checkByteCount, color, colorCommand, colorDensity, colorType, connectedAtoms, diameter, drawTriangles, fillTriangles, frontOnly, havePlanarContours, haveXyPoints, index, insideOut, isModelConnected, isShell, isTwoSided, isValid, lattice, lighting, lineData, linkedMesh, meshColix, modelIndex, normixes, PREVIOUS_MESH_ID, ptCenter, recalcAltVertices, scale3d, scriptCommand, showContourLines, showPoints, showTriangles, slabbingObject, symopColixes, symopNormixes, symops, thisID, title, unitCell, useColix, vAB, vertexColorMap, visibilityFlags, visible, volumeRenderPointSize, vTemp, width`

    - ### Fields inherited from class org.jmol.util.MeshSurface

      `altVertices, bsDisplay, bsPolygons, bsSlabDisplay, bsSlabGhost, colix, colixBack, colorsExplicit, dataOnly, haveQuads, iA, iB, iC, isColorSolid, isDrawPolygon, isMerged, mat4, mergePolygonCount0, mergeVertexCount0, meshType, normalCount, normals, normalsTemp, normixCount, nSets, oabc, offset, P_CHECK, P_CONTOUR, P_EXPLICIT_COLOR, pc, pcs, pis, polygonCount0, SEED_COUNT, slabColix, slabMeshType, slabOptions, surfaceAtoms, surfaceSet, vc, vcs, vertexCount0, vertexSets, vertexSource, vs, vvs, vwr`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `IsosurfaceMesh(Viewer vwr, java.lang.String thisID, short colix, int index)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `private static void` | `addColorToMap(java.util.Map<java.lang.String,javajs.util.BS> colorMap, java.lang.String color, javajs.util.BS bs)` adds a set of specifically-colored vertices to the map, ensuring that no vertex is in two maps.
    `static void` | `addContourPoints(javajs.util.Lst<java.lang.Object> v, javajs.util.BS bsContour, int i, javajs.util.SB fData, javajs.util.T3[] vertices, float[] vertexValues, int iA, int iB, int iC, float value)`
    `(package private) int` | `addVertexCopy(javajs.util.T3 vertex, float value, int assocVertex, boolean associateNormals, boolean asCopy)`
    `(package private) void` | `allocVertexColixes()`
    `(package private) void` | `checkAllocColixes()`
    `private static float` | `checkPt(float[] vertexValues, int i, int j, float v)` two values -- v1, and v2, which need not be ordered v1 < v2.
    `(package private) void` | `clearType(java.lang.String meshType, boolean iAddGridPoints)`
    `(package private) void` | `colorVertices(short colix, javajs.util.BS bs, boolean isAtoms)` color a specific set of vertices a specific color
    `(package private) void` | `deleteContours()`
    `(package private) void` | `fixLattice()`
    `private static void` | `get3dContour(IsosurfaceMesh m, javajs.util.Lst<java.lang.Object> v, float value, short colix)`
    `javajs.util.P3[]` | `getBoundingBox()`
    `(package private) javajs.util.P3[]` | `getCenters()`
    `(package private) java.util.Map<java.lang.String,java.lang.Object>` | `getContourList(Viewer vwr)`
    `private static javajs.util.P3` | `getContourPoint(javajs.util.T3[] vertices, int i, int j, float f)`
    `javajs.util.Lst<java.lang.Object>[]` | `getContours()` create a set of contour data.
    `(package private) float[]` | `getDataMinMax()`
    `(package private) float[]` | `getDataRange()`
    `protected float` | `getMinDistance2ForVertexGrouping()`
    `java.lang.Object` | `getPmeshData(boolean isBinary)`
    `float` | `getResolution()`
    `SymmetryInterface` | `getUnitCell()`
    `javajs.util.BS` | `getVisibleVertexBitSet()`
    `protected void` | `merge(MeshData m)`
    `private static int` | `mergePolygons(MeshSurface m, int ipt, int vertexCount, int[][] newPolygons)`
    `void` | `reinitializeLightingAndColor(Viewer vwr)`
    `(package private) void` | `remapColors(Viewer vwr, ColorEncoder ce, float translucentLevel)` remaps colors based on a new color scheme or translucency level
    `void` | `setBoundingBox(javajs.util.P3[] pts)`
    `(package private) void` | `setColorCommand()` just sets the color command for this isosurface.
    `(package private) boolean` | `setColorsFromJvxlData(int colorRgb)` from Isosurface.notifySurfaceGenerationCompleted() starting with Jmol 12.1.50, JVXL files contain color, translucency, color scheme information, and vertex color mappings (as from COLOR ISOSURFACE {hydrophobic} WHITE), returning these settings when the JVXL file is opened.
    `static void` | `setContourVector(javajs.util.Lst<java.lang.Object> v, int nPolygons, javajs.util.BS bsContour, float value, short colix, int color, javajs.util.SB fData)`
    `void` | `setDiscreteColixes(float[] values, short[] colixes)`
    `(package private) void` | `setJvxlColorMap(boolean isAll)` set up the jvxlData fields needed for either just the header (isAll = false) or the full file (isAll = true)
    `(package private) void` | `setJvxlDataRendering()`
    `void` | `setMerged(boolean TF)`
    `void` | `setTranslucent(boolean isTranslucent, float iLevel)`
    `(package private) void` | `setVertexColixesForAtoms(Viewer vwr, short[] colixes, int[] atomMap, javajs.util.BS bs)`
    `(package private) void` | `setVertexColorMap()`
    `protected void` | `sumVertexNormals(javajs.util.T3[] vertices, javajs.util.V3[] vectorSums)`
    `void` | `updateCoordinates(javajs.util.M4 m, javajs.util.BS bs)` bs will be null if this is a set from the new isosurface MOVE [mat4] command

    - ### Methods inherited from class org.jmol.shape.Mesh

      `checkWithin, clear, clearMesh, getNormals, getNormalsTemp, getOffsetVertices, getRendering, getState, getVertexIndexFromNumber, getVisibleVBS, initialize, mesh1, rotateTranslate, setLighting, setNormixes, setShowWithin, setTokenProperty, setVisibilityFlags, sumVertexNormals2`

    - ### Methods inherited from class org.jmol.util.MeshSurface

      `addPolygon, addPolygonC, addQuad, addTriangle, addTriangleCheck, addV, addVCVal, getFaces, getMeshSlicer, getSlabColor, getSlabType, getSphereData, getSphericalInterpolationFraction, getVertices, invalidatePolygons, newMesh, resetSlab, setABC, setBox, setColix, setColixBack, setPolygonCount, setTranslucentVertices, slabBrillouin, slabPolygonsList`

    - ### Methods inherited from class java.lang.Object

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

- - ### Field Detail

    - #### jvxlData

          public JvxlData jvxlData

    - #### vertexIncrement

          public int vertexIncrement

    - #### firstRealVertex

          public int firstRealVertex

    - #### dataType

          public int dataType

    - #### hasGridPoints

          public boolean hasGridPoints

    - #### calculatedArea

          java.lang.Object calculatedArea

    - #### calculatedVolume

          java.lang.Object calculatedVolume

    - #### info

          java.lang.Object info

    - #### assocGridPointMap

          private java.util.Map<java.lang.Integer,java.lang.Integer> assocGridPointMap

    - #### assocGridPointNormals

          private java.util.Map<java.lang.Integer,javajs.util.V3> assocGridPointNormals

    - #### mergeAssociatedNormalCount

          private int mergeAssociatedNormalCount

    - #### centers

          javajs.util.P3[] centers

    - #### contourValues

          float[] contourValues

    - #### contourColixes

          short[] contourColixes

    - #### colorEncoder

          public ColorEncoder colorEncoder

    - #### bsVdw

          javajs.util.BS bsVdw

    - #### colorPhased

          public boolean colorPhased

  - ### Constructor Detail

    - #### IsosurfaceMesh

          IsosurfaceMesh(Viewer vwr,
                         java.lang.String thisID,
                         short colix,
                         int index)

      Parameters:
        `vwr` -
        `thisID` -
        `colix` -
        `index` -

  - ### Method Detail

    - #### getResolution

          public float getResolution()

      Overrides:
        `getResolution` in class `MeshSurface`

    - #### clearType

          void clearType(java.lang.String meshType,
                         boolean iAddGridPoints)

    - #### allocVertexColixes

          void allocVertexColixes()

    - #### addVertexCopy

          int addVertexCopy(javajs.util.T3 vertex,
                            float value,
                            int assocVertex,
                            boolean associateNormals,
                            boolean asCopy)

    - #### setTranslucent

          public void setTranslucent(boolean isTranslucent,
                                     float iLevel)

      Overrides:
        `setTranslucent` in class `Mesh`

    - #### setMerged

          public void setMerged(boolean TF)

    - #### sumVertexNormals

          protected void sumVertexNormals(javajs.util.T3[] vertices,
                                          javajs.util.V3[] vectorSums)

      Overrides:
        `sumVertexNormals` in class `Mesh`

    - #### getCenters

          javajs.util.P3[] getCenters()

    - #### getContours

          public javajs.util.Lst<java.lang.Object>[] getContours()

      create a set of contour data. Each contour is a Vector containing: 0 Integer number of polygons (length of BitSet) 1 BitSet of critical triangles 2 Float value 3 int[] [colorArgb] 4 StringXBuilder containing encoded data for each segment: char type ('3', '6', '5') indicating which two edges of the triangle are connected: '3' 0x011 AB-BC '5' 0x101 AB-CA '6' 0x110 BC-CA char fraction along first edge (jvxlFractionToCharacter) char fraction along second edge (jvxlFractionToCharacter) 5- stream of pairs of points for rendering
      Returns:
        contour vector set

    - #### getPmeshData

          public java.lang.Object getPmeshData(boolean isBinary)

    - #### get3dContour

          private static void get3dContour(IsosurfaceMesh m,
                                           javajs.util.Lst<java.lang.Object> v,
                                           float value,
                                           short colix)

    - #### setContourVector

          public static void setContourVector(javajs.util.Lst<java.lang.Object> v,
                                              int nPolygons,
                                              javajs.util.BS bsContour,
                                              float value,
                                              short colix,
                                              int color,
                                              javajs.util.SB fData)

    - #### addContourPoints

          public static void addContourPoints(javajs.util.Lst<java.lang.Object> v,
                                              javajs.util.BS bsContour,
                                              int i,
                                              javajs.util.SB fData,
                                              javajs.util.T3[] vertices,
                                              float[] vertexValues,
                                              int iA,
                                              int iB,
                                              int iC,
                                              float value)

    - #### checkPt

          private static float checkPt(float[] vertexValues,
                                       int i,
                                       int j,
                                       float v)

      two values -- v1, and v2, which need not be ordered v1 < v2. v == v1 --> 0 v == v2 --> 1 v1 < v < v2 --> f in (0,1) v2 < v < v1 --> f in (0,1) i.e. (v1 < v) == (v < v2) We check AB, then (usually) BC, then (sometimes) CA. What if two end points are identical values? So, for example, if v = 1.0 and: A 1.0 0.5 1.0 1.0 / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ C-----B 1.0--0.5 1.0--1.0 0.5--1.0 1.0---1.0 case I case II case III case IV case I: AB[0] and BC[1], type == 3 --> CA not tested. case II: AB[1] and CA[0]; f1 == 1.0 --> BC not tested. case III: AB[0] and BC[0], type == 3 --> CA not tested. case IV: AB[0] and BC[0], type == 3 --> CA not tested. what if v = 0.5? case I: AB[1]; BC not tested --> type == 1, invalid. case II: AB[0]; type == 1, f1 == 0.0 --> CA not tested. case III: BC[1]; f2 == 1.0 --> CA not tested.
      Parameters:
        `vertexValues` -
        `i` -
        `j` -
        `v` -
      Returns:
        fraction along the edge or NaN

    - #### getContourPoint

          private static javajs.util.P3 getContourPoint(javajs.util.T3[] vertices,
                                                        int i,
                                                        int j,
                                                        float f)

    - #### setDiscreteColixes

          public void setDiscreteColixes(float[] values,
                                         short[] colixes)

    - #### getContourList

          java.util.Map<java.lang.String,java.lang.Object> getContourList(Viewer vwr)

      Parameters:
        `vwr` -
      Returns:
        a Hashtable containing "values" and "colors"

    - #### deleteContours

          void deleteContours()

    - #### setVertexColorMap

          void setVertexColorMap()

    - #### setVertexColixesForAtoms

          void setVertexColixesForAtoms(Viewer vwr,
                                        short[] colixes,
                                        int[] atomMap,
                                        javajs.util.BS bs)

    - #### colorVertices

          void colorVertices(short colix,
                             javajs.util.BS bs,
                             boolean isAtoms)

      color a specific set of vertices a specific color
      Parameters:
        `colix` -
        `bs` -
        `isAtoms` -

    - #### checkAllocColixes

          void checkAllocColixes()

    - #### addColorToMap

          private static void addColorToMap(java.util.Map<java.lang.String,javajs.util.BS> colorMap,
                                            java.lang.String color,
                                            javajs.util.BS bs)

      adds a set of specifically-colored vertices to the map, ensuring that no vertex is in two maps.
      Parameters:
        `colorMap` -
        `color` -
        `bs` -

    - #### setJvxlColorMap

          void setJvxlColorMap(boolean isAll)

      set up the jvxlData fields needed for either just the header (isAll = false) or the full file (isAll = true)
      Parameters:
        `isAll` -

    - #### setColorCommand

          void setColorCommand()

      just sets the color command for this isosurface.

    - #### setColorsFromJvxlData

          boolean setColorsFromJvxlData(int colorRgb)

      from Isosurface.notifySurfaceGenerationCompleted() starting with Jmol 12.1.50, JVXL files contain color, translucency, color scheme information, and vertex color mappings (as from COLOR ISOSURFACE {hydrophobic} WHITE), returning these settings when the JVXL file is opened.
      Parameters:
        `colorRgb` -
      Returns:
        true if still need color handling

    - #### setJvxlDataRendering

          void setJvxlDataRendering()

    - #### remapColors

          void remapColors(Viewer vwr,
                           ColorEncoder ce,
                           float translucentLevel)

      remaps colors based on a new color scheme or translucency level
      Parameters:
        `vwr` -
        `ce` -
        `translucentLevel` -

    - #### reinitializeLightingAndColor

          public void reinitializeLightingAndColor(Viewer vwr)

    - #### getBoundingBox

          public javajs.util.P3[] getBoundingBox()

      Overrides:
        `getBoundingBox` in class `Mesh`

    - #### setBoundingBox

          public void setBoundingBox(javajs.util.P3[] pts)

      Overrides:
        `setBoundingBox` in class `MeshSurface`

    - #### merge

          protected void merge(MeshData m)

    - #### mergePolygons

          private static int mergePolygons(MeshSurface m,
                                           int ipt,
                                           int vertexCount,
                                           int[][] newPolygons)

    - #### getUnitCell

          public SymmetryInterface getUnitCell()

      Overrides:
        `getUnitCell` in class `Mesh`
      Returns:
        unitcell

    - #### fixLattice

          void fixLattice()

    - #### getMinDistance2ForVertexGrouping

          protected float getMinDistance2ForVertexGrouping()

      Overrides:
        `getMinDistance2ForVertexGrouping` in class `Mesh`

    - #### getVisibleVertexBitSet

          public javajs.util.BS getVisibleVertexBitSet()

      Overrides:
        `getVisibleVertexBitSet` in class `Mesh`

    - #### updateCoordinates

          public void updateCoordinates(javajs.util.M4 m,
                                        javajs.util.BS bs)

      bs will be null if this is a set from the new isosurface MOVE [mat4] command
      Parameters:
        `m` -
        `bs` -

    - #### getDataMinMax

          float[] getDataMinMax()

    - #### getDataRange

          float[] getDataRange()