Woolz Image Processing  Version 1.8.3
WlzGeoModel

Files

file  WlzGeometryTrackUpAndDown_s.c
 Tracks contours forming surface patches.
 
file  WlzGeoModel.c
 Basic operators for manipulating Woolz geometric models. These can be either planar graphs or 3D surfaces, with the surfaces being either manifold or non-manifold.
 
file  WlzGeoModelCellGridWSp.c
 Functions to create and free geometric models cell grid work spaces.
 
file  WlzGeoModelCut.c
 Functions to cut geometric models (GM's).
 
file  WlzGeoModelFilters.c
 Filters for geometric models (GM's).
 

Data Structures

union  _WlzGMElemP
 A union of pointers to all the valid geometric model elements. Typedef: WlzGMElemP. More...
 
struct  _WlzGMCore
 The core geometric model element from which all geometric modeling elements inherit the type and index fields. Typedef: WlzGMCore. More...
 
struct  _WlzGMVertexG2I
 The position of a point in 2D integer space. Typedef: WlzGMVertexG2I. More...
 
struct  _WlzGMVertexG2D
 The position of a point in 2D double precision space. Typedef: WlzGMVertexG2D. More...
 
struct  _WlzGMVertexG2N
 The position of a point in 2D double precision space and the normal vector at that point. Note that the data structure is the same as WlzGMVertexG2D until the normal, this is important as it allows the type, index and position to be established without knowing whether the vertex geometry is WlzGMVertexG2D or WlzGMVertexG2N. Typedef: WlzGMVertexG2N. More...
 
struct  _WlzGMVertexG3I
 The position of a point in 3D integer space. Typedef: WlzGMVertexG3I. More...
 
struct  _WlzGMVertexG3D
 The position of a point in 3D double precision space. Typedef: WlzGMVertexG3D. More...
 
struct  _WlzGMVertexG3N
 The position of a point in 3D double precision space and the normal vector at that point. Note that the data structure is the same as WlzGMVertexG3D until the normal, this is important as it allows the type, index and position to be established without knowing whether the vertex geometry is WlzGMVertexG3D or WlzGMVertexG3N. Typedef: WlzGMVertexG3N. More...
 
union  _WlzGMVertexGU
 A union of pointers to the geometric properties of a point. Typedef: WlzGMVertexGU. More...
 
struct  _WlzGMVertexT
 The topological properties of a point in space. The ordering of the linked list of vertex topology elements formed by the 'next' and 'prev' pointers is not significant. Typedef: WlzGMVertexT. More...
 
struct  _WlzGMVertex
 A single point in space defined in terms of both it's geometry and it's topology. Typedef: WlzGMVertex. More...
 
struct  _WlzGMDiskT
 A topological disk around a vertex. In 2D or 3D manifold there is one disk per vertex. But in a 3D non-manifold shell many sheets (manifold surfaces components) may be connected at a single vertex, in which case there is one disk per sheet. The disk encodes the radial order of the vertex topology elements around the vertex. Typedef: WlzGMDiskT. More...
 
struct  _WlzGMEdgeT
 The topological properties of a directed edge. Typedef: WlzGMEdgeT. More...
 
struct  _WlzGMEdge
 A line or curve between a pair of vertices. Although this only has a topological component a geometric component would allow curves to be represented. Typedef: WlzGMEdge. More...
 
struct  _WlzGMLoopT
 A directed loop or the topological properties of a loop. Typedef: WlzGMLoopT. More...
 
struct  _WlzGMFace
 A circuit of edges. Typedef: WlzGMFace. More...
 
struct  _WlzGMShellG2I
 The geometric properties of a shell in 2D integer space. Typedef: WlzGMShellG2I. More...
 
struct  _WlzGMShellG2D
 The geometric properties of a shell in 2D double precision space. Typedef: WlzGMShellG2D. More...
 
struct  _WlzGMShellG3I
 The geometric properties of a shell in 3D integer space. Typedef: WlzGMShellG3I. More...
 
struct  _WlzGMShellG3D
 The geometric properties of a shell in 3D double precision. space. Typedef: WlzGMShellG3D. More...
 
union  _WlzGMShellGU
 A union of pointers to the geometric properties of a shell. Typedef: WlzGMShellGU. More...
 
struct  _WlzGMShell
 A shell which is a collection of connected geometric modeling elements. Typedef: WlzGMShell. More...
 
struct  _WlzGMResource
 A resource vector (extensible array) used for allocating geometric modeling elements. Typedef: WlzGMResource. More...
 
struct  _WlzGMModelR
 The resources used by a model. Typedef: WlzGMModelR. More...
 
struct  _WlzGMModel
 A geometric model which can represent both 2D graphs and 3D surfaces, with the surfaces being either manifold or non-manifold. The geometric model inherits it's core fields from the Woolz core domain. Typedef: WlzGMModel. More...
 
struct  _WlzGMCbEntry
 
struct  _WlzGMResIdx
 A resource index look up table (WlzGMResIdxTb). The array of indicies is a look up table from the indicies of a GM to contigous indicies suitable for copying or outputing a resource vector without holes. Typedef: WlzGMResIdx. More...
 
struct  _WlzGMResIdxTb
 Resource look up tables for all geometric elements in a model. Typedef: WlzGMResIdxTb. More...
 
struct  _WlzGMGridWSpCell3D
 A single cell entry in an axis aligned grid for a 3D model. Typedef: WlzGMGridWSpCell3D. More...
 
struct  _WlzGMGridWSp3D
 An axis aligned grid of cuboid cells. This has an array (the grid) of linked lists of cells, with the entries in each list holding the faces of the 3D model which intersect the cuboid of the cell. Typedef: WlzGMGridWSp3D. More...
 

Macros

#define WLZ_GM_TOLERANCE   (1.0e-06)
 Tolerance for geometric queries in geometric models. More...
 
#define WLZ_GM_TOLERANCE_SQ   (WLZ_GM_TOLERANCE * WLZ_GM_TOLERANCE)
 Square of tolerance for geometric queries in geometric models. More...
 

Typedefs

typedef void(* WlzGMCbFn) (WlzGMModel *, WlzGMElemP, WlzGMCbReason, void *)
 A pointer function to a function called when elements of a Woolz geometric model are either created or deleted. More...
 

Enumerations

enum  _WlzGMModelType {
  WLZ_GMMOD_2I = 1,
  WLZ_GMMOD_2D,
  WLZ_GMMOD_3I,
  WLZ_GMMOD_3D,
  WLZ_GMMOD_2N,
  WLZ_GMMOD_3N
}
 Types of geometric models. Typedef: WlzGMModelType. More...
 
enum  _WlzGMElemType {
  WLZ_GMELM_NONE = 0,
  WLZ_GMELM_VERTEX,
  WLZ_GMELM_VERTEX_G2I,
  WLZ_GMELM_VERTEX_G2D,
  WLZ_GMELM_VERTEX_G2N,
  WLZ_GMELM_VERTEX_G3I,
  WLZ_GMELM_VERTEX_G3D,
  WLZ_GMELM_VERTEX_G3N,
  WLZ_GMELM_VERTEX_T,
  WLZ_GMELM_DISK_T,
  WLZ_GMELM_EDGE,
  WLZ_GMELM_EDGE_T,
  WLZ_GMELM_FACE,
  WLZ_GMELM_LOOP_T,
  WLZ_GMELM_SHELL,
  WLZ_GMELM_SHELL_G2I,
  WLZ_GMELM_SHELL_G2D,
  WLZ_GMELM_SHELL_G3I,
  WLZ_GMELM_SHELL_G3D
}
 Types of geometric model elements. Typedef: WlzGMElemType. More...
 
enum  _WlzGMElemTypeFlags {
  WLZ_GMELMFLG_VERTEX = (1 << 0),
  WLZ_GMELMFLG_VERTEX_G = (1 << 1),
  WLZ_GMELMFLG_VERTEX_T = (1 << 2),
  WLZ_GMELMFLG_DISK_T = (1 << 3),
  WLZ_GMELMFLG_EDGE = (1 << 4),
  WLZ_GMELMFLG_EDGE_T = (1 << 5),
  WLZ_GMELMFLG_FACE = (1 << 6),
  WLZ_GMELMFLG_LOOP_T = (1 << 7),
  WLZ_GMELMFLG_SHELL = (1 << 8),
  WLZ_GMELMFLG_SHELL_G = (1 << 9)
}
 Bit masks for the types of geometric model elements. Typedef: WlzGMElemTypeFlags. More...
 
enum  _WlzGMCbReason {
  WLZ_GMCB_NEW,
  WLZ_GMCB_FREE
}
 The reason a callback function is called. Typedef: WlzGMCbReason. More...
 
enum  _WlzLBTNodeFlags {
  WLZ_LBT_NODE_FLAG_NONE = 0,
  WLZ_LBT_NODE_FLAG_BOUNDARY = 1
}
 The reason a callback function is called. Typedef: WlzGMCbReason. More...
 

Functions

WlzErrorNum WlzGMModelAddResCb (WlzGMModel *model, WlzGMCbFn fn, void *data)
 Add a resource allocation callback to the models resources. More...
 
void WlzGMModelRemResCb (WlzGMModel *model, WlzGMCbFn fn, void *data)
 Removes a resource allocation callback from the models resources. Both the callback function and callback data must have the same values as when the callback was added since they are used to find the corresponding callback entry. More...
 
WlzGMModelWlzGMModelNew (WlzGMModelType modType, int blkSz, int vHTSz, WlzErrorNum *dstErr)
 Creates an empty non-manifold geometry model. More...
 
WlzGMShellWlzGMModelNewS (WlzGMModel *model, WlzErrorNum *dstErr)
 Creates an empty shell with a shell geometry element for the model. More...
 
WlzGMFaceWlzGMModelNewF (WlzGMModel *model, WlzErrorNum *dstErr)
 Creates an empty face. More...
 
WlzGMLoopTWlzGMModelNewLT (WlzGMModel *model, WlzErrorNum *dstErr)
 Creates a loop topology element. More...
 
WlzGMEdgeWlzGMModelNewE (WlzGMModel *model, WlzErrorNum *dstErr)
 Creates a new edge. The edge geometry element only has it's index set to a meaningful value. More...
 
WlzGMEdgeTWlzGMModelNewET (WlzGMModel *model, WlzErrorNum *dstErr)
 Creates a new edge topology element. More...
 
WlzGMVertexWlzGMModelNewV (WlzGMModel *model, WlzErrorNum *dstErr)
 Creates a new vertex and a vertex geometry element. The vertex geometry element only has it's index set to a meaningful value. More...
 
WlzGMVertexTWlzGMModelNewVT (WlzGMModel *model, WlzErrorNum *dstErr)
 Creates a new vertex topology element. More...
 
WlzGMModelWlzGMModelNewFromS (WlzGMShell *gS, WlzErrorNum *dstErr)
 Creates a new model from the given shell. The new model contains a copy of the given shell. More...
 
WlzGMModelWlzGMModelCopy (WlzGMModel *gM, WlzErrorNum *dstErr)
 Copies the given model. Because all unused elements are squeezed out, the indicies of the elements may not be equal in the two models. More...
 
WlzErrorNum WlzGMModelFree (WlzGMModel *model)
 Free's a geometric model and it's elements. More...
 
WlzErrorNum WlzGMModelFreeS (WlzGMModel *model, WlzGMShell *shell)
 Marks a shell and it's geometry as invalid and suitable for reclaiming. More...
 
WlzErrorNum WlzGMModelFreeF (WlzGMModel *model, WlzGMFace *face)
 Marks a face as invalid and suitable for reclaiming. More...
 
WlzErrorNum WlzGMModelFreeLT (WlzGMModel *model, WlzGMLoopT *loopT)
 Marks a loop topology as invalid and suitable for reclaiming. More...
 
WlzErrorNum WlzGMModelFreeDT (WlzGMModel *model, WlzGMDiskT *diskT)
 Marks an disk topology as invalid and suitable for reclaiming. More...
 
WlzErrorNum WlzGMModelFreeE (WlzGMModel *model, WlzGMEdge *edge)
 Marks an edge as invalid and suitable for reclaiming. More...
 
WlzErrorNum WlzGMModelFreeET (WlzGMModel *model, WlzGMEdgeT *edgeT)
 Marks an edge topology as invalid and suitable for reclaiming. More...
 
WlzErrorNum WlzGMModelFreeV (WlzGMModel *model, WlzGMVertex *vertex)
 Marks a vertex and it's geometry as invalid and suitable for reclaiming. Watch out that vertices remain in the hash table after being free'd. More...
 
WlzErrorNum WlzGMModelFreeVT (WlzGMModel *model, WlzGMVertexT *vertexT)
 Marks a vertex topology as invalid and suitable for reclaiming. More...
 
WlzErrorNum WlzGMModelDeleteS (WlzGMModel *model, WlzGMShell *dS)
 Deletes a shell by unlinking it and then freeing it and all it's children. More...
 
WlzErrorNum WlzGMModelDeleteV (WlzGMModel *model, WlzGMVertex *dV)
 Deletes a vertex along with all the elements which depend on it. All elements which depend on the vertex are unlinked and then freed. If the vertex's parents were to depend only on the vertex then they would be free'd too as the Woolz geometric models can not hold an isolated vertex. The basic algorithm used is: Build a collection of edges which use the vertex and then delete all edges in the collection. If there are no edges (in the collection) then just unlink and free the vertex. The geometries of the existing and new shells will be valid on return. More...
 
int WlzGMModelGetDimension (WlzGMModel *model, WlzErrorNum *dstErr)
 Gets the models dimension from the model's type. More...
 
WlzErrorNum WlzGMModelTypeValid (WlzGMModelType type)
 Checks the model type is valid. More...
 
WlzGMResourceWlzGMModelGetRes (WlzGMModel *model, WlzGMElemType elemType, WlzErrorNum *dstErr)
 Gets the resources for the given element type in the given model. More...
 
WlzGMElemType WlzGMModelGetSGeomType (WlzGMModel *model)
 Gets the shell's geometry type from the model's type. More...
 
WlzGMElemType WlzGMModelGetVGeomType (WlzGMModel *model)
 Gets the verticies geometry type from the model's type. More...
 
WlzErrorNum WlzGMShellGetGBB3D (WlzGMShell *shell, WlzDBox3 *bBox)
 Gets a shell's geometry using the given destination pointer to a double precision bounding box. More...
 
WlzErrorNum WlzGMShellGetGBBV3D (WlzGMShell *shell, double *vol)
 Gets the volume of the shell's geometry's bounding box. More...
 
WlzErrorNum WlzGMShellGetGBB2D (WlzGMShell *shell, WlzDBox2 *bBox)
 Gets a shell's geometry using the given destination pointer to a double precision bounding box. More...
 
WlzErrorNum WlzGMShellSetGBB3D (WlzGMShell *shell, WlzDBox3 bBox)
 Sets a shell's geometry using the given double precision bounding box. More...
 
WlzErrorNum WlzGMShellSetGBB2D (WlzGMShell *shell, WlzDBox2 bBox)
 Sets a shell's geometry using the given double precision bounding box. More...
 
WlzErrorNum WlzGMShellSetG3D (WlzGMShell *shell, int nPnt, WlzDVertex3 *pos)
 Sets a shell's geometry using the pair of double precision points. More...
 
WlzErrorNum WlzGMShellSetG2D (WlzGMShell *shell, int nPnt, WlzDVertex2 *pos)
 Sets a shell's geometry using the pair of double precision points. More...
 
WlzErrorNum WlzGMModelSetSG (WlzGMModel *model)
 Sets the geometry of each of the shells in the given model. More...
 
WlzErrorNum WlzGMShellUpdateG3D (WlzGMShell *shell, WlzDVertex3 pos)
 Updates a shell's geometry using the given double precision position. More...
 
WlzErrorNum WlzGMShellUpdateG2D (WlzGMShell *shell, WlzDVertex2 pos)
 Updates a shell's geometry using the new given double precision position. More...
 
WlzErrorNum WlzGMShellUpdateGBB3D (WlzGMShell *shell, WlzDBox3 bBox)
 Updates a shell's geometry using the given double precision position bounding box. The updated geometry is the union of the existing geometry and the given bounding box. More...
 
WlzErrorNum WlzGMShellUpdateGBB2D (WlzGMShell *shell, WlzDBox2 bBox)
 Updates a shell's geometry using the given double precision position bounding box. The updated geometry is the union of the existing geometry and the given bounding box. More...
 
WlzErrorNum WlzGMShellDndateG2D (WlzGMShell *shell, WlzDVertex2 pos)
 Updates the shell's geometry for the removed vertex with the given position. More...
 
WlzErrorNum WlzGMShellDndateG3D (WlzGMShell *shell, WlzDVertex3 pos)
 Updates the shell's geometry for the removed vertex with the given position. More...
 
WlzErrorNum WlzGMShellComputeGBB (WlzGMShell *shell)
 Recomputes the shell's geometry by walking through it's children. More...
 
int WlzGMShellGInBB3D (WlzGMShell *shell, WlzDVertex3 pos)
 Checks to see if the given double precision position is within the shell's bounding box. More...
 
int WlzGMShellGInBB2D (WlzGMShell *shell, WlzDVertex2 pos)
 Checks to see if the given double precision position is within the shell's bounding box. More...
 
WlzErrorNum WlzGMVertexSetG2D (WlzGMVertex *vertex, WlzDVertex2 pos)
 Sets a vertex geometry using the given double precision position. More...
 
WlzErrorNum WlzGMVertexSetG2N (WlzGMVertex *vertex, WlzDVertex2 pos, WlzDVertex2 nrm)
 Sets a vertex geometry using the given double precision position and normal. More...
 
WlzErrorNum WlzGMVertexSetG3D (WlzGMVertex *vertex, WlzDVertex3 pos)
 Sets a vertex geometry using the given double precision position. More...
 
WlzErrorNum WlzGMVertexSetG3N (WlzGMVertex *vertex, WlzDVertex3 pos, WlzDVertex3 nrm)
 Sets a vertex geometry using the given double precision position and normal. More...
 
WlzErrorNum WlzGMVertexGetG3D (WlzGMVertex *vertex, WlzDVertex3 *dstPos)
 Gets a veticies geometry into the given double precision position destination pointer. More...
 
WlzErrorNum WlzGMVertexGetG3N (WlzGMVertex *vertex, WlzDVertex3 *dstPos, WlzDVertex3 *dstNrm)
 Gets a vertex geometry into the given double precision position and normaldestination pointers. If the model vertex geometry does not have normals then the normal will be {0,0,0}, the zero vector. More...
 
WlzErrorNum WlzGMVertexGetG2D (WlzGMVertex *vertex, WlzDVertex2 *dstPos)
 Gets a veticies geometry into the given double precision position destination pointer. More...
 
WlzErrorNum WlzGMVertexGetG2N (WlzGMVertex *vertex, WlzDVertex2 *dstPos, WlzDVertex2 *dstNrm)
 Gets a vertex geometry into the given double precision position and normal destination pointers. If the model vertex geometry does not have normals then the normal will be {0,0}, the zero vector. More...
 
WlzDVertex3 WlzGMVertexCmp3D (WlzGMVertex *vertex, WlzDVertex3 pos)
 Compares the position of the given vertex with the given 3D double precision position. More...
 
WlzDVertex2 WlzGMVertexCmp2D (WlzGMVertex *vertex, WlzDVertex2 pos)
 Compares the position of the given vertex with the given 2D double precision position. More...
 
int WlzGMVertexCmpSign2D (WlzGMVertex *vertex, WlzDVertex2 pos)
 Compares the coordinates of the given vertex and 2D double precision position to find a signed value for sorting. More...
 
int WlzGMVertexCmpSign3D (WlzGMVertex *vertex, WlzDVertex3 pos)
 Compares the coordinates of the given vertex and 3D double precision position to find a signed value for sorting. More...
 
double WlzGMVertexDistSq3D (WlzGMVertex *vertex, WlzDVertex3 pos)
 Calculates the square of the Euclidean distance between the given vertex and the given 3D double precision position. More...
 
WlzDVertex3 WlzGMVertexNormal3D (WlzGMModel *dummy, WlzGMVertex *gV, int *sVBufSz, WlzGMVertex ***sVBuf, WlzErrorNum *dstErr)
 Computes the value of the normal at the given vertex which lies within the given model. This function requires a buffer in which to store the vertices found on the loops surrounding the given vertex. For efficiency this can/should be reused between calls of this function. More...
 
double WlzGMVertexDistSq2D (WlzGMVertex *vertex, WlzDVertex2 pos)
 Calculates the square of the Euclidean distance between the given vertex and the given 2D double precision position. More...
 
WlzErrorNum WlzGMFaceGetG3D (WlzGMFace *face, WlzDVertex3 *dstPos0, WlzDVertex3 *dstPos1, WlzDVertex3 *dstPos2)
 Gets the geometry of a face. More...
 
WlzGMVertexWlzGMModelMatchVertexG3D (WlzGMModel *model, WlzDVertex3 gPos)
 Attempts to find a vertex which matches the given double precision 3D position. More...
 
WlzGMVertexWlzGMModelMatchVertexG2D (WlzGMModel *model, WlzDVertex2 gPos)
 Attempts to find a vertex which matches the given double precision 2D position. More...
 
double WlzGMVertexShellDist (WlzGMVertex *v0, WlzGMVertex *v1, double maxDist, WlzErrorNum *dstErr)
 Computes the minimum distance between the two vertices where the path between them is constrained to the common shell, this will be negative if the two vertices are in different shells. More...
 
WlzErrorNum WlzGMVerifyModel (WlzGMModel *model, WlzGMElemP *dstElmP)
 Verifies the given model. If the invalid element destination pointer is given then it MAY be set to point to an invalid element of the model. This function was written as an aid to debugging. More...
 
WlzErrorNum WlzGMVerifyShell (WlzGMShell *shell, WlzGMElemP *dstElmP)
 Verifies the given shell. If the invalid element destination pointer is given then it MAY be set to point to an invalid element of the model. This function was written as an aid to debugging. More...
 
WlzErrorNum WlzGMVerifyLoopT (WlzGMLoopT *loopT, WlzGMElemP *dstElmP)
 Verifies the given loop topology element. If the invalid element destination pointer is given then it MAY be set to point to an invalid element of the model. This function was written as an aid to debugging. More...
 
WlzGMEdge ** WlzGMModelFindNMEdges (WlzGMModel *model, int *dstNMCnt, WlzErrorNum *dstErr)
 Finds a loop topology element in common for the two edge topology elements. More...
 
WlzGMLoopTWlzGMEdgeTCommonLoopT (WlzGMEdgeT *eT0, WlzGMEdgeT *eT1)
 Finds a loop topology element in common for the two edge topology elements. More...
 
WlzGMEdgeWlzGMVertexCommonEdge (WlzGMVertex *eV0, WlzGMVertex *eV1)
 Finds the edge common to the two given verticies. More...
 
WlzGMShellWlzGMVertexCommonShell (WlzGMVertex *eV0, WlzGMVertex *eV1)
 Finds the shell common to the two given verticies. More...
 
WlzGMShellWlzGMVertexGetShell (WlzGMVertex *eV)
 Finds the parent shell of the given vertex. More...
 
WlzGMShellWlzGMEdgeGetShell (WlzGMEdge *eE)
 Finds the parent shell of the given edge. More...
 
WlzGMVertexWlzGMEdgeCommonVertex (WlzGMEdge *eE0, WlzGMEdge *eE1)
 Finds the common vertex of the two given edges. More...
 
WlzGMVertexWlzGMEdgeCommonVertexGetDiskTs (WlzGMEdge *eE0, WlzGMEdge *eE1, WlzGMDiskT **dstDT0, WlzGMDiskT **dstDT1)
 Finds the common vertex of the two given edges and sets the disk topology element destination pointers if there is a common vertex. NULL*. More...
 
WlzGMDiskTWlzGMEdgeCommonDiskT (WlzGMEdge *eE0, WlzGMEdge *eE1)
 Finds the common disk topology element of the two given edges. More...
 
void WlzGMVertexTAppend (WlzGMVertexT *eVT, WlzGMVertexT *nVT)
 Append new vertex topology element onto a doubly linked list of vertex topology element's, knowing that neither is NULL. Vertex topology elements are maintained in an unordered doubly linked list. More...
 
void WlzGMDiskTAppend (WlzGMDiskT *eDT, WlzGMDiskT *nDT)
 Append new edge topology onto a doubly linked list of disk topology element's, knowing that neither is NULL. Disk topology elements are maintained in an unordered doubly linked list. More...
 
void WlzGMEdgeTAppend (WlzGMEdgeT *eET, WlzGMEdgeT *nET)
 Append new edge topology onto a doubly linked list of edge topology element's, knowing that neither is NULL. Edge topology elements are maintained in an ordered doubly linked list, CCW around the inside of loops and CW around the outside of 2D loops. More...
 
void WlzGMEdgeTInsert (WlzGMEdgeT *eET, WlzGMEdgeT *nET)
 Insert new edge topology into a doubly linked list of edge topology element's, knowing that neither is NULL. Edge topology elements are maintained in an ordered doubly linked list, CCW around the inside of loops and CW around the outside of 2D loops. More...
 
void WlzGMEdgeTInsertRadial (WlzGMEdgeT *nET)
 Inserts the given new edge topology element into a radially sorted cyclic list of edge topology element's. More...
 
void WlzGMLoopTAppend (WlzGMLoopT *eLT, WlzGMLoopT *nLT)
 Append new loop topology onto a doubly linked list of loop topology element's, knowing that neither is NULL. Loop topology elements are maintained in an unordered doubly linked list. More...
 
void WlzGMLoopTUnlink (WlzGMLoopT *dLT)
 Unlinks the given loop topology element from a doubly linked list of loop topology element's, knowing that it is not NULL. If this is the only loop topology element in parent the parent's list of loop topology elements is set to NULL. Other elements which point to this loop topology element are not modified. More...
 
void WlzGMEdgeTUnlink (WlzGMEdgeT *dET)
 Unlinks the given edge topology element from it's loop topology element and it's opposite edge topology element. The opposite edge topology element MUST be unlinked before the model is valid again. More...
 
void WlzGMVertexTUnlink (WlzGMVertexT *dVT)
 Unlinks the given vertex topology element from a doubly linked list of vertex topology element's, knowing that it is not NULL. Since the parent of a vertex topology element is always an edge topology element and an edge topology element only ever uses a single vertex topology element, set the parent's vertex topology element pointer to NULL. More...
 
void WlzGMDiskTUnlink (WlzGMDiskT *dDT)
 Unlinks the given disk topology element from a doubly linked list of disk topology element's, knowing that it is not NULL. If this is the only disk topology element of the vertex the vertex's list of disk topology elements is set to NULL. Other elements which point to this disk topology element are not modified. More...
 
void WlzGMDiskTJoin (WlzGMDiskT *gDT0, WlzGMDiskT *gDT1)
 Joins the given pair of disk topology elements on return the first of the diskTs has all the vertexTs of both and the second of the diskTs should be free'd without being unlinked. More...
 
void WlzGMShellAppend (WlzGMShell *eS, WlzGMShell *nS)
 Append new shell onto a doubly linked list of shells, knowing that neither is NULL. A model's shells are maintained in an unordered doubly linked list. More...
 
void WlzGMShellUnlink (WlzGMShell *dS)
 Unlinks the given shell from a doubly linked list of shells kept by the model, knowing that the given shell ptr is not NULL. More...
 
void WlzGMShellJoinAndUnlink (WlzGMShell *eShell, WlzGMShell *dShell)
 Joins the shell to be unlinked onto the shell that's to be extended and then unlinks (but does not free) it. Both shells must be valid. More...
 
WlzGMResIdxTbWlzGMModelResIdx (WlzGMModel *model, unsigned int eMsk, WlzErrorNum *dstErr)
 Makes an index look up table data structure for the given model. More...
 
void WlzGMModelResIdxFree (WlzGMResIdxTb *resIdxTb)
 Frees a GM index look up table data structure. More...
 
WlzErrorNum WlzGMModelRehashVHT (WlzGMModel *model, int vHTSz)
 Rehash the vertex matching hash table. More...
 
WlzErrorNum WlzGMModelConstructS (WlzGMModel *cM, WlzGMShell *gS)
 Constructs a copy of the given shell in the current model. The curent model must be of the same type as the parent of the given shell and all the usual construction restrictions apply, see WlzGMModelConstructSimplex2D(). More...
 
WlzErrorNum WlzGMModelConstructSimplex2D (WlzGMModel *model, WlzDVertex2 *pos)
 Constructs a 2D simplex (edge) defined by two double precision end points. Either of the two points may already exist within the model and the simplex must not intersect any existing simplex in the model. See WlzGMShellMatchVtxG2D() for the meaning of the backwards, forwards and distance search parameters. More...
 
WlzErrorNum WlzGMModelConstructSimplex2N (WlzGMModel *model, WlzDVertex2 *pos, WlzDVertex2 *nrm)
 Constructs a 2D simplex (edge) defined by two double precision end points with normal components. Either of the two points may already exist within the model and the simplex must not intersect any existing simplex in the model. See WlzGMShellMatchVtxG2D() for the meaning of the backwards, forwards and distance search parameters. More...
 
WlzErrorNum WlzGMModelConstructSimplex3D (WlzGMModel *model, WlzDVertex3 *pos)
 Constructs a 3D simplex (triangle) defined by three double precision verticies, any of which may already exist within the model. If a new face is created then the child loopT of that face will have edgeT's that use the given vertices in their given order. More...
 
WlzErrorNum WlzGMModelConstructSimplex3N (WlzGMModel *model, WlzDVertex3 *pos, WlzDVertex3 *nrm)
 Constructs a 3D simplex (triangle) defined by three double precision verticies with normals, any of which may already exist within the model. If a new face is created then the child loopT of that face will have edgeT's that use the given vertices in their given order. More...
 
void WlzGMModelRemVertex (WlzGMModel *model, WlzGMVertex *dV)
 Removes a vertex from the models vertex hash table. The vertex's geometry must have been set. More...
 
void WlzGMModelAddVertexToHT (WlzGMModel *model, WlzGMVertex *nV)
 Adds a new vertex into the models vertex hash table. The vertex's geometry must have been set. More...
 
int WlzGMShellSimplexCnt (WlzGMShell *shell)
 Counts the number of simplicies in the given shell. For 2D models the simplicies are edges and for 3D models they are loops. More...
 
WlzGMGridWSp3DWlzGeoModelGridWSpNew3D (WlzGMModel *model, WlzGMElemType elemType, WlzErrorNum *dstErr)
 Makes a new cell grid for the given elelemnt type in the given 3D model. See WlzGeoModelGridWSpSet3D(). More...
 
WlzErrorNum WlzGeoModelGridWSpSet3D (WlzGMGridWSp3D *grid, WlzGMModel *model, WlzGMElemType elemType)
 Populates a 3D geometric model grid workspace from the given 3D model. Currently this function has only been implimented for when geometric models elements are faces all other types will result in and unimplimented error code. More...
 
WlzErrorNum WlzGeoModelGridFree3D (WlzGMGridWSp3D *grid)
 Frees the given geometric model cell grid. More...
 
WlzIBox3 WlzGeoModelGridCellsInDBox (WlzGMGridWSp3D *grid, WlzDBox3 dBox)
 Computes the box of grid cells which encloses the given double box. More...
 
WlzGMModelWlzGMModelCut (WlzGMModel *given, WlzGMModel *knife, WlzErrorNum *dstErr)
 Creates a new geometric model from the given model such that no elements of the given model which intersect with elements in the knife model are included. While this code seems to work for simple models errors have been seen with complex models. The code for this function and those static functions that it calls should be considered "under construction". More...
 
WlzGMModelWlzGMModelCutDom (WlzGMModel *given, WlzObject *knife, WlzErrorNum *dstErr)
 Creates a new geometric model from the given model such that no elements of the given model which intersect with elements in the knife domain are included. More...
 
WlzErrorNum WlzGMFilterRmSmShells (WlzGMModel *model, int minSpx)
 Removes small shells from the given geometric model. More...
 
WlzErrorNum WlzGMFilterGeomLP (WlzGMModel *model, double kPB, double kSB, double dPB, double dSB, int maxItr, int nonMan)
 Performs a low pass filtering operation on the geometry of the model, given the band pass and band stop filter parameters. These parameters specify the transfer function of the low pass filter. More...
 
WlzErrorNum WlzGMFilterGeomLPParam (double *dstLambda, double *dstMu, int *dstNItr, double kPB, double kSB, double dPB, double dSB)
 Computes the values of \(\lambda\) and \(\mu\) from the given low pass filter parameters \(k_{PB}\), \(k_{SB}\), \(\delta_{PB}\) and \(\delta_{SB}\). Valid filter parameters require: \(0 < k_{PB} < 1\), \(k_{PB} < k_{SB} < 2\), \(0 < \delta_{PB} < 1\) and \(0 < \delta_{SB} < 1\). If the parameters are outside of these ranges an error is returned, but these constrants are not sufficient for a good filter. Design tips are don't make the transition band too narrow (keep \(k_{PB}\) away from \(k_{SB}\)) and don't make \(\delta_{PB}\) or \(\delta_{SB}\) too small (try values of 0.1 for \(\delta_{PB}\) and \(\delta_{SB}\)). Good values for \(k_{PB}\) are probably in the range \([0.01-0.1]\). The values of \(\lambda\) and \(\mu\) in the transfer function of the filter

\[ f(k) = ((1 - {\lambda}k)(1 - {\mu}k))^N \]

are constrained by:

\[ 0 < N \]

\[ 0 < \lambda < -\mu < 1 \]

\[ \lambda < \frac{1}{k_{SB}} \]

\[ \frac{1}{\lambda} + \frac{1}{\mu} = k_{PB} \]

\[ {\left(\frac{{(\lambda - \mu)}^2} {-4\lambda\mu}\right)}^N < 1 + \delta_{PB} \]

\[ {\left(\frac{1 - \lambda k_{SB}} {1 - \mu k_{SB}}\right)}^N < \delta_{SB} \]

Following Taubin's fairing paper an additional constraint is imposed \(f(1) = -f(2)\), which allows a simple algebraic solution for \(\lambda\), \(\mu\). The value of \(N\) is then computed by taking the maximum of \(N_{PB}\) and \(N_{SB}\). So the algorithm used to compute the values of \(\lambda\), \(\mu\) and \(N\) is:

\[ \lambda = \frac{1}{3 k_{PB} - 5} (k_{PB} - \sqrt{k_{PB}^2 - 6 k_{PB} + 10}) \]

\[ \mu = \frac{1}{3 k_{PB} - 5} (k_{PB} + \sqrt{k_{PB}^2 - 6 k_{PB} + 10}) \]

\[ N_{PB} = \frac{\ln{(1 + \delta_{PB})}} {\ln{({(\lambda - \mu)}^2 (-4 \lambda \mu))}} \]

\[ N_{SB} = \frac{\ln{(\delta_{SB})}} {\ln{((1 - \lambda k_{SB})(1 - \mu k_{SB}))}} \]

\[ N = \max{(N_{PB}, N_{SB})} \]

. More...

 
WlzErrorNum WlzGMFilterGeomLPLM (WlzGMModel *model, double lambda, double mu, int nItr, int nonMan)
 Given values of \(\lambda\), \(\mu\) and the number of itterations \(N\), applies a low pass filter to the geometry of the given model. More...
 
int WlzGMModelSpxStats (WlzGMModel *model, double *dstMin, double *dstMax, double *dstSum, double *dstSumSq, double *dstMean, double *dstStdDev, WlzErrorNum *dstErr)
 Calculates statistics of the simplices in the given geometric model. This can be useful for checking the quality of a given model. More...
 

Detailed Description

Macro Definition Documentation

◆ WLZ_GM_TOLERANCE

#define WLZ_GM_TOLERANCE   (1.0e-06)

◆ WLZ_GM_TOLERANCE_SQ

#define WLZ_GM_TOLERANCE_SQ   (WLZ_GM_TOLERANCE * WLZ_GM_TOLERANCE)

Square of tolerance for geometric queries in geometric models.

Referenced by WlzGMModelConstructSimplex2N(), and WlzGMModelConstructSimplex3N().

Typedef Documentation

◆ WlzGMCbFn

WlzGMCbFn

A pointer function to a function called when elements of a Woolz geometric model are either created or deleted.

Enumeration Type Documentation

◆ _WlzGMModelType

Types of geometric models. Typedef: WlzGMModelType.

Enumerator
WLZ_GMMOD_2I 
WLZ_GMMOD_2D 
WLZ_GMMOD_3I 
WLZ_GMMOD_3D 
WLZ_GMMOD_2N 
WLZ_GMMOD_3N 

◆ _WlzGMElemType

Types of geometric model elements. Typedef: WlzGMElemType.

Enumerator
WLZ_GMELM_NONE 
WLZ_GMELM_VERTEX 
WLZ_GMELM_VERTEX_G2I 
WLZ_GMELM_VERTEX_G2D 
WLZ_GMELM_VERTEX_G2N 
WLZ_GMELM_VERTEX_G3I 
WLZ_GMELM_VERTEX_G3D 
WLZ_GMELM_VERTEX_G3N 
WLZ_GMELM_VERTEX_T 
WLZ_GMELM_DISK_T 
WLZ_GMELM_EDGE 
WLZ_GMELM_EDGE_T 
WLZ_GMELM_FACE 
WLZ_GMELM_LOOP_T 
WLZ_GMELM_SHELL 
WLZ_GMELM_SHELL_G2I 
WLZ_GMELM_SHELL_G2D 
WLZ_GMELM_SHELL_G3I 
WLZ_GMELM_SHELL_G3D 

◆ _WlzGMElemTypeFlags

Bit masks for the types of geometric model elements. Typedef: WlzGMElemTypeFlags.

Enumerator
WLZ_GMELMFLG_VERTEX 
WLZ_GMELMFLG_VERTEX_G 
WLZ_GMELMFLG_VERTEX_T 
WLZ_GMELMFLG_DISK_T 
WLZ_GMELMFLG_EDGE 
WLZ_GMELMFLG_EDGE_T 
WLZ_GMELMFLG_FACE 
WLZ_GMELMFLG_LOOP_T 
WLZ_GMELMFLG_SHELL 
WLZ_GMELMFLG_SHELL_G 

◆ _WlzGMCbReason

The reason a callback function is called. Typedef: WlzGMCbReason.

Enumerator
WLZ_GMCB_NEW 

New element has been created.

WLZ_GMCB_FREE 

Existing element is about to be free'd.

◆ _WlzLBTNodeFlags

The reason a callback function is called. Typedef: WlzGMCbReason.

Enumerator
WLZ_LBT_NODE_FLAG_NONE 
WLZ_LBT_NODE_FLAG_BOUNDARY 

Node is adjacent to the objects boundary.

Function Documentation

◆ WlzGMModelAddResCb()

WlzErrorNum WlzGMModelAddResCb ( WlzGMModel model,
WlzGMCbFn  fn,
void *  data 
)

Add a resource allocation callback to the models resources.

Returns
Woolz error code.
Parameters
modelThe model.
fnThe callback function.
dataThe callback data to be passed on to the callback function.

References AlcMalloc(), _WlzGMModelR::callbacks, _WlzGMCbEntry::data, _WlzGMCbEntry::fn, _WlzGMCbEntry::next, _WlzGMModel::res, WLZ_ERR_MEM_ALLOC, and WLZ_ERR_NONE.

◆ WlzGMModelRemResCb()

void WlzGMModelRemResCb ( WlzGMModel model,
WlzGMCbFn  fn,
void *  data 
)

Removes a resource allocation callback from the models resources. Both the callback function and callback data must have the same values as when the callback was added since they are used to find the corresponding callback entry.

Returns
void
Parameters
modelThe model.
fnThe callback function.
dataThe callback data.

References AlcFree(), _WlzGMModelR::callbacks, _WlzGMCbEntry::data, _WlzGMCbEntry::fn, _WlzGMCbEntry::next, and _WlzGMModel::res.

◆ WlzGMModelNew()

WlzGMModel* WlzGMModelNew ( WlzGMModelType  modType,
int  blkSz,
int  vHTSz,
WlzErrorNum dstErr 
)

Creates an empty non-manifold geometry model.

Returns
New empty model.
Parameters
modTypeType of model to create.
blkSzResource block size, used for allocating storage for model elements. A default size is used if <= 0.
vHTSzVertex matching hash table size, A default size is used if <= 0.
dstErrDestination error pointer, may be null.

References AlcCalloc(), AlcVectorNew(), _WlzGMModelR::diskT, _WlzGMModelR::edge, _WlzGMModelR::edgeT, _WlzGMModelR::face, _WlzGMModelR::loopT, _WlzGMModel::res, _WlzGMModelR::shell, _WlzGMModelR::shellG, _WlzGMModel::type, _WlzGMResource::vec, _WlzGMModelR::vertex, _WlzGMModelR::vertexG, _WlzGMModel::vertexHT, _WlzGMModel::vertexHTSz, _WlzGMModelR::vertexT, WLZ_ERR_DOMAIN_TYPE, WLZ_ERR_MEM_ALLOC, WLZ_ERR_NONE, WLZ_GMMOD_2D, WLZ_GMMOD_2I, WLZ_GMMOD_2N, WLZ_GMMOD_3D, WLZ_GMMOD_3I, WLZ_GMMOD_3N, and WlzGMModelFree().

Referenced by WlzContourGrdObj2D(), WlzEffReadObjStl(), WlzGetSectionFromGMModel(), WlzGMModelCopy(), WlzGMModelCut(), WlzGMModelCutDom(), and WlzGMModelNewFromS().

◆ WlzGMModelNewS()

WlzGMShell* WlzGMModelNewS ( WlzGMModel model,
WlzErrorNum dstErr 
)

◆ WlzGMModelNewF()

WlzGMFace* WlzGMModelNewF ( WlzGMModel model,
WlzErrorNum dstErr 
)

Creates an empty face.

Returns
New face.
Parameters
modelParent model.
dstErrDestination error pointer, may be null.

References AlcVectorExtendAndGet(), _WlzGMElemP::face, _WlzGMModelR::face, _WlzGMFace::idx, _WlzGMResource::numElm, _WlzGMResource::numIdx, _WlzGMModel::res, _WlzGMFace::type, _WlzGMResource::vec, WLZ_ERR_DOMAIN_NULL, WLZ_ERR_MEM_ALLOC, WLZ_ERR_NONE, and WLZ_GMELM_FACE.

◆ WlzGMModelNewLT()

WlzGMLoopT* WlzGMModelNewLT ( WlzGMModel model,
WlzErrorNum dstErr 
)

Creates a loop topology element.

Returns
New loop topology element.
Parameters
modelParent model.
dstErrDestination error pointer, may be null.

References AlcVectorExtendAndGet(), _WlzGMLoopT::idx, _WlzGMElemP::loopT, _WlzGMModelR::loopT, _WlzGMResource::numElm, _WlzGMResource::numIdx, _WlzGMModel::res, _WlzGMLoopT::type, _WlzGMResource::vec, WLZ_ERR_DOMAIN_NULL, WLZ_ERR_MEM_ALLOC, WLZ_ERR_NONE, and WLZ_GMELM_LOOP_T.

◆ WlzGMModelNewE()

WlzGMEdge* WlzGMModelNewE ( WlzGMModel model,
WlzErrorNum dstErr 
)

Creates a new edge. The edge geometry element only has it's index set to a meaningful value.

Returns
New edge.
Parameters
modelModel with resources.
dstErrDestination error pointer, may be null.

References AlcVectorExtendAndGet(), _WlzGMElemP::edge, _WlzGMModelR::edge, _WlzGMEdge::idx, _WlzGMResource::numElm, _WlzGMResource::numIdx, _WlzGMModel::res, _WlzGMEdge::type, _WlzGMResource::vec, WLZ_ERR_DOMAIN_NULL, WLZ_ERR_MEM_ALLOC, WLZ_ERR_NONE, and WLZ_GMELM_EDGE.

◆ WlzGMModelNewET()

WlzGMEdgeT* WlzGMModelNewET ( WlzGMModel model,
WlzErrorNum dstErr 
)

Creates a new edge topology element.

Returns
New edge topology element.
Parameters
modelModel with resources.
dstErrDestination error pointer, may be null.

References AlcVectorExtendAndGet(), _WlzGMElemP::edgeT, _WlzGMModelR::edgeT, _WlzGMEdgeT::idx, _WlzGMResource::numElm, _WlzGMResource::numIdx, _WlzGMModel::res, _WlzGMEdgeT::type, _WlzGMResource::vec, WLZ_ERR_DOMAIN_NULL, WLZ_ERR_MEM_ALLOC, WLZ_ERR_NONE, and WLZ_GMELM_EDGE_T.

◆ WlzGMModelNewV()

WlzGMVertex* WlzGMModelNewV ( WlzGMModel model,
WlzErrorNum dstErr 
)

Creates a new vertex and a vertex geometry element. The vertex geometry element only has it's index set to a meaningful value.

Returns
New vertex.
Parameters
modelModel with resources.
dstErrDestination error pointer, may be null.

References AlcVectorExtendAndGet(), _WlzGMVertexGU::core, _WlzGMVertex::geo, _WlzGMCore::idx, _WlzGMVertex::idx, _WlzGMResource::numElm, _WlzGMResource::numIdx, _WlzGMModel::res, _WlzGMCore::type, _WlzGMVertex::type, _WlzGMResource::vec, _WlzGMElemP::vertex, _WlzGMModelR::vertex, _WlzGMModelR::vertexG, WLZ_ERR_DOMAIN_NULL, WLZ_ERR_MEM_ALLOC, WLZ_ERR_NONE, WLZ_GMELM_VERTEX, and WlzGMModelGetVGeomType().

Referenced by WlzGMModelConstructSimplex3N().

◆ WlzGMModelNewVT()

WlzGMVertexT* WlzGMModelNewVT ( WlzGMModel model,
WlzErrorNum dstErr 
)

Creates a new vertex topology element.

Returns
New vertex topology element.
Parameters
modelModel with resources.
dstErrDestination error pointer, may be null.

References AlcVectorExtendAndGet(), _WlzGMVertexT::idx, _WlzGMResource::numElm, _WlzGMResource::numIdx, _WlzGMModel::res, _WlzGMVertexT::type, _WlzGMResource::vec, _WlzGMElemP::vertexT, _WlzGMModelR::vertexT, WLZ_ERR_DOMAIN_NULL, WLZ_ERR_MEM_ALLOC, WLZ_ERR_NONE, and WLZ_GMELM_VERTEX_T.

◆ WlzGMModelNewFromS()

WlzGMModel* WlzGMModelNewFromS ( WlzGMShell gS,
WlzErrorNum dstErr 
)

Creates a new model from the given shell. The new model contains a copy of the given shell.

Returns
New model.
Parameters
gSGiven shell.
dstErrDestination error pointer, may be null.

References _WlzGMShell::parent, _WlzGMModel::type, WLZ_ERR_DOMAIN_NULL, WLZ_ERR_NONE, WlzGMModelConstructS(), and WlzGMModelNew().

◆ WlzGMModelCopy()

WlzGMModel* WlzGMModelCopy ( WlzGMModel gM,
WlzErrorNum dstErr 
)

Copies the given model. Because all unused elements are squeezed out, the indicies of the elements may not be equal in the two models.

Returns
New copy of the given model.
Parameters
gMGiven model.
dstErrDestination error pointer, may be null.

References AlcVectorExtendAndGet(), AlcVectorItemGet(), _WlzGMShellG2I::bBox, _WlzGMShellG2D::bBox, _WlzGMShellG3I::bBox, _WlzGMShellG3D::bBox, _WlzGMShell::child, _WlzGMModel::child, _WlzGMElemP::core, _WlzGMVertexGU::core, _WlzGMShellGU::core, _WlzGMElemP::diskT, _WlzGMVertexT::diskT, _WlzGMVertex::diskT, _WlzGMModelR::diskT, _WlzGMResIdxTb::diskT, _WlzGMElemP::edge, _WlzGMEdgeT::edge, _WlzGMModelR::edge, _WlzGMResIdxTb::edge, _WlzGMElemP::edgeT, _WlzGMEdge::edgeT, _WlzGMLoopT::edgeT, _WlzGMModelR::edgeT, _WlzGMResIdxTb::edgeT, _WlzGMElemP::face, _WlzGMLoopT::face, _WlzGMModelR::face, _WlzGMResIdxTb::face, _WlzGMVertex::geo, _WlzGMShell::geo, _WlzGMCore::idx, _WlzGMVertexT::idx, _WlzGMVertex::idx, _WlzGMDiskT::idx, _WlzGMEdgeT::idx, _WlzGMEdge::idx, _WlzGMLoopT::idx, _WlzGMFace::idx, _WlzGMShell::idx, _WlzGMResIdx::idxLut, _WlzGMElemP::loopT, _WlzGMFace::loopT, _WlzGMModelR::loopT, _WlzGMResIdxTb::loopT, _WlzGMVertexT::next, _WlzGMVertex::next, _WlzGMDiskT::next, _WlzGMEdgeT::next, _WlzGMLoopT::next, _WlzGMShell::next, _WlzGMVertexG2N::nrm, _WlzGMVertexG3N::nrm, _WlzGMResource::numElm, _WlzGMResource::numIdx, _WlzGMEdgeT::opp, _WlzGMLoopT::opp, _WlzGMVertexT::parent, _WlzGMEdgeT::parent, _WlzGMLoopT::parent, _WlzGMShell::parent, _WlzGMVertexT::prev, _WlzGMDiskT::prev, _WlzGMEdgeT::prev, _WlzGMLoopT::prev, _WlzGMShell::prev, _WlzGMEdgeT::rad, _WlzGMModel::res, _WlzGMElemP::shell, _WlzGMModelR::shell, _WlzGMResIdxTb::shell, _WlzGMModelR::shellG, _WlzGMResIdxTb::shellG, _WlzGMElemP::shellG2D, _WlzGMElemP::shellG2I, _WlzGMElemP::shellG3D, _WlzGMElemP::shellG3I, _WlzGMCore::type, _WlzGMModel::type, _WlzGMResource::vec, _WlzGMElemP::vertex, _WlzGMDiskT::vertex, _WlzGMModelR::vertex, _WlzGMResIdxTb::vertex, _WlzGMModelR::vertexG, _WlzGMResIdxTb::vertexG, _WlzGMElemP::vertexG2D, _WlzGMElemP::vertexG2I, _WlzGMElemP::vertexG2N, _WlzGMElemP::vertexG3D, _WlzGMElemP::vertexG3I, _WlzGMElemP::vertexG3N, _WlzGMElemP::vertexT, _WlzGMDiskT::vertexT, _WlzGMEdgeT::vertexT, _WlzGMModelR::vertexT, _WlzGMResIdxTb::vertexT, _WlzGMVertexG2I::vtx, _WlzGMVertexG2D::vtx, _WlzGMVertexG2N::vtx, _WlzGMVertexG3I::vtx, _WlzGMVertexG3D::vtx, _WlzGMVertexG3N::vtx, WLZ_ERR_DOMAIN_NULL, WLZ_ERR_MEM_ALLOC, WLZ_ERR_NONE, WLZ_GMELM_SHELL_G2D, WLZ_GMELM_SHELL_G2I, WLZ_GMELM_SHELL_G3D, WLZ_GMELM_SHELL_G3I, WLZ_GMELM_VERTEX, WLZ_GMELM_VERTEX_G2D, WLZ_GMELM_VERTEX_G2I, WLZ_GMELM_VERTEX_G2N, WLZ_GMELM_VERTEX_G3D, WLZ_GMELM_VERTEX_G3I, WLZ_GMELM_VERTEX_G3N, WLZ_GMELMFLG_DISK_T, WLZ_GMELMFLG_EDGE, WLZ_GMELMFLG_EDGE_T, WLZ_GMELMFLG_FACE, WLZ_GMELMFLG_LOOP_T, WLZ_GMELMFLG_SHELL, WLZ_GMELMFLG_SHELL_G, WLZ_GMELMFLG_VERTEX, WLZ_GMELMFLG_VERTEX_G, WLZ_GMELMFLG_VERTEX_T, WlzGMModelFree(), WlzGMModelGetDimension(), WlzGMModelNew(), WlzGMModelRehashVHT(), WlzGMModelResIdx(), and WlzGMModelResIdxFree().

Referenced by WlzAffineTransformGMModel(), WlzBasisFnTransformGMModel(), and WlzCopyDomain().

◆ WlzGMModelFree()

◆ WlzGMModelFreeS()

WlzErrorNum WlzGMModelFreeS ( WlzGMModel model,
WlzGMShell shell 
)

Marks a shell and it's geometry as invalid and suitable for reclaiming.

Returns
Woolz error code.
Parameters
modelModel with resources.
shellShell to free.

References _WlzGMShell::idx, _WlzGMElemP::shell, _WlzGMModel::type, WLZ_ERR_DOMAIN_NULL, WLZ_ERR_NONE, and WlzGMModelTypeValid().

Referenced by WlzGMModelDeleteS().

◆ WlzGMModelFreeF()

WlzErrorNum WlzGMModelFreeF ( WlzGMModel model,
WlzGMFace face 
)

Marks a face as invalid and suitable for reclaiming.

Returns
Woolz error code.
Parameters
modelModel with resources.
faceFace to free.

References _WlzGMElemP::face, _WlzGMFace::idx, _WlzGMModel::type, WLZ_ERR_DOMAIN_NULL, WLZ_ERR_NONE, and WlzGMModelTypeValid().

Referenced by WlzGMModelDeleteS().

◆ WlzGMModelFreeLT()

WlzErrorNum WlzGMModelFreeLT ( WlzGMModel model,
WlzGMLoopT loopT 
)

Marks a loop topology as invalid and suitable for reclaiming.

Returns
Woolz error code.
Parameters
modelModel with resources.
loopTLoopT to free.

References _WlzGMLoopT::idx, _WlzGMElemP::loopT, _WlzGMModel::type, WLZ_ERR_DOMAIN_NULL, WLZ_ERR_NONE, and WlzGMModelTypeValid().

Referenced by WlzGMModelDeleteS().

◆ WlzGMModelFreeDT()

WlzErrorNum WlzGMModelFreeDT ( WlzGMModel model,
WlzGMDiskT diskT 
)

Marks an disk topology as invalid and suitable for reclaiming.

Returns
Woolz error code.
Parameters
modelModel with resources.
diskTDiskT to free.

References _WlzGMElemP::diskT, _WlzGMDiskT::idx, _WlzGMModel::type, WLZ_ERR_DOMAIN_NULL, WLZ_ERR_NONE, and WlzGMModelTypeValid().

Referenced by WlzGMModelDeleteS().

◆ WlzGMModelFreeE()

WlzErrorNum WlzGMModelFreeE ( WlzGMModel model,
WlzGMEdge edge 
)

Marks an edge as invalid and suitable for reclaiming.

Returns
Woolz error code.
Parameters
modelModel with resources.
edgeEdge to free.

References _WlzGMElemP::edge, _WlzGMEdge::idx, _WlzGMModel::type, WLZ_ERR_DOMAIN_NULL, WLZ_ERR_NONE, and WlzGMModelTypeValid().

Referenced by WlzGMModelDeleteS().

◆ WlzGMModelFreeET()

WlzErrorNum WlzGMModelFreeET ( WlzGMModel model,
WlzGMEdgeT edgeT 
)

Marks an edge topology as invalid and suitable for reclaiming.

Returns
Woolz error code.
Parameters
modelModel with resources.
edgeTEdgeT to free.

References _WlzGMElemP::edgeT, _WlzGMEdgeT::idx, _WlzGMModel::type, WLZ_ERR_DOMAIN_NULL, WLZ_ERR_NONE, and WlzGMModelTypeValid().

Referenced by WlzGMModelDeleteS().

◆ WlzGMModelFreeV()

WlzErrorNum WlzGMModelFreeV ( WlzGMModel model,
WlzGMVertex vertex 
)

Marks a vertex and it's geometry as invalid and suitable for reclaiming. Watch out that vertices remain in the hash table after being free'd.

Returns
Woolz error code.
Parameters
modelModel with resources.
vertexVertex to free.

References _WlzGMVertex::idx, _WlzGMModel::type, _WlzGMElemP::vertex, WLZ_ERR_DOMAIN_NULL, WLZ_ERR_NONE, and WlzGMModelTypeValid().

Referenced by WlzGMModelDeleteS().

◆ WlzGMModelFreeVT()

WlzErrorNum WlzGMModelFreeVT ( WlzGMModel model,
WlzGMVertexT vertexT 
)

Marks a vertex topology as invalid and suitable for reclaiming.

Returns
Woolz error code.
Parameters
modelModel with resources.
vertexTVertexT to free.

References _WlzGMVertexT::idx, _WlzGMModel::type, _WlzGMElemP::vertexT, WLZ_ERR_DOMAIN_NULL, WLZ_ERR_NONE, and WlzGMModelTypeValid().

Referenced by WlzGMModelDeleteS().

◆ WlzGMModelDeleteS()

◆ WlzGMModelDeleteV()

WlzErrorNum WlzGMModelDeleteV ( WlzGMModel model,
WlzGMVertex dV 
)

Deletes a vertex along with all the elements which depend on it. All elements which depend on the vertex are unlinked and then freed. If the vertex's parents were to depend only on the vertex then they would be free'd too as the Woolz geometric models can not hold an isolated vertex. The basic algorithm used is: Build a collection of edges which use the vertex and then delete all edges in the collection. If there are no edges (in the collection) then just unlink and free the vertex. The geometries of the existing and new shells will be valid on return.

Returns
Woolz error code.
Todo:
This only works for 2D models, it needs to be extend to 3D models.
Parameters
modelModel with resources.
dVThe vertex to delete.

References AlcFree(), AlcRealloc(), _WlzGMVertex::diskT, _WlzGMEdgeT::edge, _WlzGMVertex::idx, _WlzGMVertexT::next, _WlzGMDiskT::next, _WlzGMVertexT::parent, _WlzGMDiskT::vertexT, WLZ_ERR_MEM_ALLOC, WLZ_ERR_NONE, and WlzGMModelDeleteE().

◆ WlzGMModelGetDimension()

int WlzGMModelGetDimension ( WlzGMModel model,
WlzErrorNum dstErr 
)

Gets the models dimension from the model's type.

Returns
The model's dimension, either 2 or 3.
Parameters
modelThe model.
dstErrDestination error pointer, may be null.

References _WlzGMModel::type, WLZ_ERR_DOMAIN_TYPE, WLZ_ERR_NONE, WLZ_GMMOD_2D, WLZ_GMMOD_2I, WLZ_GMMOD_2N, WLZ_GMMOD_3D, WLZ_GMMOD_3I, and WLZ_GMMOD_3N.

Referenced by WlzAffineTransformGMShell(), WlzGMFilterGeomLPLM(), WlzGMModelConstructS(), WlzGMModelCopy(), WlzGMModelResIdx(), WlzGMShellSimplexCnt(), and WlzGMVertexShellDist().

◆ WlzGMModelTypeValid()

◆ WlzGMModelGetRes()

◆ WlzGMModelGetSGeomType()

WlzGMElemType WlzGMModelGetSGeomType ( WlzGMModel model)

Gets the shell's geometry type from the model's type.

Returns
Shell's geometry type.
Parameters
modelThe model.

References _WlzGMModel::type, WLZ_GMELM_NONE, WLZ_GMELM_SHELL_G2D, WLZ_GMELM_SHELL_G2I, WLZ_GMELM_SHELL_G3D, WLZ_GMELM_SHELL_G3I, WLZ_GMMOD_2D, WLZ_GMMOD_2I, WLZ_GMMOD_2N, WLZ_GMMOD_3D, WLZ_GMMOD_3I, and WLZ_GMMOD_3N.

Referenced by WlzGMModelNewS().

◆ WlzGMModelGetVGeomType()

WlzGMElemType WlzGMModelGetVGeomType ( WlzGMModel model)

Gets the verticies geometry type from the model's type.

Returns
Shell's geometry type.
Parameters
modelThe model.

References _WlzGMModel::type, WLZ_GMELM_NONE, WLZ_GMELM_VERTEX_G2D, WLZ_GMELM_VERTEX_G2I, WLZ_GMELM_VERTEX_G2N, WLZ_GMELM_VERTEX_G3D, WLZ_GMELM_VERTEX_G3I, WLZ_GMELM_VERTEX_G3N, WLZ_GMMOD_2D, WLZ_GMMOD_2I, WLZ_GMMOD_2N, WLZ_GMMOD_3D, WLZ_GMMOD_3I, and WLZ_GMMOD_3N.

Referenced by WlzGMModelNewV().

◆ WlzGMShellGetGBB3D()

◆ WlzGMShellGetGBBV3D()

WlzErrorNum WlzGMShellGetGBBV3D ( WlzGMShell shell,
double *  vol 
)

Gets the volume of the shell's geometry's bounding box.

Returns
Woolz error code.
Parameters
shellGiven shell with geometry to be set.
volGiven destination pointer for the volume.

References WLZ_ERR_NONE, WLZ_ERR_PARAM_NULL, WlzGMShellGetGBB3D(), _WlzDBox3::xMax, _WlzDBox3::xMin, _WlzDBox3::yMax, _WlzDBox3::yMin, _WlzDBox3::zMax, and _WlzDBox3::zMin.

◆ WlzGMShellGetGBB2D()

◆ WlzGMShellSetGBB3D()

◆ WlzGMShellSetGBB2D()

◆ WlzGMShellSetG3D()

WlzErrorNum WlzGMShellSetG3D ( WlzGMShell shell,
int  nPnt,
WlzDVertex3 pos 
)

Sets a shell's geometry using the pair of double precision points.

Returns
Woolz error code.
Parameters
shellGiven shell with geometry to be set.
nPntNumber of points.
posArray of points.

References _WlzDVertex3::vtX, _WlzDVertex3::vtY, _WlzDVertex3::vtZ, WLZ_ERR_NONE, WlzGMShellSetGBB3D(), _WlzDBox3::xMax, _WlzDBox3::xMin, _WlzDBox3::yMax, _WlzDBox3::yMin, _WlzDBox3::zMax, and _WlzDBox3::zMin.

◆ WlzGMShellSetG2D()

WlzErrorNum WlzGMShellSetG2D ( WlzGMShell shell,
int  nPnt,
WlzDVertex2 pos 
)

Sets a shell's geometry using the pair of double precision points.

Returns
Woolz error code.
Parameters
shellGiven shell with geometry to be set.
nPntNumber of points.
posArray of points.

References _WlzDVertex2::vtX, _WlzDVertex2::vtY, WLZ_ERR_NONE, WlzGMShellSetGBB2D(), _WlzDBox2::xMax, _WlzDBox2::xMin, _WlzDBox2::yMax, and _WlzDBox2::yMin.

◆ WlzGMModelSetSG()

WlzErrorNum WlzGMModelSetSG ( WlzGMModel model)

Sets the geometry of each of the shells in the given model.

Returns
Woolz eror code.
Parameters
modelGiven geometric model.

References AlcVectorItemGet(), _WlzGMShellG2I::bBox, _WlzGMShellG2D::bBox, _WlzGMShellG3I::bBox, _WlzGMShellG3D::bBox, _WlzGMShell::child, _WlzGMModel::child, _WlzVertexP::d2, _WlzBoxP::d2, _WlzVertexP::d3, _WlzBoxP::d3, _WlzGMVertexT::diskT, _WlzGMVertex::diskT, _WlzGMLoopT::edgeT, _WlzGMVertex::geo, _WlzGMShell::geo, _WlzVertexP::i2, _WlzBoxP::i2, _WlzVertexP::i3, _WlzBoxP::i3, _WlzGMShell::next, _WlzGMResource::numElm, _WlzGMVertexT::parent, _WlzGMEdgeT::parent, _WlzGMLoopT::parent, _WlzGMModel::res, _WlzGMShellGU::sg2D, _WlzGMShellGU::sg2I, _WlzGMShellGU::sg3D, _WlzGMShellGU::sg3I, _WlzGMModel::type, _WlzGMResource::vec, _WlzGMDiskT::vertex, _WlzGMModelR::vertex, _WlzGMDiskT::vertexT, _WlzGMEdgeT::vertexT, _WlzGMVertexGU::vg2D, _WlzGMVertexGU::vg2I, _WlzGMVertexGU::vg3D, _WlzGMVertexGU::vg3I, _WlzIVertex2::vtX, _WlzDVertex2::vtX, _WlzIVertex3::vtX, _WlzDVertex3::vtX, _WlzGMVertexG2I::vtx, _WlzGMVertexG2D::vtx, _WlzGMVertexG3I::vtx, _WlzGMVertexG3D::vtx, _WlzIVertex2::vtY, _WlzDVertex2::vtY, _WlzIVertex3::vtY, _WlzDVertex3::vtY, _WlzIVertex3::vtZ, _WlzDVertex3::vtZ, WLZ_ERR_DOMAIN_NULL, WLZ_ERR_DOMAIN_TYPE, WLZ_ERR_NONE, WLZ_GMMOD_2D, WLZ_GMMOD_2I, WLZ_GMMOD_2N, WLZ_GMMOD_3D, WLZ_GMMOD_3I, WLZ_GMMOD_3N, _WlzIBox2::xMax, _WlzDBox2::xMax, _WlzIBox3::xMax, _WlzDBox3::xMax, _WlzIBox2::xMin, _WlzDBox2::xMin, _WlzIBox3::xMin, _WlzDBox3::xMin, _WlzIBox2::yMax, _WlzDBox2::yMax, _WlzIBox3::yMax, _WlzDBox3::yMax, _WlzIBox2::yMin, _WlzDBox2::yMin, _WlzIBox3::yMin, _WlzDBox3::yMin, _WlzIBox3::zMax, _WlzDBox3::zMax, _WlzIBox3::zMin, and _WlzDBox3::zMin.

◆ WlzGMShellUpdateG3D()

◆ WlzGMShellUpdateG2D()

◆ WlzGMShellUpdateGBB3D()

◆ WlzGMShellUpdateGBB2D()

WlzErrorNum WlzGMShellUpdateGBB2D ( WlzGMShell shell,
WlzDBox2  bBox 
)

◆ WlzGMShellDndateG2D()

◆ WlzGMShellDndateG3D()

◆ WlzGMShellComputeGBB()

WlzErrorNum WlzGMShellComputeGBB ( WlzGMShell shell)

◆ WlzGMShellGInBB3D()

◆ WlzGMShellGInBB2D()

◆ WlzGMVertexSetG2D()

◆ WlzGMVertexSetG2N()

◆ WlzGMVertexSetG3D()

◆ WlzGMVertexSetG3N()

◆ WlzGMVertexGetG3D()

◆ WlzGMVertexGetG3N()

WlzErrorNum WlzGMVertexGetG3N ( WlzGMVertex vertex,
WlzDVertex3 dstPos,
WlzDVertex3 dstNrm 
)

Gets a vertex geometry into the given double precision position and normaldestination pointers. If the model vertex geometry does not have normals then the normal will be {0,0,0}, the zero vector.

Returns
Woolz error code.
Parameters
vertexGiven vertex with geometry to be set.
dstPosGiven position destination pointer, may NOT be NULL.
dstNrmGiven normal destination pointer, may NOT be NULL.

References _WlzGMVertexGU::core, _WlzGMVertex::geo, _WlzGMVertexG2N::nrm, _WlzGMVertexG3N::nrm, _WlzGMCore::type, _WlzGMVertexGU::vg2D, _WlzGMVertexGU::vg2I, _WlzGMVertexGU::vg2N, _WlzGMVertexGU::vg3D, _WlzGMVertexGU::vg3I, _WlzGMVertexGU::vg3N, _WlzIVertex2::vtX, _WlzDVertex2::vtX, _WlzIVertex3::vtX, _WlzDVertex3::vtX, _WlzGMVertexG2I::vtx, _WlzGMVertexG2D::vtx, _WlzGMVertexG2N::vtx, _WlzGMVertexG3I::vtx, _WlzGMVertexG3D::vtx, _WlzGMVertexG3N::vtx, _WlzIVertex2::vtY, _WlzDVertex2::vtY, _WlzIVertex3::vtY, _WlzDVertex3::vtY, _WlzIVertex3::vtZ, _WlzDVertex3::vtZ, WLZ_ERR_DOMAIN_NULL, WLZ_ERR_DOMAIN_TYPE, WLZ_ERR_NONE, WLZ_GMELM_VERTEX_G2D, WLZ_GMELM_VERTEX_G2I, WLZ_GMELM_VERTEX_G2N, WLZ_GMELM_VERTEX_G3D, WLZ_GMELM_VERTEX_G3I, and WLZ_GMELM_VERTEX_G3N.

◆ WlzGMVertexGetG2D()

◆ WlzGMVertexGetG2N()

WlzErrorNum WlzGMVertexGetG2N ( WlzGMVertex vertex,
WlzDVertex2 dstPos,
WlzDVertex2 dstNrm 
)

Gets a vertex geometry into the given double precision position and normal destination pointers. If the model vertex geometry does not have normals then the normal will be {0,0}, the zero vector.

Returns
Woolz error code.
Parameters
vertexGiven vertex with geometry to be set.
dstPosGiven position destination pointer, may NOT be NULL.
dstNrmGiven normal destination pointer, may NOT be NULL.

References _WlzGMVertexGU::core, _WlzGMVertex::geo, _WlzGMVertexG2N::nrm, _WlzGMVertexG3N::nrm, _WlzGMCore::type, _WlzGMVertexGU::vg2D, _WlzGMVertexGU::vg2I, _WlzGMVertexGU::vg2N, _WlzGMVertexGU::vg3D, _WlzGMVertexGU::vg3I, _WlzGMVertexGU::vg3N, _WlzIVertex2::vtX, _WlzDVertex2::vtX, _WlzIVertex3::vtX, _WlzDVertex3::vtX, _WlzGMVertexG2I::vtx, _WlzGMVertexG2D::vtx, _WlzGMVertexG2N::vtx, _WlzGMVertexG3I::vtx, _WlzGMVertexG3D::vtx, _WlzGMVertexG3N::vtx, _WlzIVertex2::vtY, _WlzDVertex2::vtY, _WlzIVertex3::vtY, _WlzDVertex3::vtY, WLZ_ERR_DOMAIN_NULL, WLZ_ERR_DOMAIN_TYPE, WLZ_ERR_NONE, WLZ_GMELM_VERTEX_G2D, WLZ_GMELM_VERTEX_G2I, WLZ_GMELM_VERTEX_G2N, WLZ_GMELM_VERTEX_G3D, WLZ_GMELM_VERTEX_G3I, and WLZ_GMELM_VERTEX_G3N.

◆ WlzGMVertexCmp3D()

◆ WlzGMVertexCmp2D()

◆ WlzGMVertexCmpSign2D()

int WlzGMVertexCmpSign2D ( WlzGMVertex vertex,
WlzDVertex2  pos 
)

Compares the coordinates of the given vertex and 2D double precision position to find a signed value for sorting.

Returns
The sign of the vertex position: -1, 0 or +1.
Parameters
vertexGiven vertex.
posGiven position.

References WLZ_GM_TOLERANCE, WlzGeomCmpVtx2D(), and WlzGMVertexGetG2D().

Referenced by WlzGMModelMatchVertexG2D().

◆ WlzGMVertexCmpSign3D()

int WlzGMVertexCmpSign3D ( WlzGMVertex vertex,
WlzDVertex3  pos 
)

Compares the coordinates of the given vertex and 3D double precision position to find a signed value for sorting.

Returns
The sign of the vertex position: -1, 0 or +1.
Parameters
vertexGiven vertex.
posGiven position.

References WLZ_GM_TOLERANCE, WlzGeomCmpVtx3D(), and WlzGMVertexGetG3D().

Referenced by WlzGMModelAddVertexToHT(), WlzGMModelMatchVertexG3D(), and WlzGMModelRemVertex().

◆ WlzGMVertexDistSq3D()

◆ WlzGMVertexNormal3D()

WlzDVertex3 WlzGMVertexNormal3D ( WlzGMModel dummy,
WlzGMVertex gV,
int *  sVBufSz,
WlzGMVertex ***  sVBuf,
WlzErrorNum dstErr 
)

Computes the value of the normal at the given vertex which lies within the given model. This function requires a buffer in which to store the vertices found on the loops surrounding the given vertex. For efficiency this can/should be reused between calls of this function.

Returns
Value of normal.
Parameters
dummyDummy model, unused.
gVGiven vertex in the model.
sVBufSzPtr to the number WlzGMVertex's that can be held in *sVBuf.
sVBufPtr to an allocated buffer for vertices, may NOT be NULL although the buffer it points to may be. The buffer should be free'd using AlcFree when it is no longer needed.
dstErrDestination error pointer, may be null.

References AlcRealloc(), _WlzGMVertexT::diskT, _WlzGMVertex::diskT, _WlzGMDiskT::next, _WlzGMEdgeT::opp, _WlzGMVertexT::parent, _WlzGMEdgeT::prev, _WlzGMEdgeT::rad, _WlzGMDiskT::vertex, _WlzGMDiskT::vertexT, _WlzGMEdgeT::vertexT, _WlzDVertex3::vtX, _WlzDVertex3::vtY, _WlzDVertex3::vtZ, WLZ_ERR_MEM_ALLOC, WLZ_ERR_NONE, WLZ_VTX_3_ADD, WLZ_VTX_3_SCALE, WlzGeomTriangleNormal(), and WlzGMVertexGetG3D().

◆ WlzGMVertexDistSq2D()

double WlzGMVertexDistSq2D ( WlzGMVertex vertex,
WlzDVertex2  pos 
)

◆ WlzGMFaceGetG3D()

WlzErrorNum WlzGMFaceGetG3D ( WlzGMFace face,
WlzDVertex3 dstPos0,
WlzDVertex3 dstPos1,
WlzDVertex3 dstPos2 
)

Gets the geometry of a face.

Returns
Woolz error code.
Parameters
faceGiven face.
dstPos0Destination pointer for first vertex geometry, must not be NULL.
dstPos1Destination pointer for second vertex geometry, must not be NULL.
dstPos2Destination pointer for third vertex geometry, must not be NULL.

References _WlzGMVertexT::diskT, _WlzGMLoopT::edgeT, _WlzGMFace::loopT, _WlzGMEdgeT::next, _WlzGMDiskT::vertex, _WlzGMEdgeT::vertexT, WLZ_ERR_NONE, WLZ_ERR_PARAM_NULL, and WlzGMVertexGetG3D().

Referenced by WlzGeoModelGridWSpSet3D().

◆ WlzGMModelMatchVertexG3D()

WlzGMVertex* WlzGMModelMatchVertexG3D ( WlzGMModel model,
WlzDVertex3  gPos 
)

Attempts to find a vertex which matches the given double precision 3D position.

Returns
Matched vertex, or NULL if no vertex with the given geometry.
Parameters
modelModel with resources.
gPosPosition to match.

References _WlzGMVertex::next, _WlzGMModel::vertexHT, _WlzGMModel::vertexHTSz, WLZ_GM_TOLERANCE, WlzGeomHashVtx3D(), and WlzGMVertexCmpSign3D().

Referenced by WlzGMModelConstructSimplex3N().

◆ WlzGMModelMatchVertexG2D()

WlzGMVertex* WlzGMModelMatchVertexG2D ( WlzGMModel model,
WlzDVertex2  gPos 
)

Attempts to find a vertex which matches the given double precision 2D position.

Returns
Matched vertex, or NULL if no vertex with the given geometry.
Parameters
modelModel with resources.
gPosPosition to match.

References _WlzGMVertex::next, _WlzGMModel::vertexHT, _WlzGMModel::vertexHTSz, WLZ_GM_TOLERANCE, WlzGeomHashVtx2D(), and WlzGMVertexCmpSign2D().

◆ WlzGMVertexShellDist()

double WlzGMVertexShellDist ( WlzGMVertex v0,
WlzGMVertex v1,
double  maxDist,
WlzErrorNum dstErr 
)

Computes the minimum distance between the two vertices where the path between them is constrained to the common shell, this will be negative if the two vertices are in different shells.

Returns
Minimum constrained distance between the vertices or a negative value if the two vertices are in different shells.
Parameters
v0First vertex.
v1Second vertex.
maxDistMaximum search distance.
dstErrDestination error pointer, may be null.

References _WlzGMShell::parent, WLZ_ERR_NONE, WLZ_ERR_PARAM_NULL, WlzGMModelGetDimension(), and WlzGMVertexCommonShell().

◆ WlzGMVerifyModel()

WlzErrorNum WlzGMVerifyModel ( WlzGMModel model,
WlzGMElemP dstElmP 
)

Verifies the given model. If the invalid element destination pointer is given then it MAY be set to point to an invalid element of the model. This function was written as an aid to debugging.

Returns
Woolz error code.
Parameters
modelGiven model.
dstElmPDestination pointer for an invalid element pointermay be NULL.

References _WlzGMModel::child, _WlzGMElemP::core, _WlzGMShell::next, _WlzGMResource::numElm, _WlzGMShell::parent, _WlzGMModel::res, _WlzGMElemP::shell, _WlzGMModelR::shell, _WlzGMShell::type, _WlzGMModel::type, WLZ_ERR_DOMAIN_NULL, WLZ_ERR_GMELM_DATA, WLZ_ERR_GMELM_NULL, WLZ_ERR_GMELM_TYPE, WLZ_ERR_NONE, WLZ_GMELM_SHELL, WlzGMModelTypeValid(), and WlzGMVerifyShell().

◆ WlzGMVerifyShell()

WlzErrorNum WlzGMVerifyShell ( WlzGMShell shell,
WlzGMElemP dstElmP 
)

Verifies the given shell. If the invalid element destination pointer is given then it MAY be set to point to an invalid element of the model. This function was written as an aid to debugging.

Returns
Parameters
shellGiven shell.
dstElmPDestination pointer for an invalid element pointer, may be NULL.

References _WlzGMShell::child, _WlzGMElemP::core, _WlzGMShell::idx, _WlzGMElemP::loopT, _WlzGMModelR::loopT, _WlzGMLoopT::next, _WlzGMShell::next, _WlzGMResource::numElm, _WlzGMLoopT::parent, _WlzGMShell::parent, _WlzGMShell::prev, _WlzGMModel::res, _WlzGMElemP::shell, _WlzGMShell::type, WLZ_ERR_DOMAIN_NULL, WLZ_ERR_GMELM_DATA, WLZ_ERR_GMELM_NULL, WLZ_ERR_GMELM_TYPE, WLZ_ERR_NONE, WLZ_GMELM_SHELL, and WlzGMVerifyLoopT().

Referenced by WlzGMVerifyModel().

◆ WlzGMVerifyLoopT()

◆ WlzGMModelFindNMEdges()

WlzGMEdge** WlzGMModelFindNMEdges ( WlzGMModel model,
int *  dstNMCnt,
WlzErrorNum dstErr 
)

Finds a loop topology element in common for the two edge topology elements.

Returns
Ptr to an array of non-manifold edge ptrs, NULL if none exist or on error.
Parameters
modelThe given model.
dstNMCntDestination pointer for number of non-manifold edges found.
dstErrDestination error pointer, may be null.

References AlcMalloc(), AlcVectorExtendAndGet(), AlcVectorFree(), AlcVectorItemGet(), AlcVectorNew(), _WlzGMModelR::edge, _WlzGMEdge::edgeT, _WlzGMEdge::idx, _WlzGMEdgeT::rad, _WlzGMModel::res, _WlzGMModel::type, _WlzGMResource::vec, WLZ_ERR_DOMAIN_TYPE, WLZ_ERR_MEM_ALLOC, WLZ_ERR_NONE, WLZ_GMMOD_2D, WLZ_GMMOD_2I, WLZ_GMMOD_2N, WLZ_GMMOD_3D, WLZ_GMMOD_3I, and WLZ_GMMOD_3N.

◆ WlzGMEdgeTCommonLoopT()

WlzGMLoopT* WlzGMEdgeTCommonLoopT ( WlzGMEdgeT eT0,
WlzGMEdgeT eT1 
)

Finds a loop topology element in common for the two edge topology elements.

Returns
Common loop topology element, NULL if it doesn't exist.
Parameters
eT0First edge topology element.
eT1Second edge topology element.

References _WlzGMEdgeT::parent.

◆ WlzGMVertexCommonEdge()

WlzGMEdge* WlzGMVertexCommonEdge ( WlzGMVertex eV0,
WlzGMVertex eV1 
)

Finds the edge common to the two given verticies.

Returns
Common edge, NULL if it doesn't exist.
Parameters
eV0First vertex element.
eV1Second vertex element.

References _WlzGMVertex::diskT, _WlzGMEdgeT::edge, _WlzGMVertexT::next, _WlzGMDiskT::next, _WlzGMVertexT::parent, and _WlzGMDiskT::vertexT.

◆ WlzGMVertexCommonShell()

WlzGMShell* WlzGMVertexCommonShell ( WlzGMVertex eV0,
WlzGMVertex eV1 
)

Finds the shell common to the two given verticies.

Returns
Common shell, NULL if it doesn't exist.
Parameters
eV0First vertex element.
eV1Second vertex element.

References WlzGMVertexGetShell().

Referenced by WlzGMVertexShellDist().

◆ WlzGMVertexGetShell()

WlzGMShell* WlzGMVertexGetShell ( WlzGMVertex eV)

Finds the parent shell of the given vertex.

Returns
The parent shell.
Parameters
eVGiven vertex element.

References _WlzGMVertex::diskT, _WlzGMVertexT::parent, _WlzGMEdgeT::parent, _WlzGMLoopT::parent, _WlzGMVertex::type, _WlzGMDiskT::vertexT, and WLZ_GMELM_VERTEX.

Referenced by WlzGMVertexCommonShell().

◆ WlzGMEdgeGetShell()

WlzGMShell* WlzGMEdgeGetShell ( WlzGMEdge eE)

Finds the parent shell of the given edge.

Returns
The parent shell.
Parameters
eEGiven edge element.

References _WlzGMEdge::edgeT, _WlzGMEdgeT::parent, _WlzGMLoopT::parent, _WlzGMEdge::type, and WLZ_GMELM_EDGE.

◆ WlzGMEdgeCommonVertex()

WlzGMVertex* WlzGMEdgeCommonVertex ( WlzGMEdge eE0,
WlzGMEdge eE1 
)

Finds the common vertex of the two given edges.

Returns
The common vertex, NULL if it doesn't exist.
Parameters
eE0First edge element.
eE1Second edge element.

References _WlzGMVertexT::diskT, _WlzGMEdge::edgeT, _WlzGMEdgeT::opp, _WlzGMDiskT::vertex, and _WlzGMEdgeT::vertexT.

◆ WlzGMEdgeCommonVertexGetDiskTs()

WlzGMVertex* WlzGMEdgeCommonVertexGetDiskTs ( WlzGMEdge eE0,
WlzGMEdge eE1,
WlzGMDiskT **  dstDT0,
WlzGMDiskT **  dstDT1 
)

Finds the common vertex of the two given edges and sets the disk topology element destination pointers if there is a common vertex. NULL*.

Returns
The common vertex, NULL if it doesn't exist.
Parameters
eE0First edge element.
eE1Second edge element.
dstDT0First diskT destination pointer, must not be NULL.
dstDT1Second diskT destination pointer, must not be NULL.

References _WlzGMVertexT::diskT, _WlzGMEdge::edgeT, _WlzGMEdgeT::opp, _WlzGMDiskT::vertex, and _WlzGMEdgeT::vertexT.

◆ WlzGMEdgeCommonDiskT()

WlzGMDiskT* WlzGMEdgeCommonDiskT ( WlzGMEdge eE0,
WlzGMEdge eE1 
)

Finds the common disk topology element of the two given edges.

Returns
The common disk topology element, NULL if it doesn't exist.
Parameters
eE0First edge element.
eE1Second edge element.

References _WlzGMVertexT::diskT, _WlzGMEdge::edgeT, _WlzGMEdgeT::opp, and _WlzGMEdgeT::vertexT.

◆ WlzGMVertexTAppend()

void WlzGMVertexTAppend ( WlzGMVertexT eVT,
WlzGMVertexT nVT 
)

Append new vertex topology element onto a doubly linked list of vertex topology element's, knowing that neither is NULL. Vertex topology elements are maintained in an unordered doubly linked list.

Returns
void
Parameters
eVTExisting vertexT in list of vertexT's.
nVTNew vertex topology element to append to list after existing element.

References _WlzGMVertexT::next, and _WlzGMVertexT::prev.

◆ WlzGMDiskTAppend()

void WlzGMDiskTAppend ( WlzGMDiskT eDT,
WlzGMDiskT nDT 
)

Append new edge topology onto a doubly linked list of disk topology element's, knowing that neither is NULL. Disk topology elements are maintained in an unordered doubly linked list.

Returns
void
Parameters
eDTExisting disk topology element in list.
nDTNew disk topology element to append to list after existing element.

References _WlzGMDiskT::next, and _WlzGMDiskT::prev.

◆ WlzGMEdgeTAppend()

void WlzGMEdgeTAppend ( WlzGMEdgeT eET,
WlzGMEdgeT nET 
)

Append new edge topology onto a doubly linked list of edge topology element's, knowing that neither is NULL. Edge topology elements are maintained in an ordered doubly linked list, CCW around the inside of loops and CW around the outside of 2D loops.

Returns
void
Parameters
eETExisting edge topology element in list.
nETNew edge topology element to append to list after existing element.

References _WlzGMEdgeT::next, and _WlzGMEdgeT::prev.

◆ WlzGMEdgeTInsert()

void WlzGMEdgeTInsert ( WlzGMEdgeT eET,
WlzGMEdgeT nET 
)

Insert new edge topology into a doubly linked list of edge topology element's, knowing that neither is NULL. Edge topology elements are maintained in an ordered doubly linked list, CCW around the inside of loops and CW around the outside of 2D loops.

Returns
void
Parameters
eETExisting edge topology element in list.
nETNew edge topology element to insert in list before existing element.

References _WlzGMEdgeT::next, and _WlzGMEdgeT::prev.

◆ WlzGMEdgeTInsertRadial()

void WlzGMEdgeTInsertRadial ( WlzGMEdgeT nET)

Inserts the given new edge topology element into a radially sorted cyclic list of edge topology element's.

Returns
void
          Inserts the given new edge topology element into a
          radially sorted cyclic list of edge topology element's.
          In 2D the radial edgeT is always the edgeT itself and
          this function should not be called.
          In 3D the radial edge is a similarly directed edge
          topology element to the given edge topology element
          who's off edge vertex is the next CCW off edge vertex
          when viewed along the edge.
*                                      O <-                       
*                                     /    \                      
*                                    /      \ Next radial edge    
*                                   /        |                    
*                                  /         |                    
*                                 X----------O                    
*                           Given edge into    Off edge vertex
*                           screen/page        of new simplex
* 
          Given a directed edge which forms part of a loop
          topology element in a new triangle simplex. Define
          points around the the simplex:
*                                O p1                                     
*                              ^ |\                                      
*                              | | \                                     
*                              | |  \                                    
*                              | |   \                                   
*                              | |    \                                  
*                          nET | |     O p2                               
*                              | |    /                                  
*                              | |   /                                   
*                              | |  /                                    
*                              | | /                                     
*                              | |/                                      
*                                O p0                                    
* 
To find the next CCW simplex. Find the normal vector:

\[ n_0 = \frac{(p_0 - p_1)}{|p_0 - p_1|} \]

Find the normal vector perpendicular to the new (triangular) simplex:

\[ n_1 = \frac{n_0(p_2 - p_0)}{|n_0(p_2 - p_0)}\]

Find the normalized vector perpendicular to \(n_0\) and \(n_1\):

\[n_2 = n_0 n_1 \]

Because \(n_1\) and \(n_2\) are perpendicular axes in the plane perpendicular to \(p_1 - p_0\) we can compute the angle of any vector projected onto the plane as:

\[ \theta = \tan^{-1}{\frac{v_i n_2}{v_i n_1}}, 0 \leq \theta \leq 2\pi \]

where

\[v_i = p_{2i} - p_0\]

and \(p_{2i}\) are the \(p_2\) verticies on the candidate face. Use the projections to find the previous radial edge, then insert the edge in the cyclic radial list.
Parameters
nETNew edge topology element to insert in list. The new edge topology element MUST have all it's fields set EXCEPT for the radial edge link.

References _WlzGMVertexT::diskT, _WlzGMEdgeT::edge, _WlzGMEdge::edgeT, _WlzGMEdgeT::next, _WlzGMEdgeT::opp, _WlzGMEdgeT::prev, _WlzGMEdgeT::rad, _WlzGMDiskT::vertex, _WlzGMEdgeT::vertexT, _WlzDVertex2::vtX, _WlzDVertex2::vtY, WLZ_VTX_3_CROSS, WLZ_VTX_3_DOT, WLZ_VTX_3_LENGTH, WLZ_VTX_3_SCALE, WLZ_VTX_3_SUB, WlzGeomTriangleSnArea2(), and WlzGMVertexGetG3D().

◆ WlzGMLoopTAppend()

void WlzGMLoopTAppend ( WlzGMLoopT eLT,
WlzGMLoopT nLT 
)

Append new loop topology onto a doubly linked list of loop topology element's, knowing that neither is NULL. Loop topology elements are maintained in an unordered doubly linked list.

Returns
void
Parameters
eLTExisting loop topology element in list.
nLTNew loop topology element to append to list after existing element.

References _WlzGMLoopT::next, and _WlzGMLoopT::prev.

◆ WlzGMLoopTUnlink()

void WlzGMLoopTUnlink ( WlzGMLoopT dLT)

Unlinks the given loop topology element from a doubly linked list of loop topology element's, knowing that it is not NULL. If this is the only loop topology element in parent the parent's list of loop topology elements is set to NULL. Other elements which point to this loop topology element are not modified.

Returns
void
Parameters
dLTLoop topology element to be unlinked.

References _WlzGMShell::child, _WlzGMLoopT::next, _WlzGMLoopT::parent, and _WlzGMLoopT::prev.

◆ WlzGMEdgeTUnlink()

void WlzGMEdgeTUnlink ( WlzGMEdgeT dET)

Unlinks the given edge topology element from it's loop topology element and it's opposite edge topology element. The opposite edge topology element MUST be unlinked before the model is valid again.

Returns
void
Parameters
dETEdge topology element to be unlinked.

References _WlzGMLoopT::edgeT, _WlzGMEdgeT::idx, _WlzGMEdgeT::next, _WlzGMEdgeT::opp, _WlzGMEdgeT::parent, and _WlzGMEdgeT::prev.

◆ WlzGMVertexTUnlink()

void WlzGMVertexTUnlink ( WlzGMVertexT dVT)

Unlinks the given vertex topology element from a doubly linked list of vertex topology element's, knowing that it is not NULL. Since the parent of a vertex topology element is always an edge topology element and an edge topology element only ever uses a single vertex topology element, set the parent's vertex topology element pointer to NULL.

Returns
void
Parameters
dVTVertex topology element to be unlinked.

References _WlzGMVertexT::diskT, _WlzGMVertexT::next, _WlzGMVertexT::parent, _WlzGMVertexT::prev, _WlzGMDiskT::vertexT, and _WlzGMEdgeT::vertexT.

◆ WlzGMDiskTUnlink()

void WlzGMDiskTUnlink ( WlzGMDiskT dDT)

Unlinks the given disk topology element from a doubly linked list of disk topology element's, knowing that it is not NULL. If this is the only disk topology element of the vertex the vertex's list of disk topology elements is set to NULL. Other elements which point to this disk topology element are not modified.

Returns
void
Parameters
dDTDisk topology element to be unlinked.

References _WlzGMVertex::diskT, _WlzGMDiskT::next, _WlzGMDiskT::prev, and _WlzGMDiskT::vertex.

Referenced by WlzGMDiskTJoin().

◆ WlzGMDiskTJoin()

void WlzGMDiskTJoin ( WlzGMDiskT gDT0,
WlzGMDiskT gDT1 
)

Joins the given pair of disk topology elements on return the first of the diskTs has all the vertexTs of both and the second of the diskTs should be free'd without being unlinked.

Returns
void
Parameters
gDT0First disk topology element.
gDT1Second disk topology element which should be free'd on return.

References _WlzGMVertexT::diskT, _WlzGMVertexT::next, _WlzGMVertexT::prev, _WlzGMDiskT::vertexT, and WlzGMDiskTUnlink().

◆ WlzGMShellAppend()

void WlzGMShellAppend ( WlzGMShell eS,
WlzGMShell nS 
)

Append new shell onto a doubly linked list of shells, knowing that neither is NULL. A model's shells are maintained in an unordered doubly linked list.

Returns
void
Parameters
eSExisting shell in list of shells.
nSNew shell to append to list after existing shell.

References _WlzGMShell::next, and _WlzGMShell::prev.

◆ WlzGMShellUnlink()

void WlzGMShellUnlink ( WlzGMShell dS)

Unlinks the given shell from a doubly linked list of shells kept by the model, knowing that the given shell ptr is not NULL.

Returns
void
Parameters
dSShell to be unlinked.

References _WlzGMModel::child, _WlzGMShell::next, _WlzGMShell::parent, and _WlzGMShell::prev.

Referenced by WlzGMModelDeleteS().

◆ WlzGMShellJoinAndUnlink()

void WlzGMShellJoinAndUnlink ( WlzGMShell eShell,
WlzGMShell dShell 
)

Joins the shell to be unlinked onto the shell that's to be extended and then unlinks (but does not free) it. Both shells must be valid.

Returns
void
Parameters
eShellShell to be extended.
dShellShell to be joined and then unlinked.

◆ WlzGMModelResIdx()

WlzGMResIdxTb* WlzGMModelResIdx ( WlzGMModel model,
unsigned int  eMsk,
WlzErrorNum dstErr 
)

Makes an index look up table data structure for the given model.

Returns
New resource index table, NULL on error.
Parameters
modelThe model with the vertex resources.
eMskElement mask with bits set for elemet resources to index.
dstErrDestination error pointer, may be null.

References AlcCalloc(), AlcVectorItemGet(), _WlzGMElemP::diskT, _WlzGMModelR::diskT, _WlzGMResIdxTb::diskT, _WlzGMElemP::edge, _WlzGMModelR::edge, _WlzGMResIdxTb::edge, _WlzGMElemP::edgeT, _WlzGMModelR::edgeT, _WlzGMResIdxTb::edgeT, _WlzGMElemP::face, _WlzGMModelR::face, _WlzGMResIdxTb::face, _WlzGMVertexG2I::idx, _WlzGMVertexG2D::idx, _WlzGMVertexG2N::idx, _WlzGMVertexG3I::idx, _WlzGMVertexG3D::idx, _WlzGMVertexG3N::idx, _WlzGMVertexT::idx, _WlzGMVertex::idx, _WlzGMDiskT::idx, _WlzGMEdgeT::idx, _WlzGMEdge::idx, _WlzGMLoopT::idx, _WlzGMFace::idx, _WlzGMShellG2I::idx, _WlzGMShellG2D::idx, _WlzGMShellG3I::idx, _WlzGMShellG3D::idx, _WlzGMShell::idx, _WlzGMResIdx::idxCnt, _WlzGMResIdx::idxLut, _WlzGMElemP::loopT, _WlzGMModelR::loopT, _WlzGMResIdxTb::loopT, _WlzGMResource::numIdx, _WlzGMModel::res, _WlzGMElemP::shell, _WlzGMModelR::shell, _WlzGMResIdxTb::shell, _WlzGMModelR::shellG, _WlzGMResIdxTb::shellG, _WlzGMElemP::shellG2D, _WlzGMElemP::shellG2I, _WlzGMElemP::shellG3D, _WlzGMElemP::shellG3I, _WlzGMModel::type, _WlzGMResource::vec, _WlzGMElemP::vertex, _WlzGMModelR::vertex, _WlzGMResIdxTb::vertex, _WlzGMModelR::vertexG, _WlzGMResIdxTb::vertexG, _WlzGMElemP::vertexG2D, _WlzGMElemP::vertexG2I, _WlzGMElemP::vertexG2N, _WlzGMElemP::vertexG3D, _WlzGMElemP::vertexG3I, _WlzGMElemP::vertexG3N, _WlzGMElemP::vertexT, _WlzGMModelR::vertexT, _WlzGMResIdxTb::vertexT, WLZ_ERR_DOMAIN_NULL, WLZ_ERR_MEM_ALLOC, WLZ_ERR_NONE, WLZ_ERR_PARAM_DATA, WLZ_GMELMFLG_DISK_T, WLZ_GMELMFLG_EDGE, WLZ_GMELMFLG_EDGE_T, WLZ_GMELMFLG_FACE, WLZ_GMELMFLG_LOOP_T, WLZ_GMELMFLG_SHELL, WLZ_GMELMFLG_SHELL_G, WLZ_GMELMFLG_VERTEX, WLZ_GMELMFLG_VERTEX_G, WLZ_GMELMFLG_VERTEX_T, WLZ_GMMOD_2D, WLZ_GMMOD_2I, WLZ_GMMOD_2N, WLZ_GMMOD_3D, WLZ_GMMOD_3I, WLZ_GMMOD_3N, WlzGMModelGetDimension(), and WlzGMModelResIdxFree().

Referenced by WlzCMeshFromGM(), and WlzGMModelCopy().

◆ WlzGMModelResIdxFree()

void WlzGMModelResIdxFree ( WlzGMResIdxTb resIdxTb)

◆ WlzGMModelRehashVHT()

WlzErrorNum WlzGMModelRehashVHT ( WlzGMModel model,
int  vHTSz 
)

◆ WlzGMModelConstructS()

WlzErrorNum WlzGMModelConstructS ( WlzGMModel cM,
WlzGMShell gS 
)

Constructs a copy of the given shell in the current model. The curent model must be of the same type as the parent of the given shell and all the usual construction restrictions apply, see WlzGMModelConstructSimplex2D().

Returns
Woolz error code.
Parameters
cMCurrent model.
gSGiven shell.

References _WlzGMShell::parent, _WlzGMModel::type, WLZ_ERR_DOMAIN_NULL, WLZ_ERR_DOMAIN_TYPE, WLZ_ERR_NONE, and WlzGMModelGetDimension().

Referenced by WlzGMModelNewFromS().

◆ WlzGMModelConstructSimplex2D()

WlzErrorNum WlzGMModelConstructSimplex2D ( WlzGMModel model,
WlzDVertex2 pos 
)

Constructs a 2D simplex (edge) defined by two double precision end points. Either of the two points may already exist within the model and the simplex must not intersect any existing simplex in the model. See WlzGMShellMatchVtxG2D() for the meaning of the backwards, forwards and distance search parameters.

Returns
Woolz error code.
Parameters
modelThe model to add the segment to.
posPointer to first then second positions.

References WLZ_ERR_NONE, and WlzGMModelConstructSimplex2N().

Referenced by WlzGetSectionFromGMModel().

◆ WlzGMModelConstructSimplex2N()

WlzErrorNum WlzGMModelConstructSimplex2N ( WlzGMModel model,
WlzDVertex2 pos,
WlzDVertex2 nrm 
)

Constructs a 2D simplex (edge) defined by two double precision end points with normal components. Either of the two points may already exist within the model and the simplex must not intersect any existing simplex in the model. See WlzGMShellMatchVtxG2D() for the meaning of the backwards, forwards and distance search parameters.

Returns
Woolz error code.
Parameters
modelThe model to add the segment to.
posPointer to first then second positions.
nrmPointer to the normal values in the same order as the positions, may be NULL.

References WLZ_ERR_NONE, WLZ_GM_TOLERANCE_SQ, and WlzGeomVtxEqual2D().

Referenced by WlzGMModelConstructSimplex2D().

◆ WlzGMModelConstructSimplex3D()

WlzErrorNum WlzGMModelConstructSimplex3D ( WlzGMModel model,
WlzDVertex3 pos 
)

Constructs a 3D simplex (triangle) defined by three double precision verticies, any of which may already exist within the model. If a new face is created then the child loopT of that face will have edgeT's that use the given vertices in their given order.

Returns
Woolz error code.
Parameters
modelThe model to add the segment to.
posPointer to triangle verticies.

References WLZ_ERR_NONE, and WlzGMModelConstructSimplex3N().

Referenced by WlzEffReadObjStl().

◆ WlzGMModelConstructSimplex3N()

WlzErrorNum WlzGMModelConstructSimplex3N ( WlzGMModel model,
WlzDVertex3 pos,
WlzDVertex3 nrm 
)

Constructs a 3D simplex (triangle) defined by three double precision verticies with normals, any of which may already exist within the model. If a new face is created then the child loopT of that face will have edgeT's that use the given vertices in their given order.

Returns
Woolz error code.
Parameters
modelThe model to add the segment to.
posPointer to triangle verticies.
nrmPointer to the normal values in the same order as the positions, may be NULL.

References WLZ_ERR_NONE, WLZ_GM_TOLERANCE_SQ, WlzGeomTriangleArea2Sq3(), WlzGMModelMatchVertexG3D(), WlzGMModelNewV(), WlzGMVertexSetG3D(), and WlzGMVertexSetG3N().

Referenced by WlzGMModelConstructSimplex3D().

◆ WlzGMModelRemVertex()

void WlzGMModelRemVertex ( WlzGMModel model,
WlzGMVertex dV 
)

Removes a vertex from the models vertex hash table. The vertex's geometry must have been set.

Returns
void
Parameters
modelThe model.
dVThe vertex to remove from the models hash table.

References _WlzGMVertex::next, _WlzGMModel::vertexHT, _WlzGMModel::vertexHTSz, WLZ_GM_TOLERANCE, WlzGeomHashVtx3D(), WlzGMVertexCmpSign3D(), and WlzGMVertexGetG3D().

Referenced by WlzAffineTransformGMShell().

◆ WlzGMModelAddVertexToHT()

void WlzGMModelAddVertexToHT ( WlzGMModel model,
WlzGMVertex nV 
)

Adds a new vertex into the models vertex hash table. The vertex's geometry must have been set.

Returns
void
Parameters
modelThe model.
nVNew vertex to insert into the models hash table.

References _WlzGMVertex::next, _WlzGMModel::vertexHT, _WlzGMModel::vertexHTSz, WLZ_GM_TOLERANCE, WlzGeomHashVtx3D(), WlzGMVertexCmpSign3D(), and WlzGMVertexGetG3D().

Referenced by WlzAffineTransformGMShell(), and WlzGMModelRehashVHT().

◆ WlzGMShellSimplexCnt()

int WlzGMShellSimplexCnt ( WlzGMShell shell)

Counts the number of simplicies in the given shell. For 2D models the simplicies are edges and for 3D models they are loops.

Returns
Number of simplicies in given shell.
Parameters
shellThe given shell.

References _WlzGMShell::child, _WlzGMEdgeT::edge, _WlzGMEdge::edgeT, _WlzGMLoopT::edgeT, _WlzGMLoopT::face, _WlzGMShell::idx, _WlzGMFace::loopT, _WlzGMEdgeT::next, _WlzGMLoopT::next, _WlzGMShell::parent, and WlzGMModelGetDimension().

Referenced by WlzGMFilterRmSmShells().

◆ WlzGeoModelGridWSpNew3D()

WlzGMGridWSp3D* WlzGeoModelGridWSpNew3D ( WlzGMModel model,
WlzGMElemType  elemType,
WlzErrorNum dstErr 
)

Makes a new cell grid for the given elelemnt type in the given 3D model. See WlzGeoModelGridWSpSet3D().

Returns
New cell grid for the model.
Parameters
modelGiven model.
elemTypeGeometric model element type for the grid of cells.
dstErrDestination error pointer, may be NULL.

References AlcCalloc(), _WlzGMGridWSp3D::elemType, _WlzGMResource::numElm, _WlzGMModel::type, WLZ_ERR_DOMAIN_DATA, WLZ_ERR_DOMAIN_NULL, WLZ_ERR_DOMAIN_TYPE, WLZ_ERR_MEM_ALLOC, WLZ_ERR_NONE, WLZ_GMMOD_3D, WLZ_GMMOD_3I, WLZ_GMMOD_3N, WlzGeoModelGridFree3D(), WlzGeoModelGridWSpSet3D(), and WlzGMModelGetRes().

◆ WlzGeoModelGridWSpSet3D()

WlzErrorNum WlzGeoModelGridWSpSet3D ( WlzGMGridWSp3D grid,
WlzGMModel model,
WlzGMElemType  elemType 
)

Populates a 3D geometric model grid workspace from the given 3D model. Currently this function has only been implimented for when geometric models elements are faces all other types will result in and unimplimented error code.

Returns
New cell grid for the model.
Parameters
gridGiven grid to populate using model.
modelGiven model.
elemTypeGeometric model element type for the grid of cells.

References Alc3Free(), ALC_ER_NONE, AlcPtr3Malloc(), AlcVectorExtendAndGet(), AlcVectorItemGet(), AlcVectorNew(), ALG_MAX3, cbrt(), _WlzGMGridWSp3D::cells, _WlzGMGridWSp3D::cellSz, _WlzGMGridWSp3D::cellVec, _WlzGMGridWSp3D::cellVecMax, _WlzGMElemP::core, _WlzGMGridWSpCell3D::elem, _WlzGMElemP::face, _WlzGMCore::idx, _WlzGMGridWSp3D::nCells, _WlzGMGridWSpCell3D::next, _WlzGMResource::numElm, _WlzGMResource::numIdx, _WlzGMGridWSp3D::org, _WlzGMModel::type, _WlzGMResource::vec, _WlzIVertex3::vtX, _WlzDVertex3::vtX, _WlzIVertex3::vtY, _WlzDVertex3::vtY, _WlzIVertex3::vtZ, _WlzDVertex3::vtZ, WLZ_ERR_DOMAIN_DATA, WLZ_ERR_DOMAIN_NULL, WLZ_ERR_DOMAIN_TYPE, WLZ_ERR_MEM_ALLOC, WLZ_ERR_NONE, WLZ_ERR_PARAM_NULL, WLZ_ERR_UNIMPLEMENTED, WLZ_GMELM_FACE, WLZ_GMMOD_3D, WLZ_GMMOD_3I, WLZ_GMMOD_3N, WlzBoundingBoxGModel3D(), WlzBoundingBoxVtx3D(), WlzGeoModelGridCellsInDBox(), WlzGeomTriangleAABBIntersect3D(), WlzGMFaceGetG3D(), WlzGMModelGetRes(), _WlzIBox3::xMax, _WlzDBox3::xMax, _WlzIBox3::xMin, _WlzDBox3::xMin, _WlzIBox3::yMax, _WlzDBox3::yMax, _WlzIBox3::yMin, _WlzDBox3::yMin, _WlzIBox3::zMax, _WlzDBox3::zMax, _WlzIBox3::zMin, and _WlzDBox3::zMin.

Referenced by WlzGeoModelGridWSpNew3D().

◆ WlzGeoModelGridFree3D()

WlzErrorNum WlzGeoModelGridFree3D ( WlzGMGridWSp3D grid)

Frees the given geometric model cell grid.

Returns
Woolz error code.
Parameters
gridGiven grid to free.

References Alc3Free(), AlcFree(), AlcVectorFree(), _WlzGMGridWSp3D::cells, _WlzGMGridWSp3D::cellVec, and WLZ_ERR_NONE.

Referenced by WlzGeoModelGridWSpNew3D().

◆ WlzGeoModelGridCellsInDBox()

WlzIBox3 WlzGeoModelGridCellsInDBox ( WlzGMGridWSp3D grid,
WlzDBox3  dBox 
)

◆ WlzGMModelCut()

WlzGMModel* WlzGMModelCut ( WlzGMModel given,
WlzGMModel knife,
WlzErrorNum dstErr 
)

Creates a new geometric model from the given model such that no elements of the given model which intersect with elements in the knife model are included. While this code seems to work for simple models errors have been seen with complex models. The code for this function and those static functions that it calls should be considered "under construction".

Returns
A new geometric model.
Parameters
givenGiven model.
knifeKnife model.
dstErrDestination error pointer, may be NULL.

References _WlzGMResource::numElm, _WlzGMModel::res, _WlzGMModel::type, _WlzGMModelR::vertex, WLZ_ERR_DOMAIN_NULL, WLZ_ERR_DOMAIN_TYPE, WLZ_ERR_NONE, WLZ_GMMOD_2D, WLZ_GMMOD_2I, WLZ_GMMOD_2N, WLZ_GMMOD_3D, WLZ_GMMOD_3I, WLZ_GMMOD_3N, and WlzGMModelNew().

◆ WlzGMModelCutDom()

WlzGMModel* WlzGMModelCutDom ( WlzGMModel given,
WlzObject knife,
WlzErrorNum dstErr 
)

Creates a new geometric model from the given model such that no elements of the given model which intersect with elements in the knife domain are included.

Returns
A new geometric model.
Parameters
givenGiven model.
knifeKnife domain object.
dstErrDestination error pointer, may be NULL.

References _WlzDomain::core, _WlzObject::domain, _WlzGMResource::numElm, _WlzGMModel::res, _WlzGMModel::type, _WlzObject::type, _WlzGMModelR::vertex, WLZ_2D_DOMAINOBJ, WLZ_3D_DOMAINOBJ, WLZ_ERR_DOMAIN_NULL, WLZ_ERR_DOMAIN_TYPE, WLZ_ERR_NONE, WLZ_ERR_OBJECT_NULL, WLZ_ERR_OBJECT_TYPE, WLZ_GMMOD_2D, WLZ_GMMOD_2I, WLZ_GMMOD_2N, WLZ_GMMOD_3D, WLZ_GMMOD_3I, WLZ_GMMOD_3N, and WlzGMModelNew().

◆ WlzGMFilterRmSmShells()

WlzErrorNum WlzGMFilterRmSmShells ( WlzGMModel model,
int  minSpx 
)

Removes small shells from the given geometric model.

Returns
Woolz error code.
Parameters
modelGiven model.
minSpxMinimum number of simplicies (edges in a 2D model or faces in a 3D model) in a shell for it to stay in the model.

References _WlzGMModel::child, _WlzGMShell::next, WLZ_ERR_DOMAIN_NULL, WLZ_ERR_NONE, WlzGMModelDeleteS(), and WlzGMShellSimplexCnt().

Referenced by WlzMatchICPCtr().

◆ WlzGMFilterGeomLP()

WlzErrorNum WlzGMFilterGeomLP ( WlzGMModel model,
double  kPB,
double  kSB,
double  dPB,
double  dSB,
int  maxItr,
int  nonMan 
)

Performs a low pass filtering operation on the geometry of the model, given the band pass and band stop filter parameters. These parameters specify the transfer function of the low pass filter.

Returns
Woolz error code.
           \li  \form#404         The band pass frequency parameter 
                                  which is the interface between the
                            pass and transition bands of the
                            filter.
           \li  \form#405           The stop band frequency parameter
                            which is the interface between the
                            transition and stop bands of the
                            filter.
           \li  \form#406   The band pass delta parameter
                            which is the maximum deviation
                            from a flat response in the band
                            pass region.
           \li  \form#407   The stop band delta parameter
                            which is the maximum deviation
                            from a flat response in the stop
                            band region.
Note
See WlzGMFilterGeomLPParam() and WlzGMFilterGeomLPLM().
Parameters
modelGiven model.
kPBThe band pass frequency parameter.
kSBThe band stop frequency parameter.
dPBThe pass band maximum deviation.
dSBThe stop band maximum deviation.
maxItrMinimum number of itterations.
nonManIf non-zero allows non manifold vertices to be filtered.

References WLZ_ERR_DOMAIN_NULL, WLZ_ERR_NONE, WlzGMFilterGeomLPLM(), and WlzGMFilterGeomLPParam().

◆ WlzGMFilterGeomLPParam()

WlzErrorNum WlzGMFilterGeomLPParam ( double *  dstLambda,
double *  dstMu,
int *  dstNItr,
double  kPB,
double  kSB,
double  dPB,
double  dSB 
)

Computes the values of \(\lambda\) and \(\mu\) from the given low pass filter parameters \(k_{PB}\), \(k_{SB}\), \(\delta_{PB}\) and \(\delta_{SB}\). Valid filter parameters require: \(0 < k_{PB} < 1\), \(k_{PB} < k_{SB} < 2\), \(0 < \delta_{PB} < 1\) and \(0 < \delta_{SB} < 1\). If the parameters are outside of these ranges an error is returned, but these constrants are not sufficient for a good filter. Design tips are don't make the transition band too narrow (keep \(k_{PB}\) away from \(k_{SB}\)) and don't make \(\delta_{PB}\) or \(\delta_{SB}\) too small (try values of 0.1 for \(\delta_{PB}\) and \(\delta_{SB}\)). Good values for \(k_{PB}\) are probably in the range \([0.01-0.1]\). The values of \(\lambda\) and \(\mu\) in the transfer function of the filter

\[ f(k) = ((1 - {\lambda}k)(1 - {\mu}k))^N \]

are constrained by:

\[ 0 < N \]

\[ 0 < \lambda < -\mu < 1 \]

\[ \lambda < \frac{1}{k_{SB}} \]

\[ \frac{1}{\lambda} + \frac{1}{\mu} = k_{PB} \]

\[ {\left(\frac{{(\lambda - \mu)}^2} {-4\lambda\mu}\right)}^N < 1 + \delta_{PB} \]

\[ {\left(\frac{1 - \lambda k_{SB}} {1 - \mu k_{SB}}\right)}^N < \delta_{SB} \]

Following Taubin's fairing paper an additional constraint is imposed \(f(1) = -f(2)\), which allows a simple algebraic solution for \(\lambda\), \(\mu\). The value of \(N\) is then computed by taking the maximum of \(N_{PB}\) and \(N_{SB}\). So the algorithm used to compute the values of \(\lambda\), \(\mu\) and \(N\) is:

\[ \lambda = \frac{1}{3 k_{PB} - 5} (k_{PB} - \sqrt{k_{PB}^2 - 6 k_{PB} + 10}) \]

\[ \mu = \frac{1}{3 k_{PB} - 5} (k_{PB} + \sqrt{k_{PB}^2 - 6 k_{PB} + 10}) \]

\[ N_{PB} = \frac{\ln{(1 + \delta_{PB})}} {\ln{({(\lambda - \mu)}^2 (-4 \lambda \mu))}} \]

\[ N_{SB} = \frac{\ln{(\delta_{SB})}} {\ln{((1 - \lambda k_{SB})(1 - \mu k_{SB}))}} \]

\[ N = \max{(N_{PB}, N_{SB})} \]

.

Returns
Woolz error code.
Note
See WlzGMFilterGeomLP() and WlzGMFilterGeomLPLM().
Parameters
dstLambdaDestination pointer for the positive scale factor, must NOT be NULL.
dstMuDestination pointer for the negative scale factor, must NOT be NULL.
dstNItrDestination pointer for the number of itterations, may be NULL.
kPBThe band pass frequency parameter.
kSBThe band stop frequency parameter.
dPBThe pass band maximum deviation.
dSBThe stop band maximum deviation.

References WLZ_ERR_NONE, and WLZ_ERR_PARAM_DATA.

Referenced by WlzCMeshLPFilter(), and WlzGMFilterGeomLP().

◆ WlzGMFilterGeomLPLM()

WlzErrorNum WlzGMFilterGeomLPLM ( WlzGMModel model,
double  lambda,
double  mu,
int  nItr,
int  nonMan 
)

Given values of \(\lambda\), \(\mu\) and the number of itterations \(N\), applies a low pass filter to the geometry of the given model.

Returns
Woolz error code.
    This filter is based on two papers by Taubin:
    \li Gabriel Taubin. Curve and Surface Smoothing without
        Shrinkage. International Conference on Computer
        Vision (ICCV'95) Conference Procedings, 827-857, 1995.
    \li Gabriel Taubin. A Signal Processing Approach to Fair
        Surface Design. Computer Graphics, 29, 351-358, 1995.

    The filter repeatedly applies a pair of filters to the
    geometry of the model vertices, of the form:

\[ {v_i}' = v_i + \lambda \Delta v_i \]

and

\[ {v_i}'' = {v_i}' + \mu \Delta {v_i}' \]

Where \(v_i\) is the geometry of the i'th vertex and \(Delta v_i\) is given by

\[ \Delta v_i = \sum_{j \in i^*}{w_{ij}(v_j - v_i)} \]

this is just the weighted sum of weighted differences between the vertex and it's first order neighbourhood, with \(i^*\) being the number of neighbours. The weights \(w_{ij}\) are computed using

\[ w_{ij} = \frac{1}{i^*} \]

If the topology of a vertex is manifold, then Taubin's filter is applied as set out in the two papers. But if the topology is non-manifold different stratagies are applied to prevent the shrinkage (in non-manifold regions) which Taubin's filter would cause.
  • For 2D models, non-manifold vertices, with either a single incident edge or more than two incident edges have their geometry preserved.
  • For 3D models, vertices on non-manifold edges only those verticies along the edge are considered to be neibours and vertices which are themselves non-manifold have their geometry preserved. The implementation of the filter makes use of a pair of buffers which contain the vertex positions during the itterations. Only when the filter has completed the itterations are the vertex hash table and shell geometries are recomputed.
Note
See WlzGMFilterGeomLP() and WlzGMFilterGeomLPParam().
Parameters
modelThe geometric model.
lambdaPositive filter parameter.
muNegative filter parameter.
nItrNumber of itterations.
nonManIf non-zero allows non manifold vertices to be filtered.

References AlcMalloc(), _WlzVertexP::v, WLZ_ERR_DOMAIN_DATA, WLZ_ERR_DOMAIN_NULL, WLZ_ERR_MEM_ALLOC, WLZ_ERR_NONE, WLZ_ERR_PARAM_DATA, WLZ_VERTEX_D2, WLZ_VERTEX_D3, WlzDVerticesFromGM(), and WlzGMModelGetDimension().

Referenced by WlzGMFilterGeomLP().

◆ WlzGMModelSpxStats()

int WlzGMModelSpxStats ( WlzGMModel model,
double *  dstMin,
double *  dstMax,
double *  dstSum,
double *  dstSumSq,
double *  dstMean,
double *  dstStdDev,
WlzErrorNum dstErr 
)

Calculates statistics of the simplices in the given geometric model. This can be useful for checking the quality of a given model.

Returns
Number of simplices in the model.
Parameters
modelGiven model.
dstMinDestination pointer for minimum simplex length or area, may be NULL.
dstMaxDestination pointer for maximum simplex length or area, may be NULL.
dstSumDestination pointer for sum of simplex length or area, may be NULL.
dstSumSqDestination pointer for sum of squares of simplex length or area, may be NULL.
dstMeanDestination pointer for mean simplex length or area, may be NULL.
dstStdDevStandard deviation of simplex length or area, may be NULL.
dstErrDestination pointer for error number, may be NULL if not required.

References AlcVectorItemGet(), _WlzVertex::d2, _WlzVertex::d3, _WlzGMVertexT::diskT, _WlzGMModelR::edge, _WlzGMEdge::edgeT, _WlzGMLoopT::edgeT, _WlzGMModelR::face, _WlzGMEdge::idx, _WlzGMFace::idx, _WlzGMFace::loopT, _WlzGMEdgeT::next, _WlzGMEdgeT::opp, _WlzGMEdgeT::prev, _WlzGMModel::res, _WlzGMModel::type, _WlzGMResource::vec, _WlzGMDiskT::vertex, _WlzGMEdgeT::vertexT, WLZ_ERR_DOMAIN_NULL, WLZ_ERR_DOMAIN_TYPE, WLZ_ERR_NONE, WLZ_GMMOD_2D, WLZ_GMMOD_2I, WLZ_GMMOD_2N, WLZ_GMMOD_3D, WLZ_GMMOD_3I, WLZ_GMMOD_3N, WLZ_VTX_2_SQRLEN, WLZ_VTX_2_SUB, WlzGeomTriangleArea2Sq3(), WlzGMVertexGetG2D(), and WlzGMVertexGetG3D().