Classes | |
struct | fcp |
The fcp struct determines on which side of an active voxel the face center point is located (= ori), where it is located in the scalar field of density values (index i refers to the position in xfIndex, yfIndex or zfIndex - depending on the face orientation ori). The Boolean variables visitedNorth etc. indicate which direction has already been taken in previous visits to the FCP. More... | |
struct | fcpPOA |
struct | poa |
This struct determines the point of ambiguity (=POA) and his 4 adjacent FCPs. The start members indicates in which direction the POA is located, viewed from the respective FCP from. More... | |
Public Member Functions | |
void | createSurface (volume_parameters &settings, MyMesh &mesh, double threshold=7000, bool connected=false, bool mixedMode=true, bool extraPoints=false) |
This function generates a surface from a 3-dimensional scalar field using the VESTA algorithm. The values of the scalar field have to be available as a std::vector of doubles, the surface is stored in a TriMesh. More... | |
void | setBorderOffset (double bOffset) |
This setter determines whether the surface should protrude from the scalar field when it gets to the edge of the scalar field. The surface has to protrude from the scalar field, if there are no zero faces (and holes) may arise. More... | |
void | clear4refresh () |
This function sets all the private member variables to 0. It is required if another surface is to be generated with the same surfaceExtraction object with which a surface has been generated already. | |
bool | existComplexEdges () |
This function reports whether during the last calculation of the surface complex edges have occured. More... | |
void | setMediumMode () |
This sets a mode that switches to the high resolution mode, if the cycle length is equal 8 or greater. | |
bool | getMediumMode () |
This function reports whether the medium mode is set. More... | |
void | setSemiConnectedMode () |
This sets a mode that calculates 8 cycles in the low resolution mode in a secure way. | |
bool | getSpecialMode () |
This function reports whether the special mode is set. More... | |
void | setSpecialMode () |
This sets a mode that switches to the high resolution mode, if complex edges occurs. | |
void | setModeDecided (bool decided) |
This function determines whether you will be asked if you want to switch to the special mode in the case of occurance of edges. More... | |
void | setSurfaceColor (int n) |
With this funtion, the color of the surface can be set. More... | |
void | setFeatureEdges (bool fEdges) |
This setter determines whether additional red edges are drawn for highlighting the cycles of the VESTA algorithm. Thereby the mesh becomes slightly damaged (because edges are drawn twice). This highlighting is used for test purposes. More... | |
void | setDeleteZeroFaces (bool zerofaced) |
This setter determines whether defective zero faces should be deleted. This kind of faces is not generated (so far as it has been observed). More... | |
Private Types | |
enum | start { north, east, south, west } |
Defines the directions in which one can travel from the face center point of a cube side. | |
Private Member Functions | |
std::vector< int > * | stdIndex (int ori, start dir) |
This helper function for the next FCP function returns the xfIndex-, yfIndex- or zfIndex- vector depending on the orientation ori of the current FCP and a the current direction of the VESTA cycle. More... | |
std::vector< int > * | altIndex (int ori) |
This helper function for the next FCP function returns the xfIndex-, yfIndex- or zfIndex- vector depending on the orientation ori of the current FCP and a the current direction of the VESTA cycle. More... | |
surfaceExtraction::start | iterDir (start dir, int i) |
This helper function for the nextFCP function returns the direction of the next VESTA segment in clockwise order. More... | |
surfaceExtraction::start | prevDir (start dir) |
This helper function for the nextFCP function returns the direction of the next VESTA segment in counterclockwise order. More... | |
surfaceExtraction::start | stdDir (int ori, start dir, bool connec) |
This helper function for the next FCP function determines next movement direction if traveling from ori 1-6 in direction NESW (=0-3) around 90 or 270 degree corner via cube[ori][dir]. More... | |
surfaceExtraction::start | altDir (int ori, start dir, bool connec) |
This helper function for the next FCP function determines next movement direction if traveling from ori 1-6 in direction NESW (=0-3) around 0 or 180 degree corner via cube[ori][dir]. More... | |
int | offset (int orientation, start dir, int case012, bool connec) |
This helper function for the next FCP function determines the offset to the adjacent FCPs. This offset concern the xfIndex-, yfIndex- or zfIndex- vector. More... | |
int | cubeSide (int orientation, start dir, bool connec) |
This helper function for the next FCP function returns the cube side of the first case in the crucial query. More... | |
int | nextOri (int ori, start dir) |
This function is not used. It returns a cube side if traveling from ori 1-6 in direction NESW (=0-3) via cube[ori][dir]. That describes the geometry of the cube with the sides 1-6. | |
int | nextFCP (int inIndex, start &direction, bool connec) |
That is the crucial function of the VESTA algorithm. Given a face center point (=FCP) and a direction (=NESW), it computes the next FCP of the VESTA cycle. More... | |
int | threeNeighboursFCPNew (int i, start direction, int &a, int &b, start &d1, start &d2, start &d3) |
Given a FCP and a direction, this function find the three FCPs adjacent to a POA. More... | |
void | setPOAconnected (int i, bool connected) |
This function specifies that 4 FCP cycles are connected or disconnected. More... | |
void | setFCPconnected (int fcpIndex, start direction, bool connected) |
This function specifies that a FCP is connected in a specific direction. More... | |
double | poaDensity (int fcp1i, int fcp1ori, int fcp2i, volume_parameters &settings) |
This function computes the density at a point of ambiguity (=between two FCPs) More... | |
double | fcpDensity (int fcpOri, int vd, int xEdgeLength, int yEdgeLength, std::vector< double > &densities) |
This function computes the density at a FCP (=between two Voxels of the scalar field) More... | |
void | fillup (volume_parameters &settings, double isoValue, MyMesh &mesh) |
This function computes the face center points and puts them all in the allFCP vector. Furthermore, it computes the cuboid which contains the pointers (=indices) pointing to the FCPs in the allFCP vector (this cuboid is represented by the vectors xfIndex, yfIndex and zfIndex). Finally, this function computes edge1 and edge2 (the offsets in y- and z-direction in the cuboid of pointers) and the derived member variables doffset and offsetCube. More... | |
void | createTriangles (int fcpCycle[], int lengthOfCycle, MyMesh &mesh, bool extraPoints) |
This function computes the triangulations (= 4-/5-/6-/7-/8-/9-/12-cycle decomposition), and draws the triangles, by calling drawTriangles. More... | |
int | computeStartIndex (int &lengthOfCycle, int fcpCycle[], bool semicon) |
This function computes the start index of the 8 cycle. More... | |
bool | drawTriangles (int startIndex, int fcpCycle[], int lengthOfCycle, std::vector< MyMesh::FaceHandle > *fHandles, MyMesh &mesh) |
This function draws the triangles of a triangulation. If an error occurs (complex edge), the user will be asked to select how the procedure is continued. Either the function is exited, or the triangles are still drawn. More... | |
void | computeExtraPoint (int &startIndex, int fcpCycle[], int &lengthOfCycle, MyMesh &mesh) |
This function computes the center of gravity and adds this point at the beginning and at the end of the fcpCycle. Therefore, the length of the cycle increases by 2. More... | |
bool | isSameVoxel (int index1, int index2) |
This function checks if two faces belong to the same density value/cube. This is needed for computing a better cycle order. More... | |
Private Attributes | |
bool | complexEdgeError = false |
If an complex edge error occurs, this variable is set to true. | |
bool | mediumMode = false |
True if the medium mode is set. | |
bool | semiConnectedMode = false |
True if 8 cycles are calculated in the low resolution mode in a secure way. | |
bool | specialMode = false |
True if the special mode is set (low resolution mode and high resolution mode in case of complex edges). | |
bool | modeDecided = false |
True if high resolution mode is selected in case of complex edges. | |
bool | drawPOAs = false |
If this variable is true, points of ambiguities will be drawn. | |
double | borderOffset = 0.0 |
If this parameter is greater than zero, the surface protrude from the scalar field. | |
bool | computeNormals = true |
True if face normals are to be calculated. | |
bool | deleteZeroFaces = true |
If this variable is true, it will be checked whether faces of zero length were drawn, and these faces will be deleted. | |
bool | featureEdges = false |
True if feature edges should be drawn. | |
double | minSpacing = 0.000001 |
the minimal distance between the center of a voxel and a FCP | |
MyMesh::Color | fcpColor = MyMesh::Color(0,0.9,0,0.9) |
This variable defines the color of the face center points and therefore it determines the color of the surface. | |
int | cube [7][4] |
start | stdDirection [7][4] |
determines next movement direction if traveling from ori 1-6 in direction NESW (=0-3) around 90 or 270 degree corner via cube[ori][dir] More... | |
start | altDirection [7][4] |
determines next movement direction if traveling from ori 1-6 in direction NESW (=0-3) around 0 or 180 degree corner via cube[ori][dir] More... | |
int | offsetCube [7][4][3] |
The offsets for the nextFCP function. | |
int | doffset [7] |
The offsets between two adjacent voxels depending on the side of the voxel. | |
std::vector< fcp > | allFCP |
This vector contains all face center points (=FCP) of the surface. | |
std::vector< int > | xfIndex |
std::vector< int > | yfIndex |
std::vector< int > | zfIndex |
std::vector< int > * | indexStd [7][2] |
std::vector< int > * | indexAlt [7] |
std::vector< poa > | allPOA |
This vector contains all points of ambiguity (=POA) of the surface. | |
std::vector< fcpPOA > | allFCPpoa |
This vector contains all the fcpPOAs. It is as large as the allFCP vector. | |
|
private |
This helper function for the next FCP function determines next movement direction if traveling from ori 1-6 in direction NESW (=0-3) around 0 or 180 degree corner via cube[ori][dir].
ori | the current orientation of the FCP |
dir | the current direction |
connec | true if the voxels are sould be connected, otherwise false |
|
private |
This helper function for the next FCP function returns the xfIndex-, yfIndex- or zfIndex- vector depending on the orientation ori of the current FCP and a the current direction of the VESTA cycle.
ori | the orientation of the FCP |
dir | the current direction |
|
inlineprivate |
This function computes the center of gravity and adds this point at the beginning and at the end of the fcpCycle. Therefore, the length of the cycle increases by 2.
startIndex | is the index of the FCP which is shared by all triangles. |
fcpCycle | contains all the FCPs of a cycle |
lengthOfCycle | ndicates the length of the cycle. |
mesh | is the mesh, in which everything is drawn. |
|
inlineprivate |
This function computes the start index of the 8 cycle.
lengthOfCycle | length of the cycle (= 8) |
fcpCycle | the indices of the FCPs of the cycle in allFCP |
semicon | True if 8 cycles are to be calculated in a secure way |
void ilato::surfaceExtraction::createSurface | ( | volume_parameters & | settings, |
MyMesh & | mesh, | ||
double | threshold = 7000 , |
||
bool | connected = false , |
||
bool | mixedMode = true , |
||
bool | extraPoints = false |
||
) |
This function generates a surface from a 3-dimensional scalar field using the VESTA algorithm. The values of the scalar field have to be available as a std::vector of doubles, the surface is stored in a TriMesh.
settings | is a volume_parameters struct object. This object contains among others a std::vector<double> densities, a std::vector<int> dimSize and an Eigen::Vector3d called offset. |
mesh | in this TriMesh, the surface is stored. |
threshold | indicates at which density value the surface should be drawn. |
connected | indicates whether diagonally adjacent densitiy values that are above the threshold should always be connected or not. |
mixedMode | is this parameter true, then it is decided automatically whether adjacent values are connected or not (depending on the local environment). |
extraPoints | indicates whether the high resolution mode should be used. |
|
private |
This function computes the triangulations (= 4-/5-/6-/7-/8-/9-/12-cycle decomposition), and draws the triangles, by calling drawTriangles.
fcpCycle | contains all the FCPs of a cycle |
lengthOfCycle | indicates the length of the cycle. |
mesh | is the mesh, in which everything is drawn. |
extraPoints | if this variable is true, the high resolution mode is selected. |
|
private |
This helper function for the next FCP function returns the cube side of the first case in the crucial query.
orientation | the current orientation ori of the FCP |
dir | the current direction of the VESTA cycle |
connec | true if the voxels are sould be connected, otherwise false |
|
inlineprivate |
This function draws the triangles of a triangulation. If an error occurs (complex edge), the user will be asked to select how the procedure is continued. Either the function is exited, or the triangles are still drawn.
startIndex | is the index of the FCP which is shared by all triangles. |
fcpCycle | contains all the FCPs of a cycle |
lengthOfCycle | indicates the length of the cycle. |
fHandles | in this vector the face handles of all triangles of the triangulation are stored. |
mesh | is the mesh, in which everything is drawn. |
bool ilato::surfaceExtraction::existComplexEdges | ( | ) |
This function reports whether during the last calculation of the surface complex edges have occured.
|
private |
This function computes the density at a FCP (=between two Voxels of the scalar field)
fcpOri | the orientation of the FCP. |
vd | the position in the densities vector (=scalar field) |
xEdgeLength | the length of the scalar field in x-direction |
yEdgeLength | the length of the scalar field in y-direction |
densities | the scalar field |
|
private |
This function computes the face center points and puts them all in the allFCP vector. Furthermore, it computes the cuboid which contains the pointers (=indices) pointing to the FCPs in the allFCP vector (this cuboid is represented by the vectors xfIndex, yfIndex and zfIndex). Finally, this function computes edge1 and edge2 (the offsets in y- and z-direction in the cuboid of pointers) and the derived member variables doffset and offsetCube.
settings | this object contains the scalar field |
isoValue | the threshold for the isosurface. |
mesh | is the mesh, in which everything is drawn. |
bool ilato::surfaceExtraction::getMediumMode | ( | ) |
This function reports whether the medium mode is set.
bool ilato::surfaceExtraction::getSpecialMode | ( | ) |
This function reports whether the special mode is set.
|
private |
This function checks if two faces belong to the same density value/cube. This is needed for computing a better cycle order.
index1 | the index of the first FCP in allFCP |
index2 | the index of the second FCP in allFCP |
|
private |
This helper function for the nextFCP function returns the direction of the next VESTA segment in clockwise order.
dir | the direction |
i | the number of jumps in clockwise order |
|
private |
That is the crucial function of the VESTA algorithm. Given a face center point (=FCP) and a direction (=NESW), it computes the next FCP of the VESTA cycle.
inIndex | is the index of the fcp in the allFCP vector. |
direction | is the direction in which the VESTA algorithm goes in this step. After returning, this variable indicates the new direction in the next step. |
connec | indicates whether the connected mode has to be selected. |
|
private |
This helper function for the next FCP function determines the offset to the adjacent FCPs. This offset concern the xfIndex-, yfIndex- or zfIndex- vector.
orientation | the current orientation of the FCP |
dir | the direction |
case012 | case 0,1 or 2 of the three possible cases of the crucial query |
connec | true if the voxels are sould be connected, otherwise false |
|
private |
This function computes the density at a point of ambiguity (=between two FCPs)
fcp1i | the index of the first FCP in allFCP |
fcp1ori | the orientation ori of the first FCP |
fcp2i | the index of the first FCP in allFCP |
settings | the scalar field |
|
private |
This helper function for the nextFCP function returns the direction of the next VESTA segment in counterclockwise order.
dir | the direction |
void ilato::surfaceExtraction::setBorderOffset | ( | double | bOffset | ) |
This setter determines whether the surface should protrude from the scalar field when it gets to the edge of the scalar field. The surface has to protrude from the scalar field, if there are no zero faces (and holes) may arise.
bOffset | if this parameter is greater than zero, the surface protrude from the scalar field. |
void ilato::surfaceExtraction::setDeleteZeroFaces | ( | bool | zerofaced | ) |
This setter determines whether defective zero faces should be deleted. This kind of faces is not generated (so far as it has been observed).
zerofaced | if this parameter is false, zero faces are not drawn. |
|
private |
This function specifies that a FCP is connected in a specific direction.
fcpIndex | the index of the FCP in allFCP |
direction | the direction |
connected | true if connected, false otherwise |
void ilato::surfaceExtraction::setFeatureEdges | ( | bool | fEdges | ) |
This setter determines whether additional red edges are drawn for highlighting the cycles of the VESTA algorithm. Thereby the mesh becomes slightly damaged (because edges are drawn twice). This highlighting is used for test purposes.
fEdges | if this parameter is true, then additional red edges are drawn. |
void ilato::surfaceExtraction::setModeDecided | ( | bool | decided | ) |
This function determines whether you will be asked if you want to switch to the special mode in the case of occurance of edges.
decided | has to be true, if you want to be asked. |
|
private |
This function specifies that 4 FCP cycles are connected or disconnected.
i | the index if the POA in allPOA |
connected | true if connected, false otherwise |
void ilato::surfaceExtraction::setSurfaceColor | ( | int | n | ) |
With this funtion, the color of the surface can be set.
n | determines the color: 1 = blue, 2 = violet, other = green |
|
private |
This helper function for the next FCP function determines next movement direction if traveling from ori 1-6 in direction NESW (=0-3) around 90 or 270 degree corner via cube[ori][dir].
ori | the current orientation of the FCP |
dir | the current direction |
connec | true if the voxels are sould be connected, otherwise false |
|
private |
This helper function for the next FCP function returns the xfIndex-, yfIndex- or zfIndex- vector depending on the orientation ori of the current FCP and a the current direction of the VESTA cycle.
ori | the orientation or of the FCP |
dir | the current direction |
|
private |
Given a FCP and a direction, this function find the three FCPs adjacent to a POA.
i | The index of the given FCP in allFCP |
direction | The direction, in which the POA is located. |
a | After returning, this variable contains the index of the first FCP adjacent to the POA. |
b | After returning, this variable contains the index of the second FCP adjacent to the POA. |
d1 | the direction, in which the POA is located viewed from the third FCP |
d2 | the direction, in which the POA is located viewed from the first FCP |
d3 | the direction, in which the POA is located viewed from the second FCP |
|
private |
determines next movement direction if traveling from ori 1-6 in direction NESW (=0-3) around 0 or 180 degree corner via cube[ori][dir]
|
private |
Determines next cube side if traveling from ori 1-6 in direction NESW (=0-3) via cube[ori][dir]. That describes the geometry of the cube with the sides 1-6.
|
private |
determines proper vector to find next FCP if traveling from ori 1-6 in direction NESW (=0-3) in this case we hop on neighbor cube while maintaining current orientation (0 degree turn - also valid for 180 degree turns)
|
private |
determines proper vector for to find next FCP if traveling from ori 1-6 in direction NESW (=0-3) in this case we stay on same cube (90 degree turn - also valid for hops with 270 degree turns)
|
private |
determines next movement direction if traveling from ori 1-6 in direction NESW (=0-3) around 90 or 270 degree corner via cube[ori][dir]
|
private |
This vector defines a cuboid which contains pointers (=indices) pointing to FCPs in the allFCP vector. These pointers refers to FCPs which are located between two density values in x-direction. This means that for example xfIndex[5] is to the right of densities[5] and to the left of densities[6]. A value of -1 means that there is no FCP at this point.
|
private |
This vector defines a cuboid which contains pointers (=indices) pointing to FCPs in the all FCP vector. These pointers refers to FCPs which are located between two density values in y-direction. This means that for example yfIndex[5] is above densities[5] and below densities[5+edge1].
|
private |
This vector defines a cuboid which contains pointers (=indices) pointing to FCPs in the all FCP vector. These pointers refers to FCPs which are located between two density values in z-direction. This means that for example zfIndex[5] is in front of densities[5] and behind densities[5+edge2].