DM_make_circ_curve
List of: Functions
Subjects: DML Create and Query, Deformable Modeling
Contents: Standalone Deformable Modeling

Action: Creates a circular curve and returns a pointer to DS_pfunc circular curve or NULL.

Prototype: DS_pfunc* DM_make_circ_curve (


int& rtn_err, // rtn: ptr to DS_pfunc




// circ curve or NULL




// eff: make crv




// W=xc+xa*cos(s)




// +xb*sin(s) with




// 0 <= s <= 2 pi




// out: 0=success or




// negative err code


int image_dim, // in: image space size




// (2=2d,3=3d)


double* dof_vec, // in: the 3 dofs




// [xc,xa,xb].




// [not-nested]




// xc = center_point




// xa = vec from




// center_pt to axis_1




// xb = vec from




// center_pt to axis_2




// Sets dof_def = dof_vec




// sized:[3*image_dim]


double u_min // in: domain min



= 0.0, // 0 <= u_min <= 2*DS_PI


double u_max // in: domain max


= 2* 3.1415926535898, // 0 <= u_max <= 2*DS_PI




// note: the input array




// values are only




// copied. The calling




// program still needs to




// manage that memory.


SDM_options* sdmo // in:SDM_options pointer



= NULL //




// note: the input array




// values are only




// copied. The calling




// program still needs to




// manage that memory.


);

Includes: #include "kernel/acis.hxx"

#include "dshusk/dskernel/dspfunc.hxx"

#include "dshusk/dskernel/dmapi.hxx"

#include "dshusk/dskernel/sdm_options.hxx"

Description: This function returns a pointer to the allocated and initialized memory used to represent a circular curve as a DS_pfunc description and sets the rtn_err as described below. Call DM_delete_pfunc() on the returned pointer to free its memory.


The circular curve represents complete or arc fragments of circles and ellipses in the form used by the deformable modeling package.


W = W(s) = xc + xa*cos(s) + xb*sin(s)


0 <= u_min <= s <= u_max <= 2 pi


The curve has three dofs including


xc = the center-point of the curve,

xa = the vector from the center-point to the end-point of axis 1,

xb = the vector from the center-point to the end-point of axis 2,


Note that xa and xb are 2D vectors and not 2D points, i.e., the end points of the ellipse vectors are computed by:



end_point_axis_1 = xc + xa, and


end_point_axis_2 = xc + xb.


When

xa = {r, 0} and xb = {0, r} we get a circle

xa = {r1,0} and xb = {0,r2} we get an ellipse.


When the vectors xa and xb equal each other the circular curve degenerates into a double line segment. This will not bother the deformable modeling package but may confuse the end user and is therefore prohibited. image_dim is the size of the model space. Use 2 for 2D and 3 for 3D.


When u_min equals 0 and u_max equals 2*DS_PI, the circle or ellipse is a complete closed curve. Any other values for u_min and u_max make a circular or elliptical arc fragment.


dof_vec is an array of [xc,xa,xb]. It is sized 3*image_dim, where a 2D circ dof_vec array is organized as [Xxc, Yxc, Xxa, Yxa, Xxb, Yxb].


mallocs is the calling program needs to call DM_delete_pfunc on the returned pointer. The new data structure does not reference the input arrays after this call.


Returns pointer to DS_pfunc when successful or NULL when a problem is encountered in the input.

Errors: DM_BAD_IMAGE_DIM_VALUE

The input value of the image dimension must be positive.



DM_NULL_INPUT_PTR

The dof_vec pointer cannot be NULL on input.



DM_BAD_ELEM_COUNT_VALUE

The elem_count must be greater than DS_DEFAULT_ELEM_COUNT.



DM_BAD_NTGRL_DEGREE_VALUE

The required gauss integration degree is not supported. Currently limited to the range 1 to 79. The ntgrl_degree must be equal to or larger than the DS_DEFAULT_NTGRL_DEGREE for valid deformations.



DM_BAD_CIRC_SHAPE

The xa and xb vectors cannot be parallel or of zero length which would create a circular curve with no internal area.



DM_BAD_CIRC_PARAM_VALUE

Input u_min and u_max values must be in the range of 0 to 2*DS_PI.

Library: dshusk

Filename: ds/dshusk/dskernel/dmapi.hxx

Effect: Changes model
PDF/DS/05FNJ.PDF
HTM/DATA/DS/DS/05FNJ/0006.HTM