artisynth.core.util
Class MDLMeshIO
java.lang.Object
artisynth.core.util.MDLMeshIO
public class MDLMeshIO
- extends java.lang.Object
A class to read an PolygonalMesh described from Yohan Payan MDL file format.
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 |
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
MDLMeshIO
public MDLMeshIO()
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 filescale
- 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 readscale
- 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 filepw
- PrintWriter to write this mesh tofmt
- format for writing the vertex coordinates
writePoints
public static void writePoints(Point3d[] pnts,
java.lang.String filename,
java.io.PrintWriter pw,
NumberFormat fmt)