pcurve
List of: Classes
Subjects: Construction Geometry, SAT Save and Restore
Contents: Kernel

Purpose: Defines a 2D curve defined in the parameter space of a parametric surface.

Derivation: pcurve : ACIS_OBJECT : -

Filename: kern/kernel/kerngeom/pcurve/pcudef.hxx

Description: The pcurve class represents parameter-space curves that map an interval of the real line into a 2D real vector space (parameter space). This mapping is continuous, and one-to-one except possibly at the ends of the interval whose images may coincide. It is differentiable twice, and the direction of the first derivative with respect to the parameter is continuous. This direction is the positive sense of the curve.


A parameter-space curve is always associated with a surface, that maps the parameter-space image into 3D real space (object space); therefore, the two mappings together can be considered to be a single mapping from a real interval into object space. Most of the properties of a parameter-space curve relate in fact to this combined mapping.


If the two ends of the curve are different in object space, the curve is open. If they are the same, it is closed. If the curve joins itself smoothly, the curve is periodic, with its period being the length of the interval that it is primarily defined. A periodic curve is defined for all parameter values, by adding a multiple of the period to the parameter value so the result is within the definition interval, and evaluating the curve at that resultant parameter. The point at the ends of the primary interval is known as the seam. If the surface is periodic, a closed or periodic parameter-space curve cannot in fact be closed in parameter space, but its end values can differ by the surface parameter period in one or both directions.


Also, a parameter-space curve is always associated with an object-space curve lying in (or fitted to) the surface. This curve is used to assist in the determining of the surface parameter values corresponding to object-space points on the 3D curve, by using the parameter value on the 3D curve to evaluate the 2D curve for an approximation to the surface parameter values for iterative refinement. For this reason, a parameter-space curve must always have the same parameter range as its associated object-space curve, and its internal parameterization must be similar, though not necessarily identical, to that of the object-space curve. A parameter-space curve can have the same sense as its associated object-space curve, or be opposite. In the latter case, the parameterization is negated one to the other.


In general, it is not necessary to have u or v continuity between two pcurves on a periodic face or on a singular face, because evaluation of a parameter value outside the parameter range is mapped back into the evaluation range by adding or subtracting the period from the parameter value to be evaluated (periodic face), or by adding or subtracting the parameter value changes while the actual 3-space location is coincident (singular face).


In the case of a spline converted sphere, face 0 ranges from u = -pi/2 to pi/2 and v = 0 to pi; face 1 ranges from u = -pi/2 to pi/2 and v = pi to 2*pi. Coedges 0 and 2 belong to face 0, so their param ranges should match the corresponding face param ranges. Coedge 0 has param values: u = -pi/2 to pi/2 and v = 0. Coedge 2 has param values: u = pi/2 to -pi/2 and v = pi.


The param values are correct, because Coedge 0 travels from top vertex to bottom vertex, and Coedge 2 travels from bottom vertex to top vertex on the sphere; as a result, u values are continuous (-pi/2 to pi/2 and pi/2 to -pi/2) moving along Coedge 0, onto Coedge 2, and along Coedge 2. For the V direction (since face 0 is singular in v), v ranges from 0 to pi along both singular poles of the hemispherical face, so v value may be any value between 0 and pi for the given u param values, and should still evaluate to the same 3-space point; at u = -pi/2 or u = pi/2, all v values map to (0, 0, 20) and (0, 0, -20) respectively. Since the pcurves map to surface param values, they could use any value at endpoints. However, since pcurve 0 must travel along entire edge of face 0, the v value must be pi along the entire length of pcurve 0 (only valid value at u values not at singularity points in v). Similarly, pcurve 2 must have v value of 0 along entire length of pcurve 2. Transition from pcurve 0 to pcurve 2 is, then, continuous in u, and discontinuous in v, but discontinuity in v matches singularity in v at poles of hemispherical face 0; in addition, evaluation of any value of v (0 to pi) at poles gives correct 3-space position. Similar discussion results if data for Coedge 1 and 3 is examined.


A pcurve consists of pointer to a par_cur that holds the data defining the 2D parameter space curve and a logical flag indicating reversal of the pcurve from the underlying spline curve. In addition, a parameter space vector is stored that represents the displacement of this pcurve in the parameter space of the surface the pcurve lies in. By having a nonzero vector for a periodic surface, a continuous sequence of object space curves (3D curves) can have a continuous sequence of parameter space curves (2D curves).


The par_cur in turn consists of a pointer to a bs2_curve (a 2D spline curve), a fitting tolerance, and a pointer to the surface where the parameter space curve lies.

References: KERN par_cur

by KERN BDY_GEOM_CIRCLE, BDY_GEOM_PCURVE, PCURVE, exp_par_cur, imp_par_cur, law_par_cur, par_cur, par_int_interp, pcur_int_cur, pcurve_law_data, skin_spl_sur, stripc, surf_surf_int

BASE SPApar_vec

Constructor: public: pcurve::pcurve ();


C++ allocation constructor requests memory for this object but does not populate it.






public: pcurve::pcurve (


law*, // law


double, // start parameter


double, // end parameter


surface const&, // surface


double // fit tolerance



= SPAresabs,


bs2_curve // underlying curve



= NULL


);


C++ allocation constructor requests memory for this object but does not populate it.






public: pcurve::pcurve (


bs2_curve, // underlying bs2 curve


double, // parameter


surface const&, // surface


int
// knots on curve



= -1, // default is unknown


int
// bs2_curve hull



= -1, // contains true curve


int
// hull angles ok



= -1, // default is unknown


int
// hull self intersects



= -1 // default is unknown


);


C++ initialize constructor requests memory for this object and populates it with the data supplied as arguments.


Creates a pcurve as a bs2_curve in the parameter-space of a surface and having a specified fit tolerance.






public: pcurve::pcurve (


curve const&, // curve name


surface const&, // surface name


double // parameter


);


C++ initialize constructor requests memory for this object and populates it with the data supplied as arguments.


Creates a pcurve fitting it to the given object-space curve lying on the given surface.






public: pcurve::pcurve (


intcurve const&, // intcurve name


int
// integer


);


C++ initialize constructor requests memory for this object and populates it with the data supplied as arguments.






public: pcurve::pcurve (


par_cur* // parameter curve


);


C++ initialize constructor requests memory for this object and populates it with the data supplied as arguments.


Creates a pcurve by promoting a par_cur to a full pcurve.






public: pcurve::pcurve (


pcurve const& // parameter curve


);


C++ copy constructor requests memory for this object and populates it with the data from the object supplied as an argument.






public: pcurve::pcurve (


logical, // u direction flag


double, // parameter


surface const&, // surface


curve const& // curve



= *(curve*) NULL_REF


);


C++ initialize constructor requests memory for this object and makes an iso pcurve (uses the curve if supplied).




Destructor: public: pcurve::~pcurve ();


C++ destructor, deleting a PCURVE.



Methods: public: int pcurve::accurate_knot_tangents () const;


Returns 1 if the bs2_curve tangents are within SPAresnor of the true curve tangent vectors at all of the knots that lie within the checked_range, or 0 if this is not satisfied. Returns -1 if this property has not yet been checked.






public: int pcurve::add_bs2_knot (


double new_knot_param,

// knot to add


int mult,

// multiplicity


SPApar_pos& new_knot_uv

// knot uv



= * (SPApar_pos* ) NULL_REF,


SPApar_vec& new_knot_deriv_below// derivative



= * (SPApar_vec* ) NULL_REF,


SPApar_vec& new_knot_deriv_above// derivative



= * (SPApar_vec* ) NULL_REF


);


Adds a knot to the bs2_curve with the supplied multiplicity. If the new SPApar_pos and derivative vectors are supplied, set the new control points so that the bs2_curve has the supplied position and derivatives at the new knot. Return the multiplicity of the new knot. It is assumed that the caller will take care of any changes in the underlying par_cur properties, (self intersection, for example), that the addition of knots generates.






public: void pcurve::add_knots_at_discontinuities (


const curve* cu, // curve


int num_knots // number of knots



= 0,


double* knots // knots



= NULL


);


Adds knots to the pcurve's bs2_curve, at any of the corresponding curve discontinuities. The pcurve knots can be supplied to this function in an array, but if they are not, they will be extracted from the pcurve.






public: int pcurve::bezier_form ();


Returns 1 if the underlying bs2_curve is known to be Bezier form, and 0 if it is not in this form, and -1 if this property has not yet been checked.






public: SPApar_box pcurve::bound (


double, // first parameter


double, // second parameter


const curve* true_cu // curve



= NULL


) const;


Returns a box around the curve.






public: SPApar_box pcurve::bound (


SPAinterval const&, // interval name


const curve* true_cu // curve



= NULL


) const;


Returns a box around the curve.






public: SPAinterval pcurve::checked_range () const;


Returns the range over which checking occurs.






public: logical pcurve::check_bezier_form ();


Checks if the underlying bs2_curve is in Bezier form.






public: logical pcurve::check_hull_curve_enclosure (


const curve* true_cu, // curve


BOUNDED_SURFACE* bsf // bounded surface



= NULL,


int deg // degree



= 0,


int num_knots // number of knots



= 0,


double* knots // knots



= NULL,


int num_ctrlpts // number of control



= 0, // points


SPApar_pos* ctrlpts // control points



= NULL


);


Checks if the pcurve bs2_curve hull contains the bounded true curve, and if not, to find the 2-space distance that the true curve moves outside the hull by. The bounded surface, degree, knots, and control points can be supplied to this function in an array, but if they are not, they will be extracted from the underlying par_cur. The function returns TRUE if the hull contains the true curve, or FALSE otherwise.






public: logical pcurve::check_hull_intersection (


int deg // degree



= 0,


int num_knots // number of knots



= 0,


double* knots // knots



= NULL,


int num_ctrlpts // number of control



= 0, // points


SPApar_pos* ctrlpts // control points



= NULL


);


Checks if the convex hull of a pcurve self-intersects. The degree and control points can be supplied to this function in an array, but if they are not, they will be extracted from the underlying par_cur. The function returns TRUE if the hull self-intersects, or FALSE otherwise.






public: logical pcurve::check_hull_turning_angle (


const curve* true_cu, // curve


BOUNDED_SURFACE* bsf, // bounded surface


int deg, // degree


int& num_knots, // number of knots


double*& knots, // knots


int& num_ctrlpts, // number of control




// points


SPApar_pos*& ctrlpts // control points


);


Checks that the pcurve bs2_curve hull does not turn by more than the minimum turning angle. If it does, then the hull points are projected onto a parameter line and the order of the points is checked, to test if the pcurve has kinked. The bounded surface and the knots and control points can be supplied to this function, or if they are NULL, they will be extracted from the underlying par_cur. If the number of knots and control points, and the knot and control point arrays are supplied, these are supplied as references, as more knots and control points may be added to correct the hull. If the true curve is supplied, this is used to find the positions for any new knots that are added to the bs2_curve. The function returns TRUE if the hull does not turn by more than the defined minimum angle, or FALSE otherwise.






public: logical pcurve::check_knots_on_true_curve (


const curve* true_cu, // curve


BOUNDED_SURFACE* bsf, // bounded surface


int deg, // degree


int& num_knots, // number of knots


double*& knots // knots


);


Checks that all the knots of the pcurve bs2_curve lie on the supplied true curve. The bounded surface and the knots can be supplied to this function, but if they are not, they will be extracted from the underlying par_cur. If the number of knots and the knot array is supplied, these are supplied as references, as more knots may be added to correct the hull. The function returns TRUE if all of the knot points lie on the true curve, or FALSE otherwise.






public: logical pcurve::check_knot_tangents (


const curve* true_cu, // curve


BOUNDED_SURFACE* bsf // bounded surface



= NULL,


int num_knots // number of knots



= 0,


double* knots // knots



= NULL


);


Checks that the pcurve bs2_curve tangent directions agree with the true curve tangent directions at each of the knots. The bounded surface and the knots can be supplied to this function, but if they are not, they will be extracted from the underlying par_cur. The function returns TRUE if the tangent directions agree at all of the knot points, or FALSE otherwise.






public: bs2_curve pcurve::cur () const;


Returns the underlying 2D NURBS defining the parameter curve.






public: void pcurve::debug (


char const*, // title


FILE* // file name



= debug_file_ptr


) const;


Outputs details of a pcurve.






public: virtual pcurve* pcurve::deep_copy (


pointer_map* pm // list of items within



= NULL // the entity that are




// already deep copied


) const;


Creates a copy of an item that does not share any data with the original. Allocates new storage for all member data and any pointers. Returns a pointer to the copied item.


In a deep copy, all the information about the copied item is self-contained in a new memory block. By comparison, a shallow copy stores only the first instance of the item in memory, and increments the reference count for each copy.


The pointer_map keeps a list of all pointers in the original object that have already been deep copied. For example, a deep_copy of a complex model results in self contained data, but identical sub-parts within the model are allowed to share a single set of data.






public: void pcurve::eval (


double,

// parameter


SPApar_pos&,

// param position


SPApar_vec&

// 1st derivative



= * (SPApar_vec* ) NULL_REF,


SPApar_vec&

// 2nd derivative



= * (SPApar_vec* ) NULL_REF


) const;


Evaluates a pcurve at a parameter value, giving position and optionally first and second derivatives.






public: SPApar_vec pcurve::eval_deriv (


double // parameter


) const;


Evaluates a pcurve at a parameter value, to give the derivative with respect to its parameter.






public: SPApar_pos pcurve::eval_position (


double // parameter


) const;


Evaluates a pcurve at a parameter value.






public: SPApar_pos pcurve::eval_position (


SPAposition const&, // position name


double, // parameter


logical point_perp // use point_perp if




// true, param if false



= FALSE


) const;


Evaluates a pcurve at a parameter value.






public: double pcurve::fitol () const;


Returns the fit tolerance of the parameter curve.






public: double pcurve::hull_distance () const;


Returns the distance from the true curve to the underlying bs2_curve convex hull, if the true curve comes outside of the hull. Set to 0 if the true curve is known to lie completely within the hull or -1 if this property has not been checked yet.






public: int pcurve::hull_self_intersects () const;


Returns 1 if the bs2_curve hull self-intersects, within the checked_range, or to zero if it does not self-intersect within this range. Returns -1 if this property has not yet been checked.






public: int pcurve::hull_turning_angles_ok () const;


Returns the value for hull turning angle checking. Set to 1 if the bs2_curve hull does not turn too sharply at any point within the checked_range, or set to 0 if the hull does turn too sharply at a point. Set to -1 if this property has not yet been checked.






public: int pcurve::knots_on_true_curve () const;


Returns 1 if all of the bs2_curve knots that are within the checked_range lie on the associated true curve (to within SPAresabs), or to 0 if this is not the case. Returns -1 if this property has not yet been checked.






public: logical pcurve::make_bezier_form ();


Makes the underlying bs2_curve have Bezier form by adding knots as necessary.






public: BOUNDED_SURFACE* pcurve::


make_bounded_surface () const;


Makes up a bounded surface from the underlying surface. This does not have to accurately bound the pcurve, but is just used to make up SVECs for the other member functions.






public: pcurve& pcurve::negate ();


Negates a pcurve in place.






public: SPApar_vec pcurve::offset () const;


Returns the offset.






public: pcurve& pcurve::operator*= (


SPAtransf const& // transformation


);


Transforms a pcurve in object space.






public: pcurve pcurve::operator+ (


SPApar_vec const& // parameter vector


) const;


Displaces the curve in surface parameter space.






public: pcurve const& pcurve::operator+= (


SPApar_vec const& pv // parameter vector


);


Add a SPApar_vec to a pcurve's offset.






public: pcurve pcurve::operator- () const;


Makes a negated curve.






public: pcurve pcurve::operator- (


SPApar_vec const& // parameter vector


) const;


Makes a negated curve given a SPApar_vec.






public: pcurve const& pcurve::operator-= (


SPApar_vec const& pv // parameter vector


);


Subtract a SPApar_vec to a pcurve's offset.






public: pcurve& pcurve::operator= (


pcurve const& // pcurve to be assigned


);


An assignment operator that copies the pcurve record, and adjusts the use counts of the underlying information.






public: double pcurve::param (


const SPApar_pos& uv // parameter position


);


Returns the parameter of the pcurve at the given SPApar_pos.






public: double pcurve::param_period () const;


Returns the parameter period - the length of the parameter range if periodic, 0 otherwise.






public: SPAinterval pcurve::param_range () const;


Returns the principal parameter range of a pcurve.






public: void pcurve::reparam (


double, // first parameter


double // second parameter


);


Performs a linear transformation on the curve parameterization, so that it starts and ends at the given values (that must be in increasing order).






public: void pcurve::restore_data ();


Restore the data for a pcurve from a save file.


read_logical Sense of the pcurve: either "forward" or "reversed".

if (restore_version_number < PCURVE_VERSION)

// Restore as an explicit pcurve.

par_cur* restore_exp_par_cur Restore the appropriate pcurve

else

// Switch to the right restore routine, using the standard

// system mechanism.

(par_cur *)dispatch_restore_subtype

read_real du; u offset


read_real

dv; v offset






public: logical pcurve::reversed () const;


Inquires whether the parameter space curve is in the same or opposite direction of the underlying 2D NURBS curve.






public: void pcurve::save () const;


Saves the id the calls save_data.






public: void pcurve::save_data () const;


Saves the information for a pcurve to the save file. Function to save a pcurve of a known type, where the context determines the pcurve type, so no type code is necessary.






public: void pcurve::save_pcurve () const;


Function to be called to save a pcurve of unknown type, or NULL. Just checks for null, then calls save. This separation is not really necessary for pcurves at present, as there are no subtypes, but we retain it for consistency with curve and surface.






public: void pcurve::set_accurate_knot_tangents (


int acc_tangents // value


);


Set to 1 if the bs2_curve tangents are within SPAresnor of the true curve tangent vectors at all of the knots that lie within the checked_range, or to 0 if this is not satisfied. Set to -1 if this property has not yet been checked.






public: void pcurve::set_checked_range (


const SPAinterval& new_range, // interval


int num_knots

// number of



= 0,

// knots


double* knots

// knots



= NULL


);


Sets the checked range of the pcurve.






public: void pcurve::set_hull_distance (


double dist // value


);


Sets the distance from the true curve to the underlying bs2_curve convex hull, if the true curve comes outside of the hull. Set to 0 if the true curve is known to lie completely within the hull or -1 if this property has not been checked yet.






public: void pcurve::set_hull_self_intersects (


int self_ints // value


);


Set to 1 if the bs2_curve hull self-intersects, within the checked_range, or to zero if it does not self-intersect within this range. Set to -1 if this property has not yet been checked.






public: void pcurve::set_hull_turning_angles_ok (


int angles_ok // value


);


Sets the value for hull turning angle checking. Set to 1 if the bs2_curve hull does not turn too sharply at any point within the checked_range, or set to 0 if the hull does turn too sharply at a point. Set to -1 if this property has not yet been checked.






public: void pcurve::set_knots_on_true_curve (


int knots_on_cu // value


);


Set to 1 if all of the bs2_curve knots that are within the checked_range lie on the associated true curve (to within SPAresabs), or to 0 if this is not the case. Set to -1 if this property has not yet been checked.






public: void pcurve::set_surface(


surface const& // surface to set


);


Used to set the surface of a pcurve after a space warp.






public: pcurve* pcurve::split (


double,
// parameter


SPApar_pos const&
// parameter position



= * (SPApar_pos* ) NULL_REF,


SPApar_vec const&
// parameter position



= * (SPApar_vec* ) NULL_REF


);


Divides a pcurve into two pieces at a parameter value. This function creates a new pcurve on the heap, but either one of the pcurves may have a NULL actual curve. The supplied curve is modified to be the latter section, and the initial section is returned as value.






public: surface const& pcurve::surf () const;


Returns the surface that the parameter space curve is defined.






public: SPAinterval pcurve::trim (


const SPAinterval& new_range, // trim to range


const SPApar_pos& start_uv
// start param



= * (SPApar_pos* ) NULL_REF,


const SPApar_vec& start_duv
// slope



= * (SPApar_vec* ) NULL_REF,


const SPApar_pos& end_uv

// end param



= * (SPApar_pos* ) NULL_REF,


const SPApar_vec& end_duv
// slope



= * (SPApar_vec* ) NULL_REF


);


Trims the pcurve to the supplied range, using the supplied end par_pos's, if any. The new pcurve range is returned.






public: SPAinterval pcurve::trim_to_curve_range (


const curve* cu // trimming curve


);


Trims the pcurve to the range of the supplied curve. The new pcurve range is returned.






public: char const* pcurve::type_name () const;


Returns a string identifying the pcurve type. For exp_par_cur and its derived types, this method returns "exppc". For imp_par_cur and its derived types, this method returns "impcc".






public: void pcurve::validity_checks (


const curve* cu,

// curve


const SPAinterval& chkd_range, // interval


logical& knots_on_true_cur,
// knots of true






// curve


logical& knot_tangents_ok,
// knot tangents






// ok


logical& hull_turn_angles_ok, // hull turning






// angles ok


logical& hull_intersects,
// hull self






// intersections


logical& hull_contains_true_cu // hull contains






// true curve


);


Carries out all the validity checks for a pcurve, over the supplied interval. If a logical is supplied as a NULL reference, the corresponding test is not carried out. This function extracts the knots and control points from the pcurve and supplies them to the validity checking functions, so that they only have to be extracted once.

Internal Use: full_size, get_par_cur




Related Fncs: restore_pcurve






friend: pcurve operator* (


pcurve const&, // pcurve


SPAtransf const& // transformation


);


Transforms a pcurve in object space.






friend: pcurve operator+ (


SPApar_vec const& pv, // parameter vec


pcurve const& pc // pcurve


);


Adds a SPApar_vec to a pcurve's offset.
PDF/KERN/34CLP.PDF
HTM/DATA/KERN/KERN/34CLP/0005.HTM