|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sf.j3d.threeD.raytracer.engine.AbstractSurface
net.sf.j3d.threeD.raytracer.engine.SurfaceGroup
net.sf.j3d.threeD.raytracer.engine.SpacePartition
net.sf.j3d.threeD.raytracer.primitives.Mesh
public class Mesh
A Mesh object stores a set of points (Vector objects) and allows triangles to be specified using those points.
| Nested Class Summary | |
|---|---|
static class |
Mesh.MeshFile
|
static class |
Mesh.Vertex
|
static interface |
Mesh.VertexData
|
| Field Summary |
|---|
| Fields inherited from class net.sf.j3d.threeD.raytracer.engine.SpacePartition |
|---|
l, r, s |
| Constructor Summary | |
|---|---|
Mesh()
Constructs a new Mesh object. |
|
Mesh(Mesh.VertexData data)
|
|
Mesh(Vector[] points,
int[][] triangles)
Constructs a new Mesh object. |
|
| Method Summary | |
|---|---|
void |
addSurface(Surface s)
Adds the specified Surface object to this SurfaceGroup object and sets its parent to this SurfaceGroup object (if it is an instance of AbstractSurface). |
int |
addTriangle(int p1,
int p2,
int p3)
Adds the triangle described by the specified points to the mesh represented by this Mesh object. |
int |
addVector(Vector p)
Adds the point defined by the specified Vector object to the mesh represented by this Mesh object. |
void |
clearIgnoreCache()
|
void |
clearIntersectionCache()
|
void |
clearTriangleCache()
|
int |
downsample(double l,
double p)
Downsamples this mesh by setting the ignore flag for some triangles. |
Object |
encode()
|
int |
extrudeFace(int face,
double l)
Extrudes the specified face in the direction of its surface normal by the distance specified. |
int |
extrudeFace(int p1,
int p2,
int p3,
Vector n)
Extrudes the specified face with an offset of the specified vector. |
int |
extrudeFace(int face,
Vector n)
Extrudes the specified face with an offset of the specified vector.~ This method probably does not work properly. |
int |
getIndex(Vector v)
|
boolean |
getInterpolateColor()
|
Vector |
getNormalAt(Vector point)
Returns null. |
boolean |
getRemoveBackFaces()
|
boolean |
getSmooth()
|
Surface |
getSurface(int index)
Returns the Surface object stored by this SurfaceGroup object at the specified index. |
Surface[] |
getSurfaces()
Returns the Surface objects stored by this SurfaceGroup object as a Surface array. |
Triangle |
getTriangle(int face)
Checks triangle cache for the specified face index, and constructs a Triangle object if it is not present. |
Triangle |
getTriangle(int face,
boolean cache)
Checks triangle cache for the specified face index, and constructs a Triangle object if it is not present. |
int[][] |
getTriangleData()
|
int[][] |
getTriangleData(boolean b)
|
Triangle[] |
getTriangles()
|
Mesh.Vertex[] |
getVectors()
|
Mesh.Vertex[] |
getVectors(boolean b)
|
int |
indexOf(Vector v)
|
boolean |
intersect(Ray ray)
Returns true if the ray represented by the specified Ray object intersects any of the surfaces represented by this SurfaceGroup object. |
Intersection |
intersectAt(Ray ray)
Returns an Intersection object that represents the ray-surface intersections for the AbstractSurface object which is intersected closest to the origin of the ray (>= 0). |
Iterator |
iterateVectors()
|
void |
loadTree()
|
void |
loadTriangles()
|
void |
removeSurface(int index)
Removes the Surface object stored at the specified index from this SurfaceGroup object and sets the parent of the removed Surface object to null (if it is an instance of AbstractSurface). |
void |
setInterpolateColor(boolean c)
|
void |
setRemoveBackFaces(boolean b)
|
void |
setSmooth(boolean smooth)
Sets the smooth flag for this Mesh object. |
void |
setSurfaces(Surface[] surfaces)
Does nothing. |
void |
setTriangleData(int[][] data)
|
void |
setVectors(Mesh.Vertex[] p)
Removes all points stored by this Mesh and adds those stored in the specified array. |
Mesh |
triangulate()
|
| Methods inherited from class net.sf.j3d.threeD.raytracer.engine.SpacePartition |
|---|
isTreeLoaded, loadTree |
| Methods inherited from class net.sf.j3d.threeD.raytracer.engine.SurfaceGroup |
|---|
shade |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Mesh()
public Mesh(Vector[] points,
int[][] triangles)
points - Array of points to use.triangles - {{x0, y0, z0}, {x1, y1, z1},...} Where the int values
are indices in the points array.public Mesh(Mesh.VertexData data)
| Method Detail |
|---|
public int addVector(Vector p)
p - Vector object to add.
public int addTriangle(int p1,
int p2,
int p3)
p1 - Index of first point.p2 - Index of second point.p3 - Index of third point.
IllegalArgumentException - if any of the indicies specified are not valid.public void clearIgnoreCache()
public void loadTree()
loadTree in class SpacePartitionpublic void loadTriangles()
public void clearTriangleCache()
public void clearIntersectionCache()
public void setVectors(Mesh.Vertex[] p)
p - Array of Vertex objects to add.public Mesh.Vertex[] getVectors()
public Mesh.Vertex[] getVectors(boolean b)
public Iterator iterateVectors()
public void setTriangleData(int[][] data)
public int[][] getTriangleData()
public int[][] getTriangleData(boolean b)
public Triangle[] getTriangles()
public Triangle getTriangle(int face)
face - Index of face.
public Triangle getTriangle(int face,
boolean cache)
face - Index of face.cache - True if Triangle should be cached if it is created, false otherwise.
public int indexOf(Vector v)
v - Vector to return index of.
public Vector getNormalAt(Vector point)
SurfaceGroup
getNormalAt in interface SurfacegetNormalAt in class SurfaceGrouppublic void setSmooth(boolean smooth)
smooth - Boolean flag to use.public boolean getSmooth()
public void setRemoveBackFaces(boolean b)
b - True if bace faces should be ignored, false if they should be included.public boolean getRemoveBackFaces()
public void setInterpolateColor(boolean c)
c - If set to true, color will be interpolated based on vertex colors.public boolean getInterpolateColor()
public int getIndex(Vector v)
public int downsample(double l,
double p)
l - Threshold perimeter value.p - Probability of elimination (0.0 - 1.0).
public int extrudeFace(int face,
double l)
face - Index of triangle to extrude.l - Length to extrude.
public int extrudeFace(int face,
Vector n)
face - Index of triangle to extrude.n - Normal to offset by.
public int extrudeFace(int p1,
int p2,
int p3,
Vector n)
p1 - Index of first point of triangle to extrude.p1 - Index of second point of triangle to extrude.p1 - Index of third point of triangle to extrude.n - Normal to offset by.
public Mesh triangulate()
triangulate in class SurfaceGrouppublic boolean intersect(Ray ray)
SurfaceGroup
intersect in interface Surfaceintersect in class SpacePartitionSurface.intersect(net.sf.j3d.threeD.raytracer.engine.Ray)public Intersection intersectAt(Ray ray)
SurfaceGroup
intersectAt in interface SurfaceintersectAt in class SpacePartitionSurface.intersectAt(net.sf.j3d.threeD.raytracer.engine.Ray)public void setSurfaces(Surface[] surfaces)
setSurfaces in class SurfaceGrouppublic void addSurface(Surface s)
SurfaceGroup
addSurface in class SurfaceGrouppublic void removeSurface(int index)
SurfaceGroup
removeSurface in class SurfaceGrouppublic Surface[] getSurfaces()
SurfaceGroup
getSurfaces in class SurfaceGrouppublic Surface getSurface(int index)
SurfaceGroup
getSurface in class SurfaceGrouppublic Object encode()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||