public class PnMarchingCubes
extends java.lang.Object
You may pass the scalar field as an dimX*dimY*dimZ sized array of double values. Because of the limited memory of a machine, it is also possible to specify a function which is called repeatedly from the algorithm to obtain the data of the scalar field. However, if the evaluation of the function costs much time, you may want to enable buffering, which reduces the number of callback calls for the same point in space from 8 to 1. The memory used for buffering is O(dimX*dimY).
Usage:
Construct new MarchingCube object
call setVectorGrid()
call setData() or setFunction()
call startAlgorithm()
Constructor and Description |
---|
PnMarchingCubes()
Construct a new MarchingCubes object.
|
Modifier and Type | Method and Description |
---|---|
boolean |
getOrientate()
Return a flag, whether the alforithm should produce an oriented surface.
|
boolean |
getWeighted() |
void |
setData(PdVector data)
Set the data of the scalar field.
|
void |
setFunction(PnFunction function,
boolean bufferData)
Set function to obtain the data of the scalar field.
|
void |
setOrientate(boolean orientate)
Set flag, whether the algorithm should produce an oriented surface.
|
void |
setVectorGrid(int dimX,
int dimY,
int dimZ,
PdVector origin,
PdVector baseX,
PdVector baseY,
PdVector baseZ)
Set the dimension and distortion of the bounding box.
|
void |
setVectorGrid(PdVector corner1,
PdVector corner2,
int numX,
int numY,
int numZ)
Set the dimension and bounding box of the vector grid.
|
void |
setWeighted(boolean weighted)
Set whether the position of new vertices should be weighted on the
function values of the corners of the cube.
|
PgElementSet |
startAlgorithm(double threshold)
Start the algorithm.
|
public void setVectorGrid(PdVector corner1, PdVector corner2, int numX, int numY, int numZ)
corner1
- on corner of the bounding boxcorner2
- opposite corner of the bounding boxnumX
- number of sampled points in x directionnumY
- number of sampled points in y directionnumZ
- number of sampled points in z directionpublic void setVectorGrid(int dimX, int dimY, int dimZ, PdVector origin, PdVector baseX, PdVector baseY, PdVector baseZ)
This method should be called before setData() or setDataProducer().
dimX
- number of sampled points in x directiondimY
- number of sampled points in y directiondimZ
- number of sampled points in z directionorigin
- corner of the bounding boxbaseX
- distance vector between two sample points in x directionbaseY
- distance vector between two sample points in y directionbaseZ
- distance vector between two sample points in z directionpublic void setData(PdVector data)
data
- function values of the sample pointspublic void setFunction(PnFunction function, boolean bufferData)
function
- instance of PnFunctionbufferData
- whether the obtained data from the function
should be bufferedpublic void setWeighted(boolean weighted)
public boolean getWeighted()
public void setOrientate(boolean orientate)
orientate
- whether to produce an oriented surface (default: true)public boolean getOrientate()
public PgElementSet startAlgorithm(double threshold)
threshold
- iso value for evaluation"