Woolz Image Processing  Version 1.7.5
WlzMeshUtils.c File Reference

Utility functions for manipulating Woolz mesh transforms. More...

Data Structures

struct  _WlzMeshIntVec
 
struct  _WlzMeshEar
 
struct  _WlzMeshEarList
 

Typedefs

typedef struct _WlzMeshIntVec WlzMeshIntVec
 
typedef struct _WlzMeshEar WlzMeshEar
 
typedef struct _WlzMeshEarList WlzMeshEarList
 

Functions

static void WlzMeshElemReplace1With1 (WlzMeshTransform *mesh, int eId0, int eId1)
 Replaces a single mesh element with another mesh element. More...
 
static void WlzMeshElemReplace1With2 (WlzMeshTransform *mesh, int eId, int nod0, WlzDVertex2 newVx, unsigned int nodeFlags)
 Replaces a single mesh element with 2 mesh elements, (1 new and 1 recycled) which include the given new node vertex. More...
 
static void WlzMeshElemReplace1With3 (WlzMeshTransform *mesh, int eId, WlzDVertex2 newVx, unsigned int nodeFlags)
 Replaces a single mesh element with 3 mesh elements, (2 new and 1 recycled) which include the given new node vertex. More...
 
static void WlzMeshEarPowerSet (WlzMeshTransform *mesh, WlzMeshEar *ear, int delNodId)
 Computes a power for the given ear, where the power is given by:

\[ \frac { \left| \begin{array}{cccc} x_o & x_1 & x_2 & x_3 \\ y_0 & y_1 & y_2 & y_3 \\ x_0^2 + y_0^2 & x_1^2 + y_1^2 & x_2^2 + y_2^2 & x_p^2 + y_p^2 \\ 1 & 1 & 1 & 1 \end{array} \right| } { \left| \begin{array}{ccc} x_0 & x_1 & x_2 \\ y_0 & y_1 & y_2 \\ 1 & 1 & 1 \end{array} \right| } \]

Where the given (CCW order) nodes are (x0,y0), (x1,y1) and (x2,y2). The node to be deleted is (xp, yp). In practice this function first checks that the nodes are not co-linear, then that the nodes are CCW and if all ok so far then computes the power. More...

 
static void WlzMeshEarMatchElm (WlzMeshTransform *mesh, WlzMeshEar *ear, WlzMeshIntVec *elmVec, int *elmVecIdP)
 Finds the indicies into the given element vector for the elements which connect to the given ear and sets the ear's neighbours and flags. More...
 
static void WlzMeshNodeDelInit (WlzMeshIntVec *elmVec, WlzMeshIntVec *nodVec, WlzMeshEarList *earList)
 Initialize the element vector, node vector and ear list ready for node deletion. More...
 
static void WlzMeshNodeDelFree (WlzMeshIntVec *elmVec, WlzMeshIntVec *nodVec, WlzMeshEarList *earList)
 Free storage allocated for the element vector, node vector and ear list after node deletion. More...
 
static WlzErrorNum WlzMeshNodeDel (WlzMeshTransform *mesh, WlzMeshIntVec *elmVec, WlzMeshIntVec *nodVec, WlzMeshEarList *earList, int startElm, WlzDVertex2 nodVx)
 Deletes a node, specified by it's position, from the given mesh. More...
 
static WlzErrorNum WlzMeshIDomAdd (WlzMeshTransform *mesh, WlzObject *obj, double minDistSq, WlzDVertex2 scaleVx)
 Adds mesh nodes within the interval domain of the given 2D domain object. More...
 
static WlzErrorNum WlzMeshPolyDomAdd (WlzMeshTransform *mesh, WlzObject *obj, double minDist, WlzDVertex2 scaleVx)
 Adds mesh nodes along the polygon domain of the given 2D domain object. More...
 
static WlzErrorNum WlzMeshElemFindVxWalk (WlzMeshTransform *mesh, WlzDVertex2 gVx, int *elmId, int *foundFlg, int *existsFlg)
 Searches the mesh for the element which contains the given vertex. Walks from the given element in the direction of the given vertex until the element which encloses the given vertex is found. If the walk oscillates back and forth between two elements then either may be returned as the enclosing element. More...
 
static WlzErrorNum WlzMeshQueConflictElem (WlzMeshIntVec *eCnfQVec, WlzMeshTransform *mesh, int srcElmId, int elmId, WlzDVertex2 newVx)
 Recursively builds a que of elements in conflict with the given new node vertex, all elements in conflict being marked using a flag. An element is in conflict with a new node vertex if the new node lies within the circumcircle of the element. More...
 
static WlzErrorNum WlzMeshElemReplaceN (WlzMeshTransform *mesh, int *eCnfQ, int qCnt, WlzDVertex2 newVx, unsigned int nodeFlags)
 Replaces those mesh elements that are queued and flaged as zombies with new mesh elements which include the given new node vertex. More...
 
static WlzErrorNum WlzMeshElemReplace1 (WlzMeshTransform *mesh, int eId, WlzDVertex2 newVx, unsigned int nodeFlags)
 Replaces a single mesh element with 1 element (no action), 2 elements (1 new and 1 recycled) or 3 elements (2 new and 1 recycled) using the new node to split the element. More...
 
static WlzErrorNum WlzMeshElemReplaceNWithN (WlzMeshTransform *mesh, int *zElmIdVec, int zElmCnt, WlzDVertex2 newVx, unsigned int nodeFlags)
 Replaces all queued mesh elements (which always have a convex hull) with elements that use the new node vertex. This function is only ever called with more than one mesh element enqueued. Computing the number of nodes in the enqueued elements is easy because the region is always convex with all it's nodes on it's boundary. Every triangulation of a polygon with N nodes has N - 2 elements. More...
 
static WlzErrorNum WlzMeshNodeDelVecBuild (WlzMeshIntVec *elmVec, WlzMeshIntVec *nodVec, WlzMeshTransform *mesh, int dElmId, int dElmNodId)
 Builds a vector of the id's of all the mesh elements which include given the node (to be deleted), and a vector to the id's of all the mesh nodes which lie around the perimeter of the polygon formed by the vector of elements. The element and node vectors are in ccw order around the given node. The vector of nodes does not include the given node. All the elements in the vector are marked as zombies ready for recycling. More...
 
static WlzErrorNum WlzMeshEarsCreate (WlzMeshEarList *earList, WlzMeshIntVec *elmVec, WlzMeshIntVec *nodVec, WlzMeshTransform *mesh, int delNodId)
 Creates a list of mesh ears from a vector of nodes and the node to be deleted. The list is in the order of given nodes, ie CCW around the node to be deleted. More...
 
static WlzErrorNum WlzMeshEarListRealloc (WlzMeshEarList *earList, int maxEars)
 Realloc's a mesh ear list pool. More...
 
WlzErrorNum WlzMeshDomainAdd (WlzMeshTransform *mesh, WlzObject *obj, double minDist, WlzDVertex2 scaleVx)
 Adds mesh nodes within the domain of the given 2D domain object. More...
 
WlzErrorNum WlzMeshVxVecAdd (WlzMeshTransform *mesh, WlzDVertex2 *vxVec, int nVx, double minDistSq, unsigned int nodeFlags)
 Adds mesh nodes at the vertices of the given (2D) vertex vector. More...
 
WlzErrorNum WlzMeshElemVerify (WlzMeshTransform *mesh, int dispFlg, WlzMeshElem *elm, WlzMeshError *dstErrMsk)
 Checks that the given mesh transform is valid. More...
 
WlzErrorNum WlzMeshExpand (WlzMeshTransform *mesh, int nElem, int nNodes)
 Expands a mesh to make sure that there are enough mesh elements and nodes available. More...
 
WlzErrorNum WlzMeshSqueeze (WlzMeshTransform *mesh)
 Squeeze out any zombie nodes and/or elements so that they are available for reuse. More...
 
int WlzMeshElemNodeIdxFromVx (WlzMeshTransform *mesh, WlzMeshElem *elm, WlzDVertex2 gVx)
 Finds which of the given elements nodes are coincident with the given vertex. More...
 
int WlzMeshElemNodeIdxFromNodeIdx (int *nodes, int mNodId)
 Finds which of the given ear/element nodes has the given mesh node index. More...
 
int WlzMeshElemNbrIdxFromNodes (WlzMeshElem *elm, int nodId0, int nodId1)
 Finds which neighbour of the given element would share the nodes has the given pair of nodes. More...
 
int WlzMeshElemFindVx (WlzMeshTransform *mesh, WlzDVertex2 gvnVx, int startElm, int *lastElm, int *existsFlg, WlzErrorNum *dstErr)
 Searches the mesh for the element which contains the given vertex. It is NOT an error if the vertex is not within the mesh. More...
 
WlzErrorNum WlzMeshElemSplit (WlzMeshTransform *mesh, int sElmId)
 Splits the given mesh element by placing a new node at it's circumcentre. More...
 
WlzErrorNum WlzMeshNodeAdd (WlzMeshTransform *mesh, int startElm, WlzDVertex2 newVx, unsigned int nodeFlags)
 Adds a node to the given mesh, the new node must lie inside the existing mesh. More...
 
WlzErrorNum WlzMeshNodeDelIdx (WlzMeshTransform *mesh, int startElm, int *nodIdP, int nNod)
 Deletes nodes, specified by their index, from the given mesh. More...
 
WlzErrorNum WlzMeshGetNodesAndEdges (WlzMeshTransform *mesh, int *dstNNod, WlzDVertex2 **dstNod, int *dstNDsp, WlzDVertex2 **dstDsp, int *dstNEdg, int **dstEdg)
 Gets the nodes, node displacements and edges of the mesh. The nodes and node displacements are returned as simple arrays of vertices. The edges are returned as a degenerate list of triples, with each triple being the indices of the nodes of an element. More...
 
double WlzMeshMaxEdgeLenSq (WlzMeshTransform *mesh, WlzErrorNum *dstErr)
 Computes the maximum squared edge length of the mesh elements. More...
 
int WlzMeshClosestNod2D (WlzMeshTransform *mesh, WlzDVertex2 pos)
 Finds the closest node in the mesh to the given vertex position. More...
 

Detailed Description

Utility functions for manipulating Woolz mesh transforms.

Author
Bill Hill
Date
March 1999
Version
Id
47bb34c82720e9b54e6829a4e0ba6b1aa3138ef4
Address: MRC Human Genetics Unit, MRC Institute of Genetics and Molecular Medicine, University of Edinburgh, Western General Hospital, Edinburgh, EH4 2XU, UK.
Copyright (C), [2012], The University Court of the University of Edinburgh, Old College, Edinburgh, UK.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Typedef Documentation

typedef struct _WlzMeshIntVec WlzMeshIntVec
typedef struct _WlzMeshEar WlzMeshEar