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

Purpose: Defines the elliptical single cone.

Derivation: cone : surface : ACIS_OBJECT : -

SAT Identifier: "cone"

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

Description: The cone class defines an elliptical single cone. It is defined by a base ellipse and the sine and cosine of the major half-angle of the cone. The normal of the base ellipse represents the axis of the cone.


As special cases, the cross-section may be circular, or the cone may be a cylinder.


The ellipse has the same data structure as an ellipse curve; i.e., center, normal, major axis, radius ratio.


The polarity (sign) of the trigonometric functions define the slant of the surface of the cone and the sense of the surface.


- If sine_angle has different polarity than cosine_angle, the cross-section decreases in the direction of the axis of the cone (ellipse surface normal) as shown in the Figure.

- If sine_angle has the polarity as cosine_angle, the cross-section increases in the direction of the axis of the cone (ellipse surface normal).

- If cosine_angle is positive (+), the sense of the surface is away from the axis of the cone (surface is convex).

- If cosine_angle is negative (-), the sense of the surface is toward the axis of the cone (surface is concave).

- If sine_angle is identically zero (sine_angle == 0), the cone is a cylinder.

- If cosine_angle is identically zero (cosine_angle ==0), the cone is planar.


The surface stops at the apex, if any; i.e., this surface type does not represent a double cone.


There is a set of parameter-based functions. ACIS only requires them to have defined results if the surface is parametric (i.e., method parametric returns TRUE), but components and applications may expect results for all surface types.


The u-parameter direction is along the generators of the cone, with zero representing the intersection of the generator with the base ellipse, and parameter increasing in the direction of the cone axis; i.e., the normal of the base ellipse, if reverse_u is FALSE, and in the opposite direction if reverse_u is TRUE. The v-parameter direction is along a cross-sectional ellipse clockwise around the cone axis, parameterized as for the base ellipse.


The u-parameter scaling factor stores the factor that when multiplied by the u-parameter of a point gives the 3D distance of that point along the cone surface from the base ellipse. The u-parameter is always 0.0 on the cone base ellipse. This enables the parameterization to be preserved if the cone is offset.


To evaluate the position corresponding to a given uv pair, first evaluate the base ellipse at parameter v, and subtract the center point to give vector V. Let s and c be sine_angle and cosine_angle if cosine_angle is positive, or -sine_angle and -cosine_angle if not. Let R be the length of the major axis of the base ellipse, negated if reverse_u is TRUE. Then:


pos = base.center + (1 + s*u)* V + c*u*R*base.normal


This parameterization is left-handed for a convex cone (cosine_angle > 0) with reverse_uFALSE or for a concave cone with reverse_uTRUE, and right-handed otherwise.


When the cone is transformed, the sense of reverse_u is inverted if the transform includes a reflection. A negation requires no special action.


In summary, cones are:


- Not TRUE parametric surfaces.

- Are closed in v but not in u.

- Periodic in v ( -pi to pi with period 2 pi) but not in u.

- Singular in u at the apex; nonsingular for all other u and v values.



References: KERN ellipse

by KERN CONE

Data: public double cosine_angle;

Cosine of the angle between major generator and axis.


public double sine_angle;

Sine of the angle between major generator and axis. By convention, both sine and cosine are made exactly zero to indicate that the curve is undefined.


public double u_param_scale;

Scaling of the u parameter lines.


public ellipse base;

Cross-section at right angles to axis.


public logical reverse_u;

Required to support transformation independent parameterization. The u parameter direction (along generators) is normally in the same general direction as the cone axis (normal to the base ellipse), but is reversed if the value is TRUE.

Constructor: public: cone::cone ();


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






public: cone::cone (


cone const& // cone


);


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






public: cone::cone (


ellipse const&, // base ellipse


double, // sine of half-angle


double, // cosine of half-angle


double // u parameter scale



= 0.0


);


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


Constructs a cone with given ellipse as base, and given sine and cosine of its half-angle.






public: cone::cone (


SPAposition const&, // center


SPAunit_vector const&, // axis direction


SPAvector const&, // major radius


double, // radius ratio


double, // sine of half-angle


double, // cosine of half-angle


double // u parameter scale



= 0.0


);


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


Construct a cone with axis through given point and in given direction:




Destructor: public: cone::~cone ();


C++ destructor, deleting a cone. The destructor is explicitly defined to avoid multiple copies.



Methods: public: virtual int cone::accurate_derivs (


SPApar_box const&
// parameter box



= * (SPApar_box* ) NULL_REF


) const;


Return the number of derivatives that evaluate can find accurately and 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 SPAbox cone::bound (


SPAbox const&,
// box in object





// space


SPAtransf const&
// transformation



= * (SPAtransf* ) NULL_REF


) const;


Returns a box around the portion of a surface bounded by a box in object space.






public: virtual SPAbox cone::bound (


SPApar_box const&

// given box in



= * (SPApar_box* ) NULL_REF, // param space


SPAtransf const&

// transformation



= * (SPAtransf* ) NULL_REF


) const;


Returns a box around the portion of a surface bounded in parameter space.






public: logical cone::circular () const;


Classification routine that sets the base ratio to 1; therefore, the base is circular.






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


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






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


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






public: logical cone::contracting () const;


Classification routine that returns TRUE if the sine angle and cosine angle are of opposite signs and FALSE, otherwise.






public: logical cone::cylinder () const;


Classification routine that returns TRUEif the sine angle is essentially zero (within SPAresnor).






public: virtual void cone::debug (


char const*, // leader string


FILE* // file name



= debug_file_ptr


) const;


Prints out the details of cone to a file.






public: virtual surface* cone::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 void cone::eval (


SPApar_pos const&, // parameter


SPAposition&, // position


SPAvector* // first derivative -



= NULL, // array of length 2,




// in order xu, xv




// vector * = NULL


SPAvector* // second derivatives -



= NULL // array of length 3, in




// order xuu, xuv, xvv


) const;


Finds the point on a parametric surface with given parameter values, and optionally the first and second derivatives as well or instead.






public: virtual int cone::evaluate (


SPApar_pos const&,

// parameter


SPAposition&,

// pt on surface






// at parameter


SPAvector**

// ptr array to



= NULL,

// vector array


int


// # derivatives



= 0,


evaluate_surface_quadrant
// the evaluation



= evaluate_surface_unknown // location


) const;


Calculates derivatives, of any order up to the number requested, and store them in vectors provided by the user. This function returns the number it was able to calculate; this is equal to the number requested in all but the most exceptional circumstances. A certain number are evaluated directly and (more or less) accurately; higher derivatives are automatically calculated by finite differencing. The accuracy of the finite difference derivatives decreases with the order of the derivative as the cost increases. 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 SPAunit_vector cone::eval_outdir (


SPApar_pos const& // parameter


) const;


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






public: surf_princurv cone::eval_prin_curv (


SPApar_pos const& param // parameter


) const;


Finds the principle axes of curvature of the surface at a point with given parameter values.






public: virtual void cone::eval_prin_curv (


SPApar_pos const&, // parameter


SPAunit_vector&, // first axis direction


double&, // curvature in first




// direction


SPAunit_vector&, // second axis direction


double& // curvature in second




// direction


) const;


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






public: logical cone::expanding () const;


Returns TRUE if the cosine angle and the sine angle are of the square sign.






public: logical cone::flat () const;


Classification routine that checks whether the cosine angle is essentially zero (within SPAresnor). This is a criterion for treating a cone as completely planar, although this should never occur.






public: virtual SPAposition cone::get_apex () const;


Determines the apex of the cone if it is not a cylinder.






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


Returns the sweep path for a cone.






public: virtual sweep_path_type cone::get_path_type (

) const;


Returns the sweep path type for a cone.






public: virtual curve* cone::get_profile (


double param // parameter


) const;


Returns the v parameter line sweep information for the cone.






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


Returns the rail law for the sweep path for a cone.






public: logical cone::hollow () const;


Returns TRUE if the cosine angle is negative.






public: virtual logical


cone::left_handed_uv () const;


Indicates whether the parameter coordinate system of the surface is right or left-handed. A convex cone has a left-handed coordinate system if reverse-u is FALSE, right-handed if it is TRUE. The converse is TRUE for a hollow curve.






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


Makes a copy of this cone on the heap, and return a pointer to it.






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


Negates the cone.






public: virtual surf_normcone cone::normal_cone (


SPApar_box const&,
// parameter bounds


logical
// approximation ok?



= FALSE,


SPAtransf const&
// transformation



= * (SPAtransf* ) NULL_REF


) const;


Returns a cone bounding the normal direction of a curve. 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 completely inside or 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& cone::operator*= (


SPAtransf const& // transformation


);


Transforms this cone by the given transformation.






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


Returns the inverse of the cone; i.e., with opposite normal.






public: virtual logical cone::operator== (


surface const& // surface name


) const;


Tests two surfaces for equality. It is not guaranteed to say equal for effectively-equal surfaces, but it is guaranteed to say not equal if they are not equal.






public: virtual SPApar_pos cone::param (


SPAposition const&,
// position name


SPApar_pos const&
// parameter position



= * (SPApar_pos* ) NULL_REF


) const;


Finds the parameter values of a point on a surface, given an optional first guess.






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


Determines if a cone is parametric and returns FALSE. A cone is not considered to be parameterized, as surface properties are easy to find in object space. Wherever a point evaluator has a SPApar_pos argument, this is ignored, so would normally be NULL or defaulted.






public: virtual double cone::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. For a cone the u-parameter is nonperiodic.






public: virtual double cone::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. For a cone the v-parameter always has period 2 * p2






public: virtual SPApar_box cone::param_range (


SPAbox const& // bounding box



= * (SPAbox* ) NULL_REF


) const;


Return the principal parameter range of a surface If a box is provided the parameter range 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 an empty interval is returned.






public: virtual SPAinterval cone::param_range_u (


SPAbox const& // bounding box



= * (SPAbox* ) NULL_REF


) const;


Return the principal parameter range of a surface in the u-parameter direction.






public: virtual SPAinterval cone::param_range_v (


SPAbox const& // bounding box



= * (SPAbox* ) NULL_REF


) const;


Return the principal parameter range of a surface in the v-parameter direction.






public: virtual SPApar_vec cone::param_unitvec (


SPAunit_vector const&, // direction


SPApar_pos const& // parameter position


) const;


Finds the rate of change in surface parameter corresponding to a unit velocity in a given object-space direction at a given position in parameter space.






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


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






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


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






public: virtual SPAunit_vector cone::point_normal (


SPAposition const&,
// position


SPApar_pos const&
// parameter



= * (SPApar_pos* ) NULL_REF


) const;


Returns normal at point on cone.






public: virtual SPAunit_vector cone::point_outdir (


SPAposition const&,
// position


SPApar_pos const&
// parameter position



= * (SPApar_pos* ) NULL_REF


) const;


Finds an outward direction from the surface at a point on the surface. This will usually be the normal, but if the point is the apex of the cone, this routine still returns an outward direction, being the (positive or negative) axis direction.






public: virtual void cone::point_perp (


SPAposition const&,

// point


SPAposition&,

// foot


SPAunit_vector&,

// direction


surf_princurv&,

// curvature


SPApar_pos const&

// param guess



= * (SPApar_pos* ) NULL_REF,


SPApar_pos&

// actual param



= * (SPApar_pos* ) NULL_REF,


logical f_weak

// weak flag



= FALSE


) const;


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






public: void cone::point_perp (


SPAposition const& pos,

// point


SPAposition& foot,

// foot


SPApar_pos const&

// position



param_guess

// param guess



= * (SPApar_pos* ) NULL_REF,


SPApar_pos& param_actual

// actual param



= * (SPApar_pos* ) NULL_REF,


logical f_weak

// weak flag



= FALSE


) const;


Find the point on the surface nearest to the given point and optionally the normal to and principal curvatures of the surface at that point:






public: void cone::point_perp (


SPAposition const& pos,

// point


SPAposition& foot,

// foot


SPAunit_vector& norm,

// direction


SPApar_pos const&

// position



param_guess

// param guess



= * (SPApar_pos* ) NULL_REF,


SPApar_pos& param_actual

// actual param



= * (SPApar_pos* ) NULL_REF,


logical f_weak

// weak flag



= FALSE


) const;


Find the point on the surface nearest to the given point. Optionally, finds the normal to and principal curvatures of the surface at that point. If the surface is parametric, returns the parameter values at the found point.






public: surf_princurv cone::point_prin_curv (


SPAposition const& pos,
// point


SPApar_pos const&
// parameter position



param_guess
// parameter guess



= * (SPApar_pos* ) NULL_REF


) const;


Finds the principle axes of the curvature of the surface at a given point.






public: virtual void cone::point_prin_curv (


SPAposition const&,
// point


SPAunit_vector&,
// first axis dir.


double&,
// curvature in first





// direction


SPAunit_vector&,
// second axis dir


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: logical cone::positive () const;


Returns TRUE if the sine angle is negative. This function is often used in determining senses of intersections. Returns TRUE if the surface normal is in the same general direction as the cone axis; i.e., their dot product is positive, and FALSE if the normal and axis are in opposite directions. Only really meaningful if cylinder returns FALSE, but consistent with the other functions even in the cylinder case.






public: void cone::restore_data ();


Restores the data from a save file. The restore operation switches on a table defined by static instances of the restore_su_def class. This invokes a simple friend function which constructs an object of the right derived type. Then it calls the appropriate base class member function to do the actual work.


cone::restore_data Restore the information for the base cone

read_real Sine of cone angle

read_real Cosine of cone angle

if (restore_version_number < CONE_SCALING_VERSION)

// the u parameter scale is obtained from the ellipse major axis

else

read_real u parameter scale

if (restore_version_number < SURFACE_VERSION)

// the reverse u flag is set to FALSE

else

read_logical u parameter reversed, either "forward" or "reversed"

surface::restore_data
Generic surface data






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


Saves the cone's type and ellipse type, or cone_id, then calls cone::save_data.






public: void cone::save_data () const;


Save occurs as derived class switching goes through the normal virtual function mechanism. The save_data and restore_data function for each class can be called in circumstances when we know what type of surface we are expecting and have one in our hand to be filled in.






public: logical cone::shallow () const;


Returns TRUE if the cosine angle is small (less than 0.1 in absolute value). This can be used as a warning of possible algorithmic problems because of a large half-angle.






public: virtual logical cone::singular_u (


double // constant u-parameter


) const;


Report whether the surface parameterization is singular at the 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 cone is singular for the u-parameter corresponding to the apex, nonsingular for every other u value.






public: virtual logical cone::singular_v (


double // constant v-parameter


) const;


Reports whether the surface parameterization is singular at the 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 cone is singular for the u-parameter corresponding to the apex, nonsingular for every other v value.






public: virtual int cone::split_at_kinks_v (


spline**& pieces, // output pieces


double curvature = 0.0 // minimum curvature


) const;


Divides a surface into separate pieces which are smooth (and therefore suitable for offsetting or blending). The surface is split if the curvature exceeds the minimum curvature argument. If it is closed after this, it is then split into two. The functions return the number of pieces. The split pieces are stored in pieces argument.






public: virtual logical cone::test_point_tol (


SPAposition const&,

// point


double

// tolerance



= 0,


SPApar_pos const&

// param guess



= * (SPApar_pos* ) NULL_REF,


SPApar_pos&

// actual param



= * (SPApar_pos* ) NULL_REF


) const;


Test if a point lies on the surface to user-supplied precision. Defaults to system precision (SPAresabs).






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


Returns type code for surface; i.e., cone_type.






public: virtual char const* cone::type_name () const;


Returns the string "cone".






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


Tests for uninitialized cone.






public: virtual curve* cone::u_param_line (


double // constant u-parameter


) const;


Construct a 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 or param_range_v appropriately. 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* cone::v_param_line (


double // constant v-parameter


) const;


Construct a 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_u or param_range_v appropriately. 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_cone






friend: cone operator* (


cone const&, // item to copy


SPAtransf const& // transform


);


Return a cone being (a copy of) this cone transformed by the given SPAtransf.
PDF/KERN/29CLC.PDF
HTM/DATA/KERN/KERN/29CLC/0004.HTM