_VrmlExporter
Date: 2019-10-22

org.jmol.export

## Class _VrmlExporter

- java.lang.Object
- - org.jmol.export.___Exporter
  - - org.jmol.export.__CartesianExporter
    - - org.jmol.export._VrmlExporter

- Direct Known Subclasses:
    _StlExporter, _X3dExporter

      public class _VrmlExporter
      extends __CartesianExporter

  A basic VRML generator. Modified 10/2016 to no longer use high-level objects Cone, Sphere, and Cylinder. Makes substantial use of DEF and USE to reduce file size hugely.
  Author:
    Bob Hanson

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected java.lang.String` | `fontChild`
    `protected java.lang.String` | `fontFace`
    `protected float` | `fontSize`
    `protected java.lang.String` | `fontStyle`
    `private java.util.Map<java.lang.String,java.lang.Boolean>` | `htSpheresRendered`
    `private int[][]` | `oneFace`
    `private short[]` | `plateColixes`
    `private int[][]` | `plateIndices`
    `private javajs.util.T3[]` | `plateVertices`
    `protected javajs.util.P3` | `tempQ1`
    `protected javajs.util.P3` | `tempQ2`
    `protected javajs.util.P3` | `tempQ3`
    `private javajs.util.P3[]` | `threeVertices`
    `protected UseTable` | `useTable`

    - ### Fields inherited from class org.jmol.export.__CartesianExporter

      `canCapCylinders, noColor, sphereMatrix, viewpoint`

    - ### Fields inherited from class org.jmol.export.___Exporter

      `apertureAngle, backgroundColix, cameraDistance, cameraPosition, center, commandLineOptions, commentChar, degreesPerRadian, depthZ, export3D, exportScale, exportType, fileName, fixedRotationCenter, gdata, lightSource, lineWidthMad, out, privateKey, referenceCenter, scalePixelsPerAngstrom, screenHeight, screenWidth, slabZ, solidOnly, tempP1, tempP2, tempP3, tempV1, tempV2, tm, vwr`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `_VrmlExporter()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected java.lang.String` | `getDef(java.lang.String key)`
    `protected float` | `getViewpoint()`
    `protected void` | `output(javajs.util.T3 pt)`
    `protected void` | `outputAppearance(short colix, boolean isText)`
    `protected void` | `outputAttr(java.lang.String attr, float x, float y, float z)`
    `protected void` | `outputAttrPt(java.lang.String attr, javajs.util.T3 pt)`
    `protected void` | `outputChildClose()`
    `protected void` | `outputChildShapeClose()`
    `protected void` | `outputChildShapeStart()`
    `protected void` | `outputChildStart()`
    `protected void` | `outputCircle(javajs.util.P3 pt1, javajs.util.P3 pt2, float radius, short colix, boolean doFill)`
    `protected void` | `outputCloseTag()`
    `protected void` | `outputColorIndices(int[][] indices, int nPolygons, javajs.util.BS bsPolygons, int faceVertexMax, java.util.Map<java.lang.Short,java.lang.Integer> htColixes, short[] colixes, short[] polygonColixes)`
    `protected void` | `outputColors(javajs.util.Lst<java.lang.Short> colorList)`
    `protected void` | `outputCone(javajs.util.P3 ptBase, javajs.util.P3 ptTip, float radius, short colix)`
    `private void` | `outputConeGeometry(boolean addBase)`
    `protected boolean` | `outputCylinder(javajs.util.P3 ptCenter, javajs.util.P3 pt1, javajs.util.P3 pt2, short colix, byte endcaps, float radius, javajs.util.P3 ptX, javajs.util.P3 ptY, boolean checkRadius)`
    `protected void` | `outputCylinderChildScaled(short colix, byte endcaps)`
    `private void` | `outputCylinderGeometry(int endcaps)`
    `protected void` | `outputDefChildFaceSet(java.lang.String child)`
    `protected void` | `outputEllipsoid(javajs.util.P3 ptCenter, javajs.util.P3[] points, short colix)`
    `protected void` | `outputFace(int[] face, int[] map, int faceVertexMax)`
    `protected void` | `outputFaceSetClose()`
    `protected void` | `outputFaceSetStart()`
    `protected void` | `outputFooter()`
    `protected void` | `outputGeometry(javajs.util.T3[] vertices, javajs.util.T3[] normals, short[] colixes, int[][] indices, short[] polygonColixes, int nVertices, int nPolygons, javajs.util.BS bsPolygons, int faceVertexMax, javajs.util.Lst<java.lang.Short> colorList, java.util.Map<java.lang.Short,java.lang.Integer> htColixes, javajs.util.P3 offset)`
    `protected void` | `outputHeader()`
    `protected void` | `outputInitialTransform()`
    `protected void` | `outputNormals(javajs.util.Lst<java.lang.String> vNormals)`
    `protected void` | `outputQuaternionFrame(javajs.util.P3 ptCenter, javajs.util.P3 ptX, javajs.util.P3 ptY, javajs.util.P3 ptZ, float xScale, float yScale, float zScale)`
    `protected void` | `outputRotation(javajs.util.A4 a)`
    `protected void` | `outputShapeClose()`
    `protected void` | `outputShapeStart()`
    `protected void` | `outputSolidPlate(javajs.util.P3 tempP1, javajs.util.P3 tempP2, javajs.util.P3 tempP3, short colix)`
    `protected void` | `outputSphere(javajs.util.P3 ptCenter, float radius, short colix, boolean checkRadius)`
    `private void` | `outputSphereChildScaled(javajs.util.P3 ptCenter, float radius, javajs.util.P3[] points, short colix)`
    `private void` | `outputSphereGeometry()`
    `protected void` | `outputSurface(javajs.util.T3[] vertices, javajs.util.T3[] normals, short[] colixes, int[][] indices, short[] polygonColixes, int nVertices, int nPolygons, int nTriangles, javajs.util.BS bsPolygons, int faceVertexMax, short colix, javajs.util.Lst<java.lang.Short> colorList, java.util.Map<java.lang.Short,java.lang.Integer> htColixes, javajs.util.P3 offset)`
    `protected void` | `outputTextPixel(javajs.util.P3 pt, int argb)`
    `protected void` | `outputTransRot(javajs.util.P3 pt1, javajs.util.P3 pt2, int x, int y, int z)`
    `protected void` | `outputTriangle(javajs.util.T3 pt1, javajs.util.T3 pt2, javajs.util.T3 pt3, short colix)`
    `private void` | `outputTriangleGeometry(javajs.util.T3 pt1, javajs.util.T3 pt2, javajs.util.T3 pt3, short colix)`
    `protected void` | `outputUseChildClose(java.lang.String child)`
    `(package private) void` | `plotText(int x, int y, int z, short colix, java.lang.String text, Font font3d)`
    `protected void` | `popMatrix()`
    `protected void` | `pushMatrix()`
    `private void` | `setFont(short colix, java.lang.String text, Font font3d)`

    - ### Methods inherited from class org.jmol.export.__CartesianExporter

      `drawAtom, drawCircle, drawCylinder, drawEllipse, drawPixel, drawTextPixel, fillConeScreen, fillCylinderScreen, fillCylinderScreenMad, fillEllipsoid, fillSphere, fillTriangle, getCameraPosition, getCoordinateMap, getModelCenter, getNormalMap, outputIndices, plotImage, setSphereMatrix`

    - ### Methods inherited from class org.jmol.export.___Exporter

      `drawFilledCircle, drawSurface, finalizeOutput, finalizeOutput2, fixScreenZ, getByteCount, getColorList, getConeMesh, getExportDate, getJmolPerspective, getRotationMatrix, getRotationMatrix, getTriad, getTriadC, initializeOutput, initOutput, opacityFractionalFromArgb, opacityFractionalFromColix, output, outputComment, outputJmolPerspective, outputVertex, outputVertices, rgbFractionalFromArgb, rgbFractionalFromColix, round, round, setTempVertex, translucencyFractionalFromColix`

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

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

- - ### Field Detail

    - #### useTable

          protected UseTable useTable

    - #### htSpheresRendered

          private java.util.Map<java.lang.String,java.lang.Boolean> htSpheresRendered

    - #### plateVertices

          private javajs.util.T3[] plateVertices

    - #### plateIndices

          private int[][] plateIndices

    - #### plateColixes

          private short[] plateColixes

    - #### tempQ1

          protected javajs.util.P3 tempQ1

    - #### tempQ2

          protected javajs.util.P3 tempQ2

    - #### tempQ3

          protected javajs.util.P3 tempQ3

    - #### oneFace

          private int[][] oneFace

    - #### threeVertices

          private javajs.util.P3[] threeVertices

    - #### fontSize

          protected float fontSize

    - #### fontFace

          protected java.lang.String fontFace

    - #### fontStyle

          protected java.lang.String fontStyle

    - #### fontChild

          protected java.lang.String fontChild

  - ### Constructor Detail

    - #### _VrmlExporter

          public _VrmlExporter()

  - ### Method Detail

    - #### output

          protected void output(javajs.util.T3 pt)

      Specified by:
        `output` in class `___Exporter`

    - #### outputHeader

          protected void outputHeader()

      Specified by:
        `outputHeader` in class `___Exporter`

    - #### outputInitialTransform

          protected void outputInitialTransform()

    - #### getViewpoint

          protected float getViewpoint()

    - #### outputFooter

          protected void outputFooter()

      Overrides:
        `outputFooter` in class `___Exporter`

    - #### outputAppearance

          protected void outputAppearance(short colix,
                                          boolean isText)

    - #### pushMatrix

          protected void pushMatrix()

    - #### popMatrix

          protected void popMatrix()

    - #### outputAttrPt

          protected void outputAttrPt(java.lang.String attr,
                                      javajs.util.T3 pt)

    - #### outputAttr

          protected void outputAttr(java.lang.String attr,
                                    float x,
                                    float y,
                                    float z)

    - #### outputRotation

          protected void outputRotation(javajs.util.A4 a)

    - #### outputTransRot

          protected void outputTransRot(javajs.util.P3 pt1,
                                        javajs.util.P3 pt2,
                                        int x,
                                        int y,
                                        int z)

    - #### outputQuaternionFrame

          protected void outputQuaternionFrame(javajs.util.P3 ptCenter,
                                               javajs.util.P3 ptX,
                                               javajs.util.P3 ptY,
                                               javajs.util.P3 ptZ,
                                               float xScale,
                                               float yScale,
                                               float zScale)

    - #### outputChildShapeStart

          protected void outputChildShapeStart()

    - #### outputChildStart

          protected void outputChildStart()

    - #### outputShapeStart

          protected void outputShapeStart()

    - #### outputDefChildFaceSet

          protected void outputDefChildFaceSet(java.lang.String child)

    - #### outputFaceSetStart

          protected void outputFaceSetStart()

    - #### outputFaceSetClose

          protected void outputFaceSetClose()

    - #### outputUseChildClose

          protected void outputUseChildClose(java.lang.String child)

    - #### outputChildShapeClose

          protected void outputChildShapeClose()

    - #### outputChildClose

          protected void outputChildClose()

    - #### outputShapeClose

          protected void outputShapeClose()

    - #### outputCloseTag

          protected void outputCloseTag()

    - #### outputCircle

          protected void outputCircle(javajs.util.P3 pt1,
                                      javajs.util.P3 pt2,
                                      float radius,
                                      short colix,
                                      boolean doFill)

      Specified by:
        `outputCircle` in class `__CartesianExporter`

    - #### outputCone

          protected void outputCone(javajs.util.P3 ptBase,
                                    javajs.util.P3 ptTip,
                                    float radius,
                                    short colix)

      Specified by:
        `outputCone` in class `__CartesianExporter`

    - #### outputConeGeometry

          private void outputConeGeometry(boolean addBase)

    - #### outputCylinder

          protected boolean outputCylinder(javajs.util.P3 ptCenter,
                                           javajs.util.P3 pt1,
                                           javajs.util.P3 pt2,
                                           short colix,
                                           byte endcaps,
                                           float radius,
                                           javajs.util.P3 ptX,
                                           javajs.util.P3 ptY,
                                           boolean checkRadius)

      Specified by:
        `outputCylinder` in class `__CartesianExporter`

    - #### outputCylinderChildScaled

          protected void outputCylinderChildScaled(short colix,
                                                   byte endcaps)

    - #### outputCylinderGeometry

          private void outputCylinderGeometry(int endcaps)

    - #### outputSphere

          protected void outputSphere(javajs.util.P3 ptCenter,
                                      float radius,
                                      short colix,
                                      boolean checkRadius)

      Specified by:
        `outputSphere` in class `__CartesianExporter`

    - #### outputEllipsoid

          protected void outputEllipsoid(javajs.util.P3 ptCenter,
                                         javajs.util.P3[] points,
                                         short colix)

      Specified by:
        `outputEllipsoid` in class `__CartesianExporter`

    - #### outputSphereChildScaled

          private void outputSphereChildScaled(javajs.util.P3 ptCenter,
                                               float radius,
                                               javajs.util.P3[] points,
                                               short colix)

    - #### outputSphereGeometry

          private void outputSphereGeometry()

    - #### outputSolidPlate

          protected void outputSolidPlate(javajs.util.P3 tempP1,
                                          javajs.util.P3 tempP2,
                                          javajs.util.P3 tempP3,
                                          short colix)

      Overrides:
        `outputSolidPlate` in class `__CartesianExporter`

    - #### outputSurface

          protected void outputSurface(javajs.util.T3[] vertices,
                                       javajs.util.T3[] normals,
                                       short[] colixes,
                                       int[][] indices,
                                       short[] polygonColixes,
                                       int nVertices,
                                       int nPolygons,
                                       int nTriangles,
                                       javajs.util.BS bsPolygons,
                                       int faceVertexMax,
                                       short colix,
                                       javajs.util.Lst<java.lang.Short> colorList,
                                       java.util.Map<java.lang.Short,java.lang.Integer> htColixes,
                                       javajs.util.P3 offset)

      Overrides:
        `outputSurface` in class `___Exporter`
      Parameters:
        `vertices` - generally unique vertices [0:nVertices)
        `normals` - one per vertex
        `colixes` - one per vertex, or null
        `indices` - one per triangular or quad polygon; may have additional elements beyond vertex indices if faceVertexMax = 3 triangular if faceVertexMax == 3; 3 or 4 if face VertexMax = 4
        `polygonColixes` - face-based colixes
        `nVertices` - vertices[nVertices-1] is last vertex
        `nPolygons` - indices[nPolygons - 1] is last polygon
        `nTriangles` - number of triangular faces required
        `bsPolygons` - number of polygons (triangles or quads)
        `faceVertexMax` - (3) triangles only, indices[][i] may have more elements (4) triangles and quads; indices[][i].length determines
        `colix` - overall (solid) color index
        `colorList` - list of unique color IDs
        `htColixes` - map of color IDs to colorList

    - #### outputGeometry

          protected void outputGeometry(javajs.util.T3[] vertices,
                                        javajs.util.T3[] normals,
                                        short[] colixes,
                                        int[][] indices,
                                        short[] polygonColixes,
                                        int nVertices,
                                        int nPolygons,
                                        javajs.util.BS bsPolygons,
                                        int faceVertexMax,
                                        javajs.util.Lst<java.lang.Short> colorList,
                                        java.util.Map<java.lang.Short,java.lang.Integer> htColixes,
                                        javajs.util.P3 offset)

    - #### outputFace

          protected void outputFace(int[] face,
                                    int[] map,
                                    int faceVertexMax)

      Specified by:
        `outputFace` in class `__CartesianExporter`

    - #### outputNormals

          protected void outputNormals(javajs.util.Lst<java.lang.String> vNormals)

    - #### outputColors

          protected void outputColors(javajs.util.Lst<java.lang.Short> colorList)

    - #### outputColorIndices

          protected void outputColorIndices(int[][] indices,
                                            int nPolygons,
                                            javajs.util.BS bsPolygons,
                                            int faceVertexMax,
                                            java.util.Map<java.lang.Short,java.lang.Integer> htColixes,
                                            short[] colixes,
                                            short[] polygonColixes)

    - #### outputTriangle

          protected void outputTriangle(javajs.util.T3 pt1,
                                        javajs.util.T3 pt2,
                                        javajs.util.T3 pt3,
                                        short colix)

      Specified by:
        `outputTriangle` in class `__CartesianExporter`

    - #### outputTriangleGeometry

          private void outputTriangleGeometry(javajs.util.T3 pt1,
                                              javajs.util.T3 pt2,
                                              javajs.util.T3 pt3,
                                              short colix)

    - #### outputTextPixel

          protected void outputTextPixel(javajs.util.P3 pt,
                                         int argb)

      Specified by:
        `outputTextPixel` in class `__CartesianExporter`

    - #### plotText

          void plotText(int x,
                        int y,
                        int z,
                        short colix,
                        java.lang.String text,
                        Font font3d)

      Overrides:
        `plotText` in class `__CartesianExporter`

    - #### setFont

          private void setFont(short colix,
                               java.lang.String text,
                               Font font3d)

    - #### getDef

          protected java.lang.String getDef(java.lang.String key)