Purpose:
|
Defines an infinite straight line represented by a point and a unit vector specifying the direction.
|
|
Derivation:
|
straight : curve : ACIS_OBJECT : -
|
|
SAT Identifier:
|
"straight"
|
|
Filename:
|
kern/kernel/kerngeom/curve/strdef.hxx
|
|
Description:
|
This class defines an infinite straight line represented by a point and a unit vector specifying the direction. A
straight also has a scale factor for the parameterization, so the parameter values can be made invariant under transformation.
|
|
|
A straight line is an open curve that is not periodic. It is parameterized as:
|
|
|
point = root_point + t* param_scale* direction
|
|
|
where
t is the parameter.
|
|
References:
|
by KERN
|
STRAIGHT
|
|
BASE
|
SPAposition, SPAunit_vector
|
|
Data:
|
public SPAposition root_point;
|
|
A point through which the straight line passes.
|
|
|
public double param_scale;
|
|
The scaling factor for parameterization that allows fixed parameters despite transformation.
|
|
|
public SPAunit_vector direction;
|
|
The tangent along the line. A
NULL unit vector in an uninitialized straight line.
|
|
Constructor:
|
public: straight::straight
();
|
|
|
C++ allocation constructor requests memory for this object but does not populate it.
|
|
|
|
|
|
|
public: straight::straight
(
|
|
|
SPAposition const&,
|
// point
|
|
|
SPAunit_vector const&,
|
// direction
|
|
|
double
|
// parameter scaling
|
|
|
|
= 1.0
|
|
|
);
|
|
|
C++ initialize constructor requests memory for this object and populates it with the data supplied as arguments.
|
|
|
Creates a
straight using a point, a direction, and a parameter scaling.
|
|
|
|
|
|
|
public: straight::straight
(
|
|
|
straight const&
|
// straight line
|
|
|
);
|
|
|
C++ copy constructor requests memory for this object and populates it with the data from the object supplied as an argument.
|
|
|
|
|
Destructor:
|
public: straight::~straight
();
|
|
|
C++ destructor, deleting a
straight.
|
|
|
|
Methods:
|
public: virtual int straight::accurate_derivs
(
|
|
|
SPAinterval const&
|
|
|
// portion of
|
|
|
|
= * (SPAinterval*) NULL_REF
|
// the curve
|
|
|
) const;
|
|
|
Returns the number of derivatives that
evaluate can find accurately. For a straight, any number of derivatives can be calculated (which are all zero after the first) and so the value
ALL_CURVE_DERIVATIVES is returned.
|
|
|
|
|
|
|
public: SPAbox straight::bound
(
|
|
|
double start,
|
|
// start point
|
|
|
|
|
|
// on the line
|
|
|
double end,
|
|
// end point
|
|
|
|
|
|
// on the line
|
|
|
SPAtransf const& t
|
|
// transformation
|
|
|
|
= * (SPAtransf* ) NULL_REF
|
|
|
) const;
|
|
|
Returns a box enclosing the two given points on the straight line. This function is retained for historical reasons.
|
|
|
|
|
|
|
public: virtual SPAbox straight::bound
(
|
|
|
SPAbox const&,
|
|
// box
|
|
|
SPAtransf const&
|
|
// transformation
|
|
|
|
= * (SPAtransf* ) NULL_REF
|
|
|
) const;
|
|
|
Returns a box surrounding that portion of the curve within the given box.
|
|
|
|
|
|
|
public: virtual SPAbox straight::bound
(
|
|
|
SPAinterval const&,
|
|
// two given points
|
|
|
|
|
|
// represented as an
|
|
|
|
|
|
// interval
|
|
|
SPAtransf const&
|
|
// transformation
|
|
|
|
= * (SPAtransf* ) NULL_REF
|
|
|
) const;
|
|
|
Return a box enclosing the two given points on the straight line.
|
|
|
|
|
|
|
public: virtual SPAbox straight::bound
(
|
|
|
SPAposition const&,
|
|
// first position
|
|
|
SPAposition const&,
|
|
// second position
|
|
|
SPAtransf const&
|
|
// transformation
|
|
|
|
= * (SPAtransf* ) NULL_REF
|
|
|
) const;
|
|
|
Return a box enclosing the two given points on the straight line.
|
|
|
|
|
|
|
public: virtual logical straight::closed
() const;
|
|
|
Indicates if a curve is closed. This function joins itself (smoothly or not) at the ends of its principal parameter range. This function should always return
TRUE if
periodic does.
|
|
|
|
|
|
|
public: virtual void straight::debug
(
|
|
|
char const*,
|
// title line
|
|
|
FILE*
|
// file name
|
|
|
|
= debug_file_ptr
|
|
|
) const;
|
|
|
Outputs a title line and details about the straight line to the debug file or to the specified file.
|
|
|
|
|
|
|
public: virtual curve* straight::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 curve_boundcyl
|
|
|
straight::enclosing_cylinder (
|
|
|
const SPAinterval&
|
|
// interval
|
|
|
|
= * (SPAinterval*) NULL_REF
|
|
|
) const;
|
|
|
Returns a cylinder that encloses the portion of the curve bounded by the interval.
|
|
|
|
|
|
|
public: virtual void straight::eval
(
|
|
|
double,
|
|
// parameter value
|
|
|
SPAposition&,
|
|
// position
|
|
|
SPAvector&
|
|
// first derivative
|
|
|
|
= * (SPAvector* ) NULL_REF,
|
|
|
SPAvector&
|
|
// second derivative
|
|
|
|
= * (SPAvector* ) NULL_REF,
|
|
|
logical
|
|
// take advantage of
|
|
|
|
|
|
// report orders, so
|
|
|
|
|
|
// values don't
|
|
|
|
|
|
// have to be
|
|
|
|
|
|
// recomputed?
|
|
|
|
= FALSE,
|
|
|
logical
|
|
// approx ok?
|
|
|
|
= FALSE
|
|
|
) const;
|
|
|
Evaluate the curve at a given parameter value, giving the position, and first and second derivatives, all of which are optional.
|
|
|
|
|
|
|
public: virtual int straight::evaluate
(
|
|
|
double,
|
|
// parameter
|
|
|
SPAposition&,
|
|
// point on curve at
|
|
|
|
|
|
// given parameter
|
|
|
SPAvector**
|
|
// array of ptrs to
|
|
|
|
= NULL,
|
|
// vectors, size nd.
|
|
|
|
|
|
// any of the ptrs
|
|
|
|
|
|
// may be null, =>
|
|
|
|
|
|
// corresponding
|
|
|
|
|
|
// derivative won't
|
|
|
|
|
|
// be returned
|
|
|
int
|
|
|
// # derivatives
|
|
|
|
= 0,
|
|
// required (nd)
|
|
|
evaluate_curve_side
|
|
// the evaluation
|
|
|
|
= evaluate_curve_unknown
|
// location - above,
|
|
|
|
|
|
// below or don't
|
|
|
|
|
|
// care
|
|
|
) 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 will be equal to the number requested in all but the most exceptional circumstances. A certain number will be evaluated directly and (more or less) accurately; higher derivatives will be automatically calculated by finite differencing; the accuracy of these decreases with the order of the derivative, as the cost increases.
|
|
|
|
|
|
|
public: virtual SPAvector straight::eval_curvature
(
|
|
|
double,
|
// parameter
|
|
|
logical
|
// repeat order?
|
|
|
|
= FALSE,
|
|
|
logical
|
// approx ok?
|
|
|
|
= FALSE
|
|
|
) const;
|
|
|
Returns the curvature at a given parameter value. This is always zero, so all the arguments are ignored.
|
|
|
|
|
|
|
public: virtual double straight::eval_deriv_len
(
|
|
|
double,
|
// point
|
|
|
logical
|
// repeat order?
|
|
|
|
= FALSE,
|
|
|
logical
|
// approx ok?
|
|
|
|
= FALSE
|
|
|
) const;
|
|
|
Finds the magnitude of the derivative at the given parameter value on the curve.
|
|
|
|
|
|
|
public: virtual curve_extremum*
|
|
|
straight::find_extrema (
|
|
|
SPAunit_vector const&
|
// direction
|
|
|
) const;
|
|
|
Finds the extrema of the curve in the given direction. A straight line has no extrema, so this method returns
NULL.
|
|
|
|
|
|
|
public: virtual int straight::high_curvature
(
|
|
|
double k,
|
// maximum curvature
|
|
|
SPAinterval*& spans
|
// interval list
|
|
) const;
|
|
|
Finds regions of high curvature of the curve. This method stores an array of intervals in spans argument over which the curvature exceeds k. It returns the number of intervals stored.
|
|
|
|
|
|
|
public: law* straight::law_form
();
|
|
|
Returns the law form of the
straight entity.
|
|
|
|
|
|
|
public: virtual double straight::length
(
|
|
|
double,
|
// start parameter
|
|
|
double
|
// end parameter
|
|
|
) const;
|
|
|
Return the algebraic distance along the curve between the given parameters, the sign being positive if the parameter values are given in increasing order, and negative if they are in decreasing order. The result is undefined if either parameter value is outside the parameter range of a bounded curve. For a periodic curve the parameters are not reduced to the principal range, and so the portion of the curve evaluated may include several complete circuits. This function is therefore always a monotonically increasing function of its second argument if the first is held constant, and a decreasing function of its first argument if the second is held constant.
|
|
|
|
|
|
|
public: virtual double straight::length_param
(
|
|
|
double,
|
// datum parameter
|
|
|
double
|
// arc length
|
|
|
) const;
|
|
|
Returns the parameter value of the point on the curve at the given algebraic arc length from that defined by the datum parameter. This method is the inverse of the length method. The result is not defined for a bounded nonperiodic curve if the datum parameter is outside the parameter range, or if the length is outside the range bounded by the values for the ends of the parameter range.
|
|
|
|
|
|
|
public: virtual curve* straight::make_copy
() const;
|
|
|
Makes a copy of this
straight on the heap, and returns a pointer to it.
|
|
|
|
|
|
|
public: virtual curve& straight::negate
();
|
|
|
Negates this straight line (i.e., this method negates the direction).
|
|
|
|
|
|
|
public: virtual curve& straight::operator*=
(
|
|
|
SPAtransf const&
|
// transformation
|
|
|
);
|
|
|
Transforms this straight line by the given transformation.
|
|
|
|
|
|
|
public: straight straight::operator-
() const;
|
|
|
Returns a straight line with the opposite sense from this line.
|
|
|
|
|
|
|
public: virtual logical straight::operator==
(
|
|
|
curve const&
|
// curve
|
|
|
) const;
|
|
|
Tests two curves for equality. This method does not guarantee equality for effectively-equal curves, but it is guaranteed to determine inequality if the two curves are not equal. Use this result for optimization.
|
|
|
|
|
|
|
public: virtual double straight::param
(
|
|
|
SPAposition const&,
|
|
|
// position
|
|
|
SPAparameter const&
|
|
|
// param guess
|
|
|
|
= * (SPAparameter* ) NULL_REF
|
|
|
) const;
|
|
|
Finds the parameter value at the given point on the curve. If the point is not on the curve, a plane is constructed perpendicular to the line, and the parameter value for its intersection with the line returns.
|
|
|
|
|
|
|
public: virtual double
|
|
|
straight::param_period () const;
|
|
|
Returns the parameter period, 0 in this case because a straight line is not periodic
|
|
|
|
|
|
|
public: virtual SPAinterval straight::param_range
(
|
|
|
SPAbox const&
|
// box
|
|
|
|
= * (SPAbox* ) NULL_REF
|
|
|
) const;
|
|
|
Returns the principal parameter range, or what is inside the given box, if one is indeed given. If there is no box, the range is unbounded, and we return the empty interval.
|
|
|
|
|
|
|
public: virtual logical straight::periodic
() const;
|
|
|
Indicates if the curve is periodic and joins itself smoothly at the ends of its principal parameter range, so that edges may span the seam.
|
|
|
|
|
|
|
public: virtual SPAvector straight::point_curvature
(
|
|
|
SPAposition const&,
|
|
|
// point
|
|
|
SPAparameter const&
|
|
|
// param guess
|
|
|
|
= * (SPAparameter* ) NULL_REF
|
|
|
) const;
|
|
|
Returns the curvature, which is 0 for a straight line. It is immaterial whether the point is on or off the curve. The
SPAparameter argument is ignored.
|
|
|
|
|
|
|
public: virtual
|
|
|
SPAunit_vector straight::point_direction (
|
|
|
SPAposition const&,
|
|
|
// position
|
|
|
SPAparameter const&
|
|
|
// param guess
|
|
|
|
= * (SPAparameter* ) NULL_REF
|
|
|
) const;
|
|
|
Returns the direction of the curve at a point on it. This is a constant for a straight line, so it is immaterial whether the given point is on or off the curve.
|
|
|
|
|
|
|
public: virtual void straight::point_perp
(
|
|
|
SPAposition const&,
|
|
|
// position
|
|
|
SPAposition&,
|
|
|
// foot
|
|
|
SPAunit_vector&,
|
|
|
// curve
|
|
|
|
|
|
|
// direction at
|
|
|
|
|
|
|
// foot
|
|
|
SPAvector&,
|
|
|
// curvature at
|
|
|
|
|
|
|
// foot
|
|
|
SPAparameter const&
|
|
|
// param guess
|
|
|
|
= * (SPAparameter* ) NULL_REF,
|
|
|
SPAparameter&
|
|
|
// actual param
|
|
|
|
= * (SPAparameter* ) NULL_REF,
|
|
|
logical f_weak
|
// weak flag
|
|
|
|
= FALSE
|
|
|
) const;
|
|
|
Finds the foot of the perpendicular from the given point to the curve, and tangent to the curve at that point, and its parameter value. If an input parameter value is supplied (as argument 5), the perpendicular found is the one nearest to the supplied parameter position, otherwise it is the one at which the curve is nearest to the given point. Any of the return value arguments may be a
NULL reference, in which case it is simply ignored.
|
|
|
|
|
|
|
public: void straight::point_perp
(
|
|
|
SPAposition const& pos,
|
|
|
// position
|
|
|
SPAposition& foot,
|
|
|
// foot
|
|
|
SPAparameter const& guess
|
|
// param guess
|
|
|
|
= * (SPAparameter* ) NULL_REF,
|
|
|
SPAparameter& actual
|
|
|
// actual param
|
|
|
|
= * (SPAparameter* ) NULL_REF,
|
|
|
logical f_weak
|
// weak flag
|
|
|
|
= FALSE
|
|
|
) const;
|
|
|
Find the foot of the perpendicular from the given point to the curve, and tangent to the curve at that point, and its parameter value
|
|
|
|
|
|
|
public: void straight::point_perp
(
|
|
|
SPAposition const& pos,
|
|
|
// position
|
|
|
SPAposition& foot,
|
|
|
// foot
|
|
|
SPAunit_vector& foot_dt,
|
|
|
// tangent to
|
|
|
|
|
|
|
// curve at foot
|
|
|
SPAparameter const& guess
|
|
// param guess
|
|
|
|
= * (SPAparameter* ) NULL_REF,
|
|
|
SPAparameter& actual
|
|
|
// actual param
|
|
|
|
= * (SPAparameter* ) NULL_REF,
|
|
|
logical f_weak
|
// weak flag
|
|
|
|
= FALSE
|
|
|
) const;
|
|
|
Drop a perpendicular from the given point to the line, returning the foot of the perpendicular, and the curve direction there.
|
|
|
|
|
|
|
public: void straight::restore_data
();
|
|
|
Restore the data for a
straight from a save file.
|
|
|
read_position
|
Root point
|
|
read_vector
|
The direction of straight
|
|
curve::restore_data
|
|
Restore the rest of the curve data.
|
|
|
|
|
|
|
public: virtual void straight::save
() const;
|
|
|
Saves the type or id, then calls
save_data.
|
|
|
|
|
|
|
public: void straight::save_data
() const;
|
|
|
Save the information for the
straight to a save file.
|
|
|
|
|
|
|
public: virtual curve_tancone
|
|
|
straight::tangent_cone (
|
|
|
SPAinterval const&,
|
|
// line interval
|
|
|
logical,
|
|
// approx results OK?
|
|
|
SPAtransf const&
|
|
// transformation
|
|
|
|
= * (SPAtransf* ) NULL_REF
|
|
|
) const;
|
|
|
Returns a cone bounding the tangent direction of a curve. The cone has its apex at the origin, and it has a given axis direction and positive half-angle. If logical is
TRUE, then approximate results are found. The approximate result may lie wholly within or wholly outside the guaranteed bound (obtained with the
FALSE argument), but it may not cross from side to outside. Flags in the returned object indicate whether the cone is the best available, and if the result is inside or outside the best cone.
|
|
|
|
|
|
|
public: virtual logical straight::test_point_tol
(
|
|
|
SPAposition const&,
|
|
|
// point
|
|
|
double
|
|
|
// tolerance
|
|
|
|
= 0,
|
|
|
SPAparameter const&
|
|
|
// param guess
|
|
|
|
= * (SPAparameter* ) NULL_REF,
|
|
|
SPAparameter&
|
|
|
// actual param
|
|
|
|
= * (SPAparameter* ) NULL_REF
|
|
|
) const;
|
|
|
Tests a point on the curve, returning the parameter value if it is required.
|
|
|
|
|
|
|
public: virtual int straight::type
() const;
|
|
|
Returns the type of
straight.
|
|
|
|
|
|
|
public: virtual char const*
|
|
|
straight::type_name () const;
|
|
|
Returns a string "straight".
|
|
|
|
|
|
|
public: logical straight::undef
() const;
|
|
|
Determines whether this curve is undefined.
|
|
Internal Use:
|
full_size
|
|
|
|
|
Related Fncs:
|
restore_straight
|
|
|
|
|
|
|
friend: straight operator* (
|
|
|
straight const&,
|
// input straight
|
|
|
SPAtransf const&
|
// transform to use
|
|
|
);
|
|
|
Transforms the given straight by the transform given.
|