|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmaspack.geometry.MeshBase
maspack.geometry.PolylineMesh
public class PolylineMesh
Implements a mesh consisting of a set of polylines.
Field Summary | |
---|---|
static boolean |
useDisplayListsIfPossible
|
Fields inherited from class maspack.geometry.MeshBase |
---|
isFixed, myDisplayListValid, myUseDisplayList, useVertexColoring, XMeshToWorld |
Fields inherited from interface maspack.render.GLRenderable |
---|
TRANSLUCENT, TWO_DIMENSIONAL |
Constructor Summary | |
---|---|
PolylineMesh()
Creates an empty polyline mesh. |
|
PolylineMesh(java.io.File file)
Creates a polygonal mesh and initializes it from an file in Alias Wavefront obj format, as decribed for the method write(PrintWriter,NumberFormat,boolean) . |
|
PolylineMesh(PolylineMesh old)
|
Method Summary | |
---|---|
Polyline |
addLine(int[] indices)
Adds a line to this mesh. |
Polyline |
addLine(Polyline line)
Adds a line to this mesh. |
Polyline |
addLine(Vertex3d[] vertices)
Adds a line to this mesh. |
void |
addMesh(PolylineMesh mesh)
Adds copies of the vertices and lines of another mesh to this mesh. |
void |
clear()
Clears this mesh (makes it empty). |
void |
clearBoundingInfo()
Invalidates bounding box information. |
PolylineMesh |
copy()
Creates a copy of this mesh. |
PolylineMesh |
copyWithVertices(java.util.ArrayList<? extends Vertex3d> vtxs)
Creates a copy of this mesh using a specific set of vertices. |
RenderProps |
createRenderProps(HasProperties host)
Creates an appropriate RenderProps for this Mesh. |
void |
drawColoredCylinder(javax.media.opengl.GL2 gl,
int nslices,
double base,
double top,
float[] coords0,
float[] color0,
float[] coords1,
float[] color1,
boolean capped)
|
boolean |
epsilonEquals(MeshBase base,
double eps)
Tests to see if a mesh equals this one. |
AABBTree |
getBVTree()
|
java.util.ArrayList<Polyline> |
getLines()
Returns this mesh's lines. |
Vector3d |
getNormal(int idx)
Returns the idx-th normal in this mesh. |
int |
getNumLines()
Returns the number of lines in this mesh. |
int |
getNumNormals()
Returns the number of normals in this mesh. |
int |
getRenderSkip()
|
void |
invalidateBoundingInfo()
Invalidates bounding box information. |
void |
read(ReaderTokenizer rtok,
boolean zeroIndexed)
Reads the contents of this mesh from a ReaderTokenizer. |
boolean |
removeLine(Polyline line)
Removes a line from this mesh. |
void |
render(GLRenderer renderer,
RenderProps props,
int flags)
|
void |
set(Point3d[] pnts,
int[][] lineIndices)
Sets the vertex points and line associated with this mesh. |
void |
setRenderSkip(int skip)
Number of lines to skip while rendering |
void |
write(java.io.PrintWriter pw,
NumberFormat fmt,
boolean zeroIndexed)
Writes this mesh to a PrintWriter, using an Alias Wavefront "obj" file format. |
void |
write(java.io.PrintWriter pw,
java.lang.String fmtStr)
Writes this mesh to a PrintWriter, using an Alias Wavefront "obj" file as described for write(PrintWriter,NumberFormat,boolean) . |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static boolean useDisplayListsIfPossible
Constructor Detail |
---|
public PolylineMesh()
public PolylineMesh(java.io.File file) throws java.io.IOException
write(PrintWriter,NumberFormat,boolean)
.
file
- file containing the mesh description
java.io.IOException
public PolylineMesh(PolylineMesh old)
Method Detail |
---|
public void invalidateBoundingInfo()
MeshBase
public void clearBoundingInfo()
MeshBase
public RenderProps createRenderProps(HasProperties host)
createRenderProps
in class MeshBase
host
- if non-null, is used to initialize inherited values
public int getNumNormals()
getNumNormals
in class MeshBase
public Vector3d getNormal(int idx)
getNormal
in class MeshBase
idx
- index of the desired normal
public java.util.ArrayList<Polyline> getLines()
public int getNumLines()
public void read(ReaderTokenizer rtok, boolean zeroIndexed) throws java.io.IOException
write(PrintWriter,NumberFormat,boolean)
.
read
in class MeshBase
rtok
- tokenizer supplying the input description of the meshzeroIndexed
- if true, the index numbering for mesh vertices starts at 0. Otherwise,
numbering starts at 1.
java.io.IOException
public void set(Point3d[] pnts, int[][] lineIndices)
pnts
- points from which the vertices are formedlineIndices
- integer arrays giving the indices of each line. Each index should
correspond to a particular point in pnts.
java.lang.IllegalArgumentException
- if a vertex index is out of boundspublic Polyline addLine(int[] indices)
indices
- integer array giving the vertex indices of the line. Each index should
correspond to a vertex presently associated with this mesh.
java.lang.IllegalArgumentException
- if a vertex index is out of boundspublic Polyline addLine(Vertex3d[] vertices)
vertices
- vertices comprising this line. Each vertex should be presently contained
in this mesh.
java.lang.IllegalArgumentException
- if any vertices are not contained within this meshpublic Polyline addLine(Polyline line)
line
- Polyline to add to the mesh
public boolean removeLine(Polyline line)
line
- line to remove
public void write(java.io.PrintWriter pw, java.lang.String fmtStr) throws java.io.IOException
write(PrintWriter,NumberFormat,boolean)
. Index
numbering starts at one, and 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
. Good
default choices for fmtStr
are either "%g"
(full
precision), or "%.Ng"
, where N is the number of
desired significant figures.
write
in class MeshBase
pw
- PrintWriter to write this mesh tofmtStr
- string specifying format for writing the vertex coordinates
java.io.IOException
public void write(java.io.PrintWriter pw, NumberFormat fmt, boolean zeroIndexed) throws java.io.IOException
v 1.0 0.0 0.0 v 0.0 1.0 0.0 v 0.0 0.0 1.0 l 0 1 2
The format used to print vertex coordinates is specified by a
NumberFormat
.
write
in class MeshBase
pw
- PrintWriter to write this mesh tofmt
- format for writing the vertex coordinates. If null
,
a format of "%.8g"
is assumed.zeroIndexed
- if true, index numbering for mesh vertices starts at 0. Otherwise,
numbering starts at 1.
java.io.IOException
public void clear()
clear
in class MeshBase
public void render(GLRenderer renderer, RenderProps props, int flags)
render
in class MeshBase
public void drawColoredCylinder(javax.media.opengl.GL2 gl, int nslices, double base, double top, float[] coords0, float[] color0, float[] coords1, float[] color1, boolean capped)
public PolylineMesh copy()
copy
in class MeshBase
public PolylineMesh copyWithVertices(java.util.ArrayList<? extends Vertex3d> vtxs)
copyWithVertices
in class MeshBase
public void addMesh(PolylineMesh mesh)
mesh
- Mesh to be added to this meshpublic AABBTree getBVTree()
public void setRenderSkip(int skip)
public int getRenderSkip()
public boolean epsilonEquals(MeshBase base, double eps)
eps
).
epsilonEquals
in class MeshBase
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |