|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmaspack.geometry.MeshBase
maspack.geometry.PointMesh
public class PointMesh
Implements a mesh consisting of a set of points and possibly normals.
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 | |
---|---|
PointMesh()
Creates an empty point mesh. |
|
PointMesh(java.io.File file)
Creates a point mesh and initializes it from an file in Alias Wavefront obj format, as decribed for the method write(PrintWriter,NumberFormat,boolean) . |
|
PointMesh(PointMesh old)
|
Method Summary | |
---|---|
void |
addMesh(PointMesh mesh)
Adds copies of the vertices of another mesh to this mesh. |
void |
clear()
Clears this mesh (makes it empty). |
void |
clearNormals()
|
PointMesh |
copy()
Creates a copy of this mesh. |
PointMesh |
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. |
boolean |
epsilonEquals(MeshBase base,
double eps)
Tests to see if a mesh equals this one. |
AABBTree |
getBVTree()
|
Vector3d |
getNormal(int idx)
Returns the idx-th normal in this mesh. |
double |
getNormalRenderLen()
|
java.util.ArrayList<Vector3d> |
getNormals()
|
int |
getNumNormals()
Returns the number of normals in this mesh. |
void |
read(ReaderTokenizer rtok,
boolean zeroIndexed)
Reads the contents of this mesh from a ReaderTokenizer. |
void |
readBinary(java.io.File file)
|
void |
render(GLRenderer renderer,
RenderProps props,
int flags)
|
void |
set(Point3d[] pnts,
Vector3d[] nrms)
Sets the vertex points and normals associated with this mesh. |
void |
setNormalRenderLen(double len)
|
void |
setNormals(java.util.ArrayList<Vector3d> normals)
|
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 PointMesh()
public PointMesh(java.io.File file) throws java.io.IOException
write(PrintWriter,NumberFormat,boolean)
.
file
- file containing the mesh description
java.io.IOException
public PointMesh(PointMesh old)
Method Detail |
---|
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<Vector3d> getNormals()
public void setNormals(java.util.ArrayList<Vector3d> normals)
public void clearNormals()
public RenderProps createRenderProps(HasProperties host)
createRenderProps
in class MeshBase
host
- if non-null, is used to initialize inherited values
public double getNormalRenderLen()
public void setNormalRenderLen(double len)
public void readBinary(java.io.File file) throws java.io.IOException
java.io.IOException
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, Vector3d[] nrms)
pnts
- points from which the vertices are formednrms
- (optional) if non-null, gives vectors from which the normals are formed.
java.lang.IllegalArgumentException
- if nrms is non-null and does not have the
same size as pnts.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
The format used to print vertex coordinates is specified by a
NumberFormat
.
write
in class MeshBase
pw
- PrintWriter to write this mesh tofmt
- (optional) format for writing the vertex and normals 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 PointMesh copy()
copy
in class MeshBase
public PointMesh copyWithVertices(java.util.ArrayList<? extends Vertex3d> vtxs)
copyWithVertices
in class MeshBase
public void addMesh(PointMesh mesh)
mesh
- Mesh to be added to this meshpublic AABBTree getBVTree()
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 |