toxi.volume
Class IsoSurface

java.lang.Object
  extended by toxi.volume.IsoSurface

public class IsoSurface
extends java.lang.Object

IsoSurface class based on C version by Paul Bourke and Lingo version by myself.


Field Summary
 toxi.geom.Vec3D[] faceNormals
           
 float isoValue
           
 
Constructor Summary
IsoSurface(VolumetricSpace volume)
           
 
Method Summary
 void computeFaceNormals()
           
 void computeSurface(float iso)
          Computes the surface mesh for the given volumetric data and iso value.
 toxi.geom.mesh.TriangleMesh computeSurfaceMesh(toxi.geom.mesh.TriangleMesh mesh, float iso)
           
 toxi.geom.Vec3D getNormalForFace(int faceID)
           
 int getNumFaces()
           
 int getNumVertices()
           
 toxi.geom.Vec3D[] getVerticesForFace(int faceID, toxi.geom.Vec3D[] vertices)
          Retrieves vertices for the requested mesh face/triangle.
 void reset()
          Resets mesh vertices to default positions and clears face index.
 void saveAsOBJ(java.lang.String fn)
          Saves the surface mesh as Wavefront OBJ format and automatically merges shared vertices.
 void saveAsSTL(java.lang.String fn)
          Saves surface mesh as binary STL file.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

isoValue

public float isoValue

faceNormals

public toxi.geom.Vec3D[] faceNormals
Constructor Detail

IsoSurface

public IsoSurface(VolumetricSpace volume)
Method Detail

computeFaceNormals

public void computeFaceNormals()

computeSurface

public void computeSurface(float iso)
Computes the surface mesh for the given volumetric data and iso value.


computeSurfaceMesh

public toxi.geom.mesh.TriangleMesh computeSurfaceMesh(toxi.geom.mesh.TriangleMesh mesh,
                                                      float iso)

getNormalForFace

public toxi.geom.Vec3D getNormalForFace(int faceID)

getNumFaces

public int getNumFaces()

getNumVertices

public int getNumVertices()

getVerticesForFace

public toxi.geom.Vec3D[] getVerticesForFace(int faceID,
                                            toxi.geom.Vec3D[] vertices)
Retrieves vertices for the requested mesh face/triangle.

Parameters:
faceID - face index
vertices - Vec3D array to place vertices in or null to create a new array automatically
Returns:
vertices as Vec3D array

reset

public void reset()
Resets mesh vertices to default positions and clears face index. Needs to be called inbetween successive calls to computeSurface(float).


saveAsOBJ

public void saveAsOBJ(java.lang.String fn)
Saves the surface mesh as Wavefront OBJ format and automatically merges shared vertices.

Parameters:
fn - absolute path/filename to write mesh to

saveAsSTL

public void saveAsSTL(java.lang.String fn)
Saves surface mesh as binary STL file.

Parameters:
fn - absolute path/filename to save to