maspack.geometry.io
Class WavefrontReader

java.lang.Object
  extended by maspack.geometry.io.MeshReaderBase
      extended by maspack.geometry.io.WavefrontReader
All Implemented Interfaces:
MeshReader
Direct Known Subclasses:
GeomagicObjReader

public class WavefrontReader
extends MeshReaderBase

Interprets a subset of the Alias-Wavefront OBJ file format. Groups are implemented, but only one group may be specified at a time and grouping applies only to faces, lines, curves, and surfaces.


Nested Class Summary
static class WavefrontReader.Curve
          A simple container class to hold all the info for a Wavefront curve specification.
static class WavefrontReader.Surface
          A simple container class to hold all the info for a Wavefront curve specification.
 
Field Summary
static int BEZIER
           
static int BMATRIX
           
static int BSPLINE
           
static int CARDINAL
           
static int TAYLOR
           
 
Constructor Summary
WavefrontReader(java.io.File file)
           
WavefrontReader(java.io.Reader reader)
           
WavefrontReader(ReaderTokenizer rtok)
           
WavefrontReader(java.lang.String fileName)
           
 
Method Summary
 void clear()
           
 boolean equals(java.lang.Object obj)
          For testing ...
 java.util.ArrayList<WavefrontReader.Curve> getCurveList()
           
 int[][] getFaceIndices()
           
 java.util.ArrayList<maspack.geometry.io.WavefrontReader.Face> getFaceList()
           
 java.lang.String[] getGroupNames()
           
 RenderProps getGroupRenderProps(java.lang.String groupName)
           
 Vector4d[] getHomogeneousPoints()
           
 int[][] getLineIndices()
           
 java.util.ArrayList<maspack.geometry.io.WavefrontReader.Line> getLineList()
           
 int[][] getLocalFaceIndicesAndVertices(java.util.ArrayList<Point3d> vtxList)
           
 int[][] getLocalLineIndicesAndVertices(java.util.ArrayList<Point3d> vtxList)
           
 int[][] getLocalNormalIndicesAndVertices(java.util.ArrayList<Vector3d> nrmList)
           
 int[][] getLocalTextureIndicesAndVertices(java.util.ArrayList<Vector3d> vtxList)
           
 RenderProps getMaterial(java.lang.String matName)
           
 java.lang.String[] getMaterialNames()
           
 java.util.ArrayList<Vector3d> getNormalList()
           
 java.lang.String[] getPolyhedralGroupNames()
           
 java.lang.String[] getPolylineGroupNames()
           
 RenderProps getRenderProps()
           
 java.util.ArrayList<WavefrontReader.Surface> getSurfaceList()
           
 int[][] getTextureIndices()
           
 java.util.ArrayList<Vector3d> getTextureVertexList()
           
 java.util.ArrayList<Vector4d> getVertexList()
           
 int[][] getVertexNormalIndices()
           
 Vector3d[] getVertexNormals()
           
 Point3d[] getVertexPoints()
           
 boolean getZeroIndexed()
           
 boolean hasGroup(java.lang.String name)
           
 boolean isVerbose()
           
 void parse()
           
static MeshBase read(java.io.File file)
           
static MeshBase read(java.lang.String fileName)
           
 MeshBase readMesh(MeshBase mesh)
           
 void setGroup(java.lang.String name)
           
 void setMesh(PointMesh mesh)
           
 void setMesh(PointMesh mesh, java.lang.String groupName)
           
 void setMesh(PolygonalMesh mesh)
           
 void setMesh(PolygonalMesh mesh, java.lang.String groupName)
           
 void setMesh(PolylineMesh mesh)
           
 void setMesh(PolylineMesh mesh, java.lang.String groupName)
           
 void setParentPath(java.lang.String pathname)
           
 void setVerbose(boolean verb)
           
 void setZeroIndexed(boolean enable)
           
 java.lang.String toString()
          For testing ...
 
Methods inherited from class maspack.geometry.io.MeshReaderBase
close, readMesh
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

BEZIER

public static final int BEZIER
See Also:
Constant Field Values

BMATRIX

public static final int BMATRIX
See Also:
Constant Field Values

BSPLINE

public static final int BSPLINE
See Also:
Constant Field Values

CARDINAL

public static final int CARDINAL
See Also:
Constant Field Values

TAYLOR

public static final int TAYLOR
See Also:
Constant Field Values
Constructor Detail

WavefrontReader

public WavefrontReader(ReaderTokenizer rtok)

WavefrontReader

public WavefrontReader(java.io.Reader reader)

WavefrontReader

public WavefrontReader(java.io.File file)
                throws java.io.IOException
Throws:
java.io.IOException

WavefrontReader

public WavefrontReader(java.lang.String fileName)
                throws java.io.IOException
Throws:
java.io.IOException
Method Detail

getZeroIndexed

public boolean getZeroIndexed()

setZeroIndexed

public void setZeroIndexed(boolean enable)

hasGroup

public boolean hasGroup(java.lang.String name)

setGroup

public void setGroup(java.lang.String name)

getPolyhedralGroupNames

public java.lang.String[] getPolyhedralGroupNames()

getPolylineGroupNames

public java.lang.String[] getPolylineGroupNames()

getGroupNames

public java.lang.String[] getGroupNames()

setParentPath

public void setParentPath(java.lang.String pathname)

clear

public void clear()

getMaterial

public RenderProps getMaterial(java.lang.String matName)

getMaterialNames

public java.lang.String[] getMaterialNames()

parse

public void parse()
           throws java.io.IOException
Throws:
java.io.IOException

equals

public boolean equals(java.lang.Object obj)
For testing ...

Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
For testing ...

Overrides:
toString in class java.lang.Object

getRenderProps

public RenderProps getRenderProps()

getGroupRenderProps

public RenderProps getGroupRenderProps(java.lang.String groupName)

getLocalFaceIndicesAndVertices

public int[][] getLocalFaceIndicesAndVertices(java.util.ArrayList<Point3d> vtxList)
                                       throws java.io.IOException
Throws:
java.io.IOException

getLocalLineIndicesAndVertices

public int[][] getLocalLineIndicesAndVertices(java.util.ArrayList<Point3d> vtxList)
                                       throws java.io.IOException
Throws:
java.io.IOException

getLocalNormalIndicesAndVertices

public int[][] getLocalNormalIndicesAndVertices(java.util.ArrayList<Vector3d> nrmList)
                                         throws java.io.IOException
Throws:
java.io.IOException

getLocalTextureIndicesAndVertices

public int[][] getLocalTextureIndicesAndVertices(java.util.ArrayList<Vector3d> vtxList)
                                          throws java.io.IOException
Throws:
java.io.IOException

getVertexPoints

public Point3d[] getVertexPoints()

getVertexNormals

public Vector3d[] getVertexNormals()

getHomogeneousPoints

public Vector4d[] getHomogeneousPoints()

getFaceIndices

public int[][] getFaceIndices()

getLineIndices

public int[][] getLineIndices()

getTextureIndices

public int[][] getTextureIndices()

getVertexNormalIndices

public int[][] getVertexNormalIndices()

getVertexList

public java.util.ArrayList<Vector4d> getVertexList()

getTextureVertexList

public java.util.ArrayList<Vector3d> getTextureVertexList()

getNormalList

public java.util.ArrayList<Vector3d> getNormalList()

getFaceList

public java.util.ArrayList<maspack.geometry.io.WavefrontReader.Face> getFaceList()

getLineList

public java.util.ArrayList<maspack.geometry.io.WavefrontReader.Line> getLineList()

getCurveList

public java.util.ArrayList<WavefrontReader.Curve> getCurveList()

getSurfaceList

public java.util.ArrayList<WavefrontReader.Surface> getSurfaceList()

isVerbose

public boolean isVerbose()

setVerbose

public void setVerbose(boolean verb)

setMesh

public void setMesh(PolygonalMesh mesh)
             throws java.io.IOException
Throws:
java.io.IOException

setMesh

public void setMesh(PolygonalMesh mesh,
                    java.lang.String groupName)
             throws java.io.IOException
Throws:
java.io.IOException

readMesh

public MeshBase readMesh(MeshBase mesh)
                  throws java.io.IOException
Throws:
java.io.IOException

setMesh

public void setMesh(PointMesh mesh)
             throws java.io.IOException
Throws:
java.io.IOException

setMesh

public void setMesh(PointMesh mesh,
                    java.lang.String groupName)
             throws java.io.IOException
Throws:
java.io.IOException

setMesh

public void setMesh(PolylineMesh mesh)
             throws java.io.IOException
Throws:
java.io.IOException

setMesh

public void setMesh(PolylineMesh mesh,
                    java.lang.String groupName)
             throws java.io.IOException
Throws:
java.io.IOException

read

public static MeshBase read(java.io.File file)
                     throws java.io.IOException
Throws:
java.io.IOException

read

public static MeshBase read(java.lang.String fileName)
                     throws java.io.IOException
Throws:
java.io.IOException