Woolz Image Processing Version 1.4.0
WlzConvexHull

Data Structures

struct  _WlzChord
 A cord described by the equation:

\[ c = a x - b y \]

Typedef: WlzChord. More...

struct  _WlzConvHullValues
 A 2D convex hull. Typedef: WlzConvHullValues. More...

Files

file  WlzConvexHull.c
 

Functions for computing the convex hull of objects.


file  WlzConvexHullClarkson.c
 

Functions to compute convex hulls using the Clarkson's algorithm.


file  WlzMwrAngle.c
 

Computes the minimum width rectangle from a convex hull.


Functions

WlzObjectWlzObjToConvexHull (WlzObject *obj, WlzErrorNum *dstErr)
 Computes the convex hull of the given object.
WlzObjectWlzObjToConvexPolygon (WlzObject *obj, WlzErrorNum *dstErr)
 Construct the minimal convex polygonal cover from interval domain.
int WlzConvHullClarkson2D (WlzDVertex2 *vtx, int n, int **dstIdx, WlzErrorNum *dstErr)
 Computes the convex hull of a given array of vertices which is returned as an array of indices into the array of vertices. This index array should be freed using AlcFree(). The vertex array is not changed.
double WlzMwrAngle (WlzObject *cvh, WlzErrorNum *dstErr)
 extract angle (as scaled sin, cos) of minimum width rectangle from convex hull (it is relatively obvious that minimum width rectangle long side must be parallel to a chord of convex hull, and all sides must have at least one vertex of convex hull lying within them).

Function Documentation

WlzObject* WlzObjToConvexHull ( WlzObject obj,
WlzErrorNum dstErr 
)

Computes the convex hull of the given object.

Returns:
Convex hull object, NULL on error.
Parameters:
objGiven object.
dstErrDestination error pointer, may be NULL.

References _WlzValues::c, _WlzObject::domain, _WlzDomain::p, _WlzPlaneDomain::type, _WlzObject::type, _WlzObject::values, WLZ_2D_POLYGON, WLZ_3D_DOMAINOBJ, WLZ_CONV_HULL, WLZ_ERR_NONE, WLZ_PLANEDOMAIN_CONV_HULL, WlzAssignValues(), and WlzObjToConvexPolygon().

int WlzConvHullClarkson2D ( WlzDVertex2 vtx,
int  n,
int **  dstIdx,
WlzErrorNum dstErr 
)

Computes the convex hull of a given array of vertices which is returned as an array of indices into the array of vertices. This index array should be freed using AlcFree(). The vertex array is not changed.

Returns:
Number of vertices in the convex hull or zero on error.
Parameters:
vtxGiven array of vertices.
nNumber of vertices in the given array.
dstIdxDestination pointer for array of indices to the convex hull vertices. The convex hull vertices are ordered counter-clockwise.
dstErrDestination error pointer, may be NULL.

References AlcFree(), AlcMalloc(), WLZ_CONVHULL_CLARKSON_SM_2D, WLZ_ERR_MEM_ALLOC, WLZ_ERR_NONE, WLZ_ERR_PARAM_DATA, and WLZ_ERR_PARAM_NULL.

Referenced by WlzGeomInterpolatePoly2D().

double WlzMwrAngle ( WlzObject cvh,
WlzErrorNum dstErr 
)

extract angle (as scaled sin, cos) of minimum width rectangle from convex hull (it is relatively obvious that minimum width rectangle long side must be parallel to a chord of convex hull, and all sides must have at least one vertex of convex hull lying within them).

Returns:
angle of the minimum width rectangle
Parameters:
cvhinput convex hull
dstErrdestination error

References _WlzChord::acon, _WlzChord::bcon, _WlzValues::c, _WlzConvHullValues::ch, _WlzObject::domain, _WlzConvHullValues::nchords, _WlzDomain::poly, _WlzObject::type, _WlzObject::values, WLZ_CONV_HULL, WLZ_EMPTY_OBJ, WLZ_ERR_NONE, WLZ_ERR_OBJECT_NULL, and WLZ_ERR_OBJECT_TYPE.