# Class JvxlCoder

java.lang.Object
org.jmol.jvxl.data.JvxlCoder

public class JvxlCoder extends Object

## Field Summary

Fields
Modifier and Type
Field
Description
`static final int`
`CONTOUR_BITSET`
`static final int`
`CONTOUR_COLIX`
`static final int`
`CONTOUR_COLOR`
`static final int`
`CONTOUR_FDATA`
`static final int`
`CONTOUR_NPOLYGONS`
`static final int`
`CONTOUR_POINTS`
`static final int`
`CONTOUR_VALUE`
`static final int`
`defaultColorFractionBase`
`static final int`
`defaultColorFractionRange`
`static final int`
`defaultEdgeFractionBase`
/////// character - fraction encoding and decoding
`static final int`
`defaultEdgeFractionRange`
`static final String`
`JVXL_VERSION_XML`
`static final String`
`JVXL_VERSION1`

## Constructor Summary

Constructors
Constructor
Description
`JvxlCoder()`

## Method Summary

Modifier and Type
Method
Description
`static void`
`appendContourTriangleIntersection(int type, float f1, float f2, SB fData)`
appends an integer (3, 5, or 6) representing two sides of a triangle ABC -- AB/BC(3), AB/CA(5), or BC/CA(6) -- along with two fractions along the edges for the intersection point base-90-encoded.
`static void`
`jvxlAppendEncodedNumber(SB sb, int n, int base, int range)`
`static String`
`jvxlCompressString(String data, boolean escapeXml)`
//// string data compression/decompression
`static void`
`jvxlCreateColorData(JvxlData jvxlData, float[] vertexValues)`
`static void`
`jvxlCreateHeader(VolumeData v, SB sb)`
Creates a two-line header for the XJVXL file.
`static void`
`jvxlCreateHeaderWithoutTitleOrAtoms(VolumeData v, SB bs)`
`static BS`
`jvxlDecodeBitSet(String data)`
`static BS`
`jvxlDecodeBitSetRange(String data, int base, int range)`
`static String`
`jvxlDecompressString(String data)`
`static String`
`jvxlEncodeBitSet(BS bs)`
`static int`
`jvxlEncodeBitSet0(BS bs, int nPoints, SB sb)`
`static int`
`jvxlEncodeBitSetBuffer(BS bs, int nPoints, SB sb)`
`static String`
`jvxlEncodeColorData(float[] vertexValues, float min, float max, int colorFractionBase, int colorFractionRange, boolean doTruncate, boolean isPrecisionColor)`
`static char`
`jvxlFractionAsCharacter(float fraction)`
`static char`
`jvxlFractionAsCharacterRange(float fraction, int base, int range)`
`static float`
`jvxlFractionFromCharacter(int ich, int base, int range, float fracOffset)`
`static float`
`jvxlFractionFromCharacter2(int ich1, int ich2, int base, int range)`
`static String`
`jvxlGetFile(JvxlData jvxlData, MeshData meshData, String[] title, String msg, boolean includeHeader, int nSurfaces, String state, String comment)`
`static String`
`jvxlGetFile(VolumeData volumeData, JvxlData jvxlData, String[] title)`
`static String`
`jvxlGetInfo(JvxlData jvxlData)`
`static String`
`jvxlGetInfoData(JvxlData jvxlData, boolean vertexDataOnly)`
`static int`
`jvxlParseEncodedInt(String str, int offset, int base, int[] next)`
`static char`
`jvxlValueAsCharacter(float value, float min, float max, int base, int range)`
`protected static float`
`jvxlValueFromCharacter2(int ich, int ich2, float min, float max, int base, int range)`
`static void`
`set3dContourVector(Lst<Object> v, int[][] polygonIndexes, T3[] vertices)`
Interpret fractional data in terms of actual vertex positions and create the elements of a Vector in Vector[] vContours starting at the CONTOUR_POINTS position.

### Methods inherited from class Object

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

## Field Details

### JVXL_VERSION1

public static final String JVXL_VERSION1

See Also:
  - Constant Field Values

### JVXL_VERSION_XML

public static final String JVXL_VERSION_XML

See Also:
  - Constant Field Values

### CONTOUR_NPOLYGONS

public static final int CONTOUR_NPOLYGONS

See Also:
  - Constant Field Values

### CONTOUR_BITSET

public static final int CONTOUR_BITSET

See Also:
  - Constant Field Values

### CONTOUR_VALUE

public static final int CONTOUR_VALUE

See Also:
  - Constant Field Values

### CONTOUR_COLIX

public static final int CONTOUR_COLIX

See Also:
  - Constant Field Values

### CONTOUR_COLOR

public static final int CONTOUR_COLOR

See Also:
  - Constant Field Values

### CONTOUR_FDATA

public static final int CONTOUR_FDATA

See Also:
  - Constant Field Values

### CONTOUR_POINTS

public static final int CONTOUR_POINTS

See Also:
  - Constant Field Values

### defaultEdgeFractionBase

public static final int defaultEdgeFractionBase
/////// character - fraction encoding and decoding

See Also:
  - Constant Field Values

### defaultEdgeFractionRange

public static final int defaultEdgeFractionRange

See Also:
  - Constant Field Values

### defaultColorFractionBase

public static final int defaultColorFractionBase

See Also:
  - Constant Field Values

### defaultColorFractionRange

public static final int defaultColorFractionRange

See Also:
  - Constant Field Values

## Constructor Details

### JvxlCoder

public JvxlCoder()

## Method Details

### jvxlGetFile

public static String jvxlGetFile(VolumeData volumeData, JvxlData jvxlData, String[] title)

Parameters:
  `volumeData` -
  `jvxlData` -
  `title` -
Returns:
  XML string

### jvxlGetFile

public static String jvxlGetFile(JvxlData jvxlData, MeshData meshData, String[] title, String msg, boolean includeHeader, int nSurfaces, String state, String comment)

Parameters:
  `jvxlData` -
  `meshData` -
  `title` -
  `msg` -
  `includeHeader` -
  `nSurfaces` -
  `state` -
  `comment` -
Returns:
  JVXL file XML

### jvxlGetInfo

public static String jvxlGetInfo(JvxlData jvxlData)

### jvxlGetInfoData

public static String jvxlGetInfoData(JvxlData jvxlData, boolean vertexDataOnly)

### set3dContourVector

public static void set3dContourVector(Lst<Object> v, int[][] polygonIndexes, T3[] vertices)
Interpret fractional data in terms of actual vertex positions and create the elements of a Vector in Vector[] vContours starting at the CONTOUR_POINTS position.

Parameters:
  `v` -
  `polygonIndexes` -
  `vertices` -

### appendContourTriangleIntersection

public static void appendContourTriangleIntersection(int type, float f1, float f2, SB fData)
appends an integer (3, 5, or 6) representing two sides of a triangle ABC -- AB/BC(3), AB/CA(5), or BC/CA(6) -- along with two fractions along the edges for the intersection point base-90-encoded. This version is single precision. type f1 f2 3 AB BC 5 AB CA 6 BC CA

Parameters:
  `type` -
  `f1` - -- character-encoded fraction
  `f2` - -- character-encoded fraction
  `fData` -

### jvxlCreateColorData

public static void jvxlCreateColorData(JvxlData jvxlData, float[] vertexValues)

Parameters:
  `jvxlData` -
  `vertexValues` -

### jvxlEncodeColorData

public static String jvxlEncodeColorData(float[] vertexValues, float min, float max, int colorFractionBase, int colorFractionRange, boolean doTruncate, boolean isPrecisionColor)

Parameters:
  `vertexValues` -
  `min` -
  `max` -
  `colorFractionBase` -
  `colorFractionRange` -
  `doTruncate` -
  `isPrecisionColor` - create a value with 1/8100 precision (otherwise just 1/90)
Returns:
  String encoding of the values

### jvxlFractionAsCharacter

public static char jvxlFractionAsCharacter(float fraction)

### jvxlFractionAsCharacterRange

public static char jvxlFractionAsCharacterRange(float fraction, int base, int range)

### jvxlFractionFromCharacter

public static float jvxlFractionFromCharacter(int ich, int base, int range, float fracOffset)

### jvxlFractionFromCharacter2

public static float jvxlFractionFromCharacter2(int ich1, int ich2, int base, int range)

### jvxlValueAsCharacter

public static char jvxlValueAsCharacter(float value, float min, float max, int base, int range)

### jvxlValueFromCharacter2

protected static float jvxlValueFromCharacter2(int ich, int ich2, float min, float max, int base, int range)

### jvxlEncodeBitSet0

public static int jvxlEncodeBitSet0(BS bs, int nPoints, SB sb)

### jvxlEncodeBitSet

public static String jvxlEncodeBitSet(BS bs)

### jvxlEncodeBitSetBuffer

public static int jvxlEncodeBitSetBuffer(BS bs, int nPoints, SB sb)

### jvxlAppendEncodedNumber

public static void jvxlAppendEncodedNumber(SB sb, int n, int base, int range)

### jvxlDecodeBitSetRange

public static BS jvxlDecodeBitSetRange(String data, int base, int range)

### jvxlParseEncodedInt

public static int jvxlParseEncodedInt(String str, int offset, int base, int[] next)

### jvxlDecodeBitSet

public static BS jvxlDecodeBitSet(String data)

### jvxlCompressString

public static String jvxlCompressString(String data, boolean escapeXml)
//// string data compression/decompression

### jvxlDecompressString

public static String jvxlDecompressString(String data)

### jvxlCreateHeaderWithoutTitleOrAtoms

public static void jvxlCreateHeaderWithoutTitleOrAtoms(VolumeData v, SB bs)

### jvxlCreateHeader

public static void jvxlCreateHeader(VolumeData v, SB sb)
Creates a two-line header for the XJVXL file. It is no longer necessary to create the atom set or generate the vectors here. Please leave the commented code for posterity.

Parameters:
  `v` -
  `sb` -