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

Purpose: Records a B-spline surface.

Derivation: spline : surface : ACIS_OBJECT : -

SAT Identifier: "spline"

Filename: kern/kernel/kerngeom/surface/spldef.hxx

Description: The spline class represents a parametric surface that maps a rectangle within a 2D real vector space (parameter space) into a 3D real vector space (object space). This mapping must be continuous, and one-to-one except possibly at the boundary of the rectangle in parameter space. It is differentiable twice, and the normal direction is continuous, though the derivatives need not be. The positive direction of the normal is in the sense of the cross product of the partial derivatives with respect to u and v in that order. The portion of the neighborhood of any point on the surface that the normal points to is outside the surface, and the other part is inside.


Opposite sides of the rectangle can map into identical lines in object space, in which case the surface is closed in the parameter direction normal to those boundaries. If the parameterization and derivatives also match at these boundaries, the surface is periodic in this parameter direction. The line in object space corresponding to the coincident boundaries is known as the seam of a periodic surface.


If a surface is periodic in one parameter direction, it is defined for all values of that parameter. A parameter value outside the domain rectangle is brought within the rectangle by adding a multiple of the rectangle's width in that parameter direction, and the surface evaluated at that value. If the surface is periodic in both parameters, it is defined for all parameter pairs (u,v), with reduction to standard range happening with both parameters.


One side of the rectangle can map into a single point in object space. This point is a parametric singularity of the surface. If the surface normal is not continuous at this point, it is a surface singularity.


The spline contains a "reversed" bit together with a pointer to another structure, a spl_sur or something derived from it, that contains the bulk of the information about the surface.


Providing this indirection serves two purposes. First, when a spline is duplicated, the copy simply points to the same spl_sur and does not copy the bulk of the data. The system maintains a use count in each spl_sur. This allows automatic duplication if a shared spl_sur is to be modified, and deletes any spl_sur no longer accessible.


Second, the spl_sur contains virtual functions to perform all spline operations defined that depend on the method of definition of the true surface. Therefore, new surface types can be defined by declaring and implementing derived classes. The spline and everything using it require no changes to make use of the new definition.

References: KERN discontinuity_info, spl_sur

by KERN SPLINE, spl_sur, sub_spl_sur

Constructor: public: spline::spline ();


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






public: spline::spline (


bs3_surface // bs3 surface


);


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


Construct a spline from a bs3_surface, which is the type that represents the fundamental parametric surface. The resulting spline surface is taken to be exactly the bs3_surface supplied. After construction, the bs3_surface is owned by the spline object, so should not be reused or deleted by the caller.






public: spline::spline (


spline const& //given spline


);


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






public: spline::spline (


spl_sur* // spline surface


);


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


Construct a spline from a pointer to an underlying spl_sur (usually in fact a class derived from it). This adds one new reference to the spl_sur, for the purposes of eventual deletion.




Destructor: public: virtual spline::~spline ();


C++ destructor, deleting a spline.



Methods: public: virtual int spline::accurate_derivs (


SPApar_box const& // default to the surface



= * (SPApar_box* ) NULL_REF


) const;


Return the number of derivatives that evaluate can find accurately and fairly directly, rather than by finite differencing, over the given portion of the surface. If there is no limit to the number of accurate derivatives, returns the value ALL_SURFACE_DERIVATIVES.






public: virtual const double*


spline::all_discontinuities_u (


int& n_discont, // number of disc


int order // order


);


Returns in a read-only array the number and parameter values of discontinuities of the surface, up to the given order (maximum three).






public: virtual const double*


spline::all_discontinuities_v (


int& n_discont, // number of disc


int order // order


);


Returns in a read-only array the number and parameter values of discontinuities of the surface, up to the given order (maximum three).






public: SPAbox spline::bound (


SPAtransf const&, // transform


SPApar_box const& // parameter range



= * (SPApar_box* ) NULL_REF


) const;


Return a box around the spline. This is retained for historical reasons--it exactly parallels the previous virtual function.






public: virtual SPAbox spline::bound (


SPAbox const&, // object space box


SPAtransf const& // transform



= * (SPAtransf* ) NULL_REF


) const;


Return a box that encloses the portion of the surface that lies within the given box after transformation.






public: virtual SPAbox spline::bound (


SPApar_box const& // parameter range



= * (SPApar_box* ) NULL_REF,


SPAtransf const& // transform



= * (SPAtransf* ) NULL_REF


) const;


Return a box that encloses the portion of the surface within the given range after transformation.






public: virtual void spline::change_event ();


Notifies the derived type that the surface has been changed (e.g. the subset_range has changed) so that it can update itself.






public: virtual check_status_list* spline::check (


const check_fix& input

// flags for



= * (const check_fix*)
// allowed



NULL_REF,

//fixes


check_fix& result

// fixes applied



= * (check_fix*) NULL_REF,


const check_status_list*

// checks to be



= (const check_status_list*) // made, default



NULL_REF

// is none


);


Check for any data errors in the curve, and correct the errors if possible. The various arguments provide control over which checks are made, which fixes can be applied and which fixes were actually applied. The function returns a list of errors that remain in the curve on exit.


The default for the set of flags which say which fixes are allowable is none (nothing is fixed). If the list of checks to be made is null, then every possible check will be made. Otherwise, the function will only check for things in the list. The return value for the function will then be a subset of this list.






public: virtual logical spline::closed_u () const;


Report whether the surface is closed, smoothly or not, in the u-parameter direction.






public: virtual logical spline::closed_v () const;


Report whether the surface is closed, smoothly or not, in the v-parameter direction.






public: logical spline::contains_pipe () const;


Returns TRUE if this spline depends on a pipe surface.






public: virtual void spline::debug (


char const*, // title line


FILE* // file



= debug_file_ptr


) const;


Print out details of a spline.






public: virtual surface* spline::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.






public: virtual const double*


spline::discontinuities_u (


int& n_discont, // number of discont


int order // spline order


) const;


Returns the number and parameter values of discontinuities of the surface of the given order (maximum three) in a read-only array.






public: virtual const double*


spline::discontinuities_v (


int& n_discont, // number of discont


int order // spline order


) const;


Returns the number and parameter values of discontinuities of the surface of the given order (maximum three) in a read-only array.






public: virtual int spline::discontinuous_at_u (


double u // location


) const;


Returns whether a particular parameter value is a discontinuity.






public: virtual int spline::discontinuous_at_v (


double v // location


) const;


Returns whether a particular parameter value is a discontinuity.






public: virtual void spline::eval (


SPApar_pos const& uv, // parameter


SPAposition& pos, // position


SPAvector* dpos // 1st derivatives array



= NULL, // length 2 in order xu,




// xv


SPAvector* ddpos // second derivatives -



= NULL // array of length 3 in




// order xuu, xuv, xvv


) const;


Find the position and first and second derivatives of the surface at given parameter values.






public: virtual int spline::evaluate (


SPApar_pos const&,

// param value


SPAposition&,

// pt on surface






// at given






// parameter


SPAvector**

// array of ptrs



= NULL,

// to arrays






// of vectors.


int


// # derivatives



= 0,

// required (nd)


evaluate_surface_quadrant
// the evaluation






// loc. above,






// below for each






// parameter






// direction,



= evaluate_surface_unknown // or don't care.


) const;


Calculates derivatives, of any order up to the number requested, and stores them in vectors provided by the user. Any of the pointers may be NULL, in which case the corresponding derivatives will not be returned. Otherwise they must point to arrays long enough for all the derivatives of that order; i.e., 2 for the first derivatives, 3 for the second, etc.






public: virtual int spline::evaluate_iter (


SPApar_pos const&,
// parameter position


surface_evaldata*,
// data supplying





// initial values,





// and set to reflect





// the results of





// this evaluation


SPAposition&,
// point on curve at





// given parameter


SPAvector**
// array of pointers



= NULL,
// to vectors, of





// size nd. Any of





// the pointers may





// be null, in which





// case the





// corresponding





// derivative will





// not be returned


int

// number of



= 0,
// derivatives





// required (nd)


evaluate_surface_quadrant // evaluation





// location - above,





// below, don't care



= evaluate_surface_unknown


) const;


The evaluate_iter function is just like evaluate, but is supplied with a data object which contains results from a previous close evaluation, for use as initial values for any iteration involved.






public: virtual double spline::eval_cross (


SPApar_pos const&, // parameter


SPAunit_vector const& // curve normal


) const;


Finds the curvature of a cross-section curve of the surface at the point on the surface with given parameter values. The cross-section curve is determined by the intersection of the surface with a plane passing through the point on the surface and with given normal.






public: virtual SPAunit_vector spline::eval_normal (


SPApar_pos const& // parameter value


) const;


Finds the normal to the spline at the point with given parameter values.






public: virtual SPAunit_vector spline::eval_outdir (


SPApar_pos const& // parameter value


) const;


Find an outward direction from the surface at a point with given parameter values.






public: virtual SPAposition spline::eval_position (


SPApar_pos const& // parameter values


) const;


Finds the point on the spline with given parameter values.






public: surf_princurv spline::eval_prin_curv (


SPApar_pos const& param // parameter value


) const;


Finds the principal axes of curvature of the surface at a point.






public: virtual void spline::eval_prin_curv (


SPApar_pos const&, // parameter value


SPAunit_vector&, // first axis direction


double&, // 1st direction




// curvature




// direction


SPAunit_vector&, // second axis direction


double& // second direction




// curvature


) const;


Finds the principal axes of curvature of the surface at a point with given parameter values, and the curvatures in those directions.






public: double spline::fitol () const;


Returns the fit tolerance of the bs3_curve to the true spline surface.






public: virtual const discontinuity_info&


spline::get_disc_info_u() const;


Returns read-only access to the disc_info objects.






public: virtual const discontinuity_info&


spline::get_disc_info_v() const;


Returns read-only access to the disc_info objects.






public: virtual curve* spline::get_path () const;


Returns the sweep path curve for this spline.






public: virtual sweep_path_type


spline::get_path_type () const;


Returns the sweep path type for this spline.






public: virtual curve* spline::get_profile (


double // parameter


) const;


Returns the sweep profile curve for this spline.






public: virtual law* spline::get_rail () const;


Returns the sweep rail law for this spline.






public: spl_sur const& spline::get_spl_sur () const;


Returns defining spline surface and should only be used when absolutely necessary.






public: virtual logical


spline::left_handed_uv () const;


Indicates whether the parameter coordinate system of the surface is right or left-handed. With a right-handed system, at any point the outward normal is given by the cross product of the increasing u-direction with the increasing v-direction, in that order. With a left-handed system the outward normal is in the opposite direction from this cross product.






public: virtual surface* spline::make_copy () const;


Makes a copy of this spline on the heap, and returns a pointer to it.






public: virtual surface_evaldata*


spline::make_evaldata () const;


Construct a data object to retain evaluation information across calls to evaluate_iter. This is to allow subsidiary calls within an iterative evaluator to start iteration much closer to the required result than is possible just using the curve information itself.






public: void spline::make_single_ref ();


Makes a single reference to this spline.






public: virtual surface& spline::negate ();


Negates this spline.






public: virtual surf_normcone spline::normal_cone (


SPApar_box const&, // parameter bounds


logical // approx. ok?



= FALSE,


SPAtransf const& // transformation



= * (SPAtransf* ) NULL_REF


) const;


Return a cone bounding the normal direction of the surface. The cone is deemed to have its apex at the origin, and has a given axis direction and (positive) half-angle. If the logical argument is TRUE, then a quick approximation may be found. The approximate result may lie wholly within or wholly outside the guaranteed bound (obtained with a FALSE argument), but may not cross from inside to outside. Flags in the returned object indicate whether the cone is in fact the best available, and if not whether this result is inside or outside the best cone.






public: virtual surface& spline::operator*= (


SPAtransf const& // transformation


);


Transforms this spline by the given transformation.






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


Returns a surface with a reversed sense.






public: spline& spline::operator= (


spline const& // spline name


);


Copies the spline record, and adjust the use counts of the underlying information to suit.






public: virtual logical spline::operator== (


surface const& // surface to be compared


) const;


This, like testing floating point numbers for equality, is not guaranteed to say equal for effectively equal surfaces, but is guaranteed to say not equal if they are indeed not equal. The result can be used for optimization, but not where it really matters. The default always says not equal, for safety.






public: virtual SPApar_pos spline::param (


SPAposition const&, // position


SPApar_pos const& // initial guess



= * (SPApar_pos* ) NULL_REF


) const;


Finds the parameter values of a point on a 3D B-spline surface, iterating from the given parameter values (if supplied).






public: virtual logical spline::parametric () const;


Indicates if the surface is parametric. Always TRUE for splines.






public: virtual double


spline::param_period_u () const;


Returns the period of a periodic parametric surface, 0 if the surface is not periodic in the u-parameter or not parametric.






public: virtual double


spline::param_period_v () const;


Returns the period of a periodic parametric surface, 0 if the surface is not periodic in the v-parameter or not parametric.






public: virtual SPApar_box spline::param_range (


SPAbox const& // region of interest



= * (SPAbox* ) NULL_REF


) const;


Returns the principal parameter range of a parametric surface in a chosen parameter direction. For a nonparametric surface, the range is returned as the empty interval or box. A periodic surface is defined for all parameter values in the periodic direction, by reducing the given parameter modulo the period into this principal range. For a surface open or nonperiodic in the chosen direction the surface evaluation functions are defined only for parameter values in the returned range. If a box is provided, the parameter range returned may be restricted to a portion of the surface that is guaranteed to contain all portions of the surface that lie within the region of interest. If none is provided, and the parameter range in some direction is unbounded, then conventionally an empty interval is returned.






public: virtual SPAinterval spline::param_range_u (


SPAbox const& // region of interest



= * (SPAbox* ) NULL_REF


) const;


Refer to previous description.






public: virtual SPAinterval spline::param_range_v (


SPAbox const& // region of interest



= * (SPAbox* ) NULL_REF


) const;


Refer to previous description.






public: virtual SPApar_vec spline::param_unitvec (


SPAunit_vector const&, // direction


SPApar_pos const& // parameter


) const;


Finds the change in surface parameter corresponding to a unit offset in a given direction at a given position.






public: virtual logical spline::periodic_u () const;


Reports whether a parametric surface is periodic in the u-parameter direction; i.e., it is smoothly closed, so faces can run over the seam.






public: virtual logical spline::periodic_v () const;


Reports whether a parametric surface is periodic in the v-parameter direction; i.e., it is smoothly closed, so faces can run over the seam.






public: virtual logical spline::planar (


SPAposition&, // location


SPAunit_vector& // unit vector


) const;


Determines whether spline is planar.






public: virtual double spline::point_cross (


SPAposition const&, // position


SPAunit_vector const&, // direction


SPApar_pos const& // initial param guess



= * (SPApar_pos* ) NULL_REF


) const;


Finds the curvature of a cross-section curve of the surface at the point on the surface closest to the given point, iterating from the given parameter values (if supplied). The cross-section curve is determined by the intersection of the surface with a plane passing through the point on the surface and with given normal.






public: virtual SPAunit_vector spline::point_normal (


SPAposition const&, // position


SPApar_pos const& // parameter guess



= * (SPApar_pos* ) NULL_REF


) const;


Finds the normal to the surface at the given point.






public: virtual SPAunit_vector spline::point_outdir (


SPAposition const&, // position


SPApar_pos const& // parameter guess



= * (SPApar_pos* ) NULL_REF


) const;


Finds an outward direction from the surface at a point on the surface nearest to the given point. Normally just the normal, but nonzero at a singularity.






public: virtual void spline::point_perp (


SPAposition const&, // given position


SPAposition&, // position on a surface


SPAunit_vector&, // surface normal


surf_princurv&, // principal curvature


SPApar_pos const& // parameter guess



= * (SPApar_pos* ) NULL_REF,


SPApar_pos& // actual parameter



= * (SPApar_pos* ) NULL_REF,


logical f_weak // weak flag



= FALSE


) const;


Finds the point on the surface nearest to the given point and the normal to and principal curvatures of the surface at that point. If the surface is parametric, also return the parameter values at the found point.






public: void spline::point_perp (


SPAposition const& pos, // given position


SPAposition& foot, // position on a surface


SPApar_pos const& // parameter position



param_guess // parameter guess



= * (SPApar_pos* ) NULL_REF,


SPApar_pos& param_actual // actual parameter



= * (SPApar_pos* ) NULL_REF,


logical f_weak // weak flag



= FALSE


) const;


Finds the point on the surface nearest to the given point. If the surface is parametric, also return the parameter values at the found point.






public: void spline::point_perp (


SPAposition const& pos, // given position


SPAposition& foot, // position on a surface


SPAunit_vector& norm, // surface normal


SPApar_pos const& // parameter position



param_guess // parameter guess



= * (SPApar_pos* ) NULL_REF,


SPApar_pos& param_actual // actual parameter



= * (SPApar_pos* ) NULL_REF,


logical f_weak // weak flag



= FALSE


) const;


Finds the point on the surface nearest to the given point. If the surface is parametric, also return the parameter values at the found point.






public: surf_princurv spline::point_prin_curv (


SPAposition const& pos, // position


SPApar_pos const& // parameter position



param_guess // possible parameter



= * (SPApar_pos* ) NULL_REF


) const;


Find the principal curvatures at a given point, returning the values in a struct. Just uses the other (virtual) principal curvature function.






public: virtual void spline::point_prin_curv (


SPAposition const&, // position


SPAunit_vector&, // first axis direction


double&, // curvature in first




// direction


SPAunit_vector&, // second axis direction


double&, // curvature in second




// direction


SPApar_pos const& // parameter guess



= * (SPApar_pos* ) NULL_REF


) const;


Find the principal axes of curvature of the surface at a given point, and the curvatures in those directions.






public: void spline::reparam (


double, // new start u parameter


double, // new end u parameter


double, // new start v parameter


double // new end v parameter


);


Reparameterizes the curve.






public: void spline::reparam_u (


double, // new start u parameter


double // new end u parameter


);


Reparameterizes the curve in u.






public: void spline::reparam_v (


double, // new start v parameter


double // new end v parameter


);


Reparameterizes the curve in v.






public: void spline::restore_data ();


Restore the data for a spline from a save file.


if (restore_version_number < SPLINE_VERSION )

// Just restore as an exact spline.

(spl_sur *)dispatch_restore_subtype( "sur", "exactsur" )

else

read_logical Reverse flag; either "forward" or "reversed"

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

// system mechanism. Note that the argument is to enable

// the reader to distinguish old-style types where "exact"

// was both an int_cur and a spl_sur. They are now "exactcur"

// and "exactsur".

(spl_sur *)dispatch_restore_subtype( "sur" )

surface::restore_data
Fix the underlying surface






public: logical spline::reversed () const;


Determines if the underlying sculptured (spline) surface is in the opposite direction of the ACIS spline surface. This function returns TRUE if spline surface is opposite.






public: virtual void spline::save () const;


Saves the type or id, then calls save_data.






public: void spline::save_data () const;


Saves the information for the spline in the save file.






public: const eval_sscache_entry*


spline::search_eval_cache (


const SPAposition& pos // position to evaluate


) const;


Searches the underlying cache for an entry at the given position. Returns the matching eval entry if this is found, or NULL otherwise.






public: void spline::set_sur (


bs3_surface, // surface data


double fitol // fit tolerance



= -1.0


);


Sets the surface information.






public: virtual logical spline::singular_u (


double // constant u-parameter


) const;


Reports whether the surface parameterization is singular at the specified u-parameter value. The only singularity recognized is where every value of the nonconstant parameter generates the same object-space point, and these can only occur at the ends of the parameter range as returned by the functions above. A plane is nonsingular in both directions.






public: virtual logical spline::singular_v (


double // constant v-parameter


) const;


Reports whether the surface parameterization is singular at the specified v-parameter value. The only singularity recognized is where every value of the nonconstant parameter generates the same object-space point, and these can only occur at the ends of the parameter range as returned by the functions above. A plane is nonsingular in both directions.






public: spline* spline::split_u (


double // parameter


);


Divide a surface into two pieces at a u-parameter value. Returns a new surface for the low-parameter side, and change the old one to represent the high-parameter side.






public: spline* spline::split_v (


double // parameter


);


Divide a surface into two pieces at a v-parameter value. Returns a new surface for the low-parameter side, and change the old one to represent the high-parameter side.






public: int spline::split_at_kinks_u (


spline**& pieces, // pieces


double curvature = 0.0 // curvature


) const;


Divide a surface into separate pieces which are smooth (and therefore suitable for offsetting or blending). The surface is split at its non-G1 discontinuities, and if it is closed after this, it is then split into two. The split pieces are stored in the the pieces argument. The function returns the count of split pieces.






public: int spline::split_at_kinks_v (


spline**& pieces, // pieces


double curvature = 0.0 // curvature


) const;


Divide a surface into separate pieces which are smooth (and therefore suitable for offsetting or blending). The surface is split at its non-G1 discontinuities, and if it is closed after this, it is then split into two. The split pieces are stored in the the pieces argument. The function returns the count of split pieces.






public: spline* spline::subset (


SPApar_box const& // parameter range


) const;


Constructs a new spline that is a copy of the part of the given one within given parameter bounds.






public: bs3_surface spline::sur (


double tol // tolerance



= -1.0

) const;


Returns (a pointer to) the underlying surface, or NULL if none.






public: logical spline::sur_present () const;


Returns TRUE if there is underlying surface data.






public: virtual logical spline::test_point_tol (


SPAposition const&, // position


double // parameter



= 0,


SPApar_pos const& // parameter guess



= * (SPApar_pos* ) NULL_REF,


SPApar_pos& // actual parameter



= * (SPApar_pos* ) NULL_REF


) const;


Tests whether a point lies on the surface, to user-defined tolerance.






public: virtual int spline::type () const;


Returns the type of spline.






public: virtual char const*


spline::type_name () const;


Returns string "spline_xxx" where xxx is replaced with type_names of the underlying spl_sur.






public: virtual logical spline::undef () const;


Indicates if the spline is improperly defined.






public: virtual curve* spline::u_param_line (


double // u-parameter


) const;


Constructs a u-parameter line on the surface. A u-parameter line runs in the direction of increasing u-parameter, at constant v. The parameterization in the nonconstant direction matches that of the surface, and has the range obtained by use of param_range_u. The new curve is constructed in free store, so it is the responsibility of the caller to ensure that it is correctly deleted.






public: virtual curve* spline::v_param_line (


double // v-parameter


) const;


Constructs a v-parameter line on the surface. A v-parameter line runs in the direction of increasing v, at constant u. The parameterization in the nonconstant direction matches that of the surface, and has the range obtained by use of param_range_v. The new curve is constructed in free store, so it is the responsibility of the caller to ensure that it is correctly deleted.

Internal Use: full_size




Related Fncs: restore_spline






friend: spline operator* (


spline const&, // spline name


SPAtransf const& // transformation


);


Transforms a spline surface.
PDF/KERN/36CLSA.PDF
HTM/DATA/KERN/KERN/36CLSA/0008.HTM