artisynth.core.util
Class MDLMeshIO

java.lang.Object
  extended by artisynth.core.util.MDLMeshIO

public class MDLMeshIO
extends java.lang.Object

A class to read an PolygonalMesh described from Yohan Payan MDL file format.


Nested Class Summary
static class MDLMeshIO.MDLHeader
           
 
Field Summary
static MDLMeshIO.MDLHeader defaultFacesHeader
           
static MDLMeshIO.MDLHeader defaultNormalsHeader
           
static MDLMeshIO.MDLHeader defaultTopHeader
           
static MDLMeshIO.MDLHeader defaultVerticesHeader
           
 
Constructor Summary
MDLMeshIO()
           
 
Method Summary
static PolygonalMesh read(java.io.Reader reader, Vector3d scale)
          Creates a PolygonalMesh based on MDL data read from a Reader.
static PolygonalMesh read(java.lang.String fileName, Vector3d scale)
          Creates a PolygonalMesh based on MDL data contained in a specified file.
static void write(PolygonalMesh mesh, java.lang.String filename, java.io.PrintWriter pw, NumberFormat fmt)
          Writes the specified mesh to a PrintWriter, using the MDL file format.
static void writePoints(Point3d[] pnts, java.lang.String filename, java.io.PrintWriter pw, NumberFormat fmt)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

defaultTopHeader

public static final MDLMeshIO.MDLHeader defaultTopHeader

defaultVerticesHeader

public static final MDLMeshIO.MDLHeader defaultVerticesHeader

defaultNormalsHeader

public static final MDLMeshIO.MDLHeader defaultNormalsHeader

defaultFacesHeader

public static final MDLMeshIO.MDLHeader defaultFacesHeader
Constructor Detail

MDLMeshIO

public MDLMeshIO()
Method Detail

read

public static PolygonalMesh read(java.lang.String fileName,
                                 Vector3d scale)
                          throws java.io.IOException
Creates a PolygonalMesh based on MDL data contained in a specified file. The node coordinate data can be scaled non-uniformly using an optional parameter giving scale values about the x, y, and z axes.

Parameters:
fileName - path name of the MDL file
scale - if non-null, gives scaling about the x, y, and z axes
Returns:
created polygonal mesh
Throws:
java.io.IOException - if this is a problem reading the file

read

public static PolygonalMesh read(java.io.Reader reader,
                                 Vector3d scale)
                          throws java.io.IOException
Creates a PolygonalMesh based on MDL data read from a Reader. The node coordinate data can be scaled non-uniformly using an optional parameter giving scale values about the x, y, and z axes.

Parameters:
reader - the Reader which references MDL data to be read
scale - if non-null, gives scaling about the x, y, and z axes
Returns:
created polygonal mesh
Throws:
java.io.IOException - if this is a problem reading the file

write

public static void write(PolygonalMesh mesh,
                         java.lang.String filename,
                         java.io.PrintWriter pw,
                         NumberFormat fmt)
Writes the specified mesh to a PrintWriter, using the MDL file format. Vertices are printed first by x, y, and z coordinates. Normals are printed next by x, y, and z coordinates. Faces are printed next by a list of integers which gives the indices of that face's vertices in counter-clockwise order followed by the indices of the vertex normals.

The format used to print vertex coordinates is specified by a C printf style format string contained in the parameter fmtStr. For a description of the format string syntax, see NumberFormat.

Parameters:
mesh - polygonal mesh to write to file
pw - PrintWriter to write this mesh to
fmt - format for writing the vertex coordinates

writePoints

public static void writePoints(Point3d[] pnts,
                               java.lang.String filename,
                               java.io.PrintWriter pw,
                               NumberFormat fmt)