Open CASCADE Technology Reference Manual 8.0.0
Loading...
Searching...
No Matches
Data Structures | Functions
LProp_CurveUtils Namespace Reference

Template utility functions for CLProps curve local property computation. Provides access policies (DirectAccess, ToolAccess) and shared algorithms for evaluating derivatives, tangents, curvature, normals, and centres of curvature. More...

Data Structures

struct  DirectAccess
 Direct access policy: calls D0/D1/D2/D3 methods on the curve object. Works with occ::handle<T> and by-value curve types. More...
 
struct  ToolAccess
 Tool-based access policy: delegates to static Tool methods. Used for HLRBRep types where Tool class provides the interface. More...
 

Functions

template<typename T >
T & Deref (T &theObj)
 Dereference by-value or reference types (identity).
 
template<typename T >
T & Deref (occ::handle< T > &theHandle)
 Dereference occ::handle types.
 
template<typename T >
const T & Deref (const occ::handle< T > &theHandle)
 Dereference const occ::handle types.
 
template<typename Access , typename Curve , typename Pnt , typename Vec >
void EvalDerivatives (Curve &theCurve, double theU, int theOrder, Pnt &thePnt, Vec *theDerivArr)
 Evaluate curve derivatives at parameter theU up to specified order.
 
template<typename Access , typename Curve , typename Vec , typename Pnt , typename Dir >
void ComputeTangent (Curve &theCurve, double theU, const Vec *theDerivArr, const Pnt &, int theSigOrder, Dir &theDir)
 Compute tangent direction with sign correction for higher-order derivatives. When the first significant derivative has order > 1, the sign of the tangent is determined by comparing with the chord direction near the point.
 
template<typename Vec >
double ComputeCurvature (const Vec &theD1, const Vec &theD2, double theTolSq)
 Compute curvature from first and second derivatives. Returns |D1 x D2| / |D1|^3, or 0 if derivatives are collinear or D2 is null.
 
template<typename Vec , typename Dir >
void ComputeNormal (const Vec &theD1, const Vec &theD2, Dir &theDir)
 Compute normal direction from first and second derivatives. Normal = D2*(D1*D1) - D1*(D1*D2), using the vector triple product identity.
 
template<typename Vec , typename Pnt >
void ComputeCentreOfCurvature (const Pnt &thePnt, const Vec &theD1, const Vec &theD2, double theCurvature, Pnt &theCentre)
 Compute centre of curvature from point, derivatives, and curvature. Centre = Point + Normal / Curvature.
 
template<typename Access , typename Curve , typename Pnt , typename Vec >
void SetParameter (Curve &theCurve, double theU, double &theStoredU, int theDerOrder, Pnt &thePnt, Vec *theDerivArr, LProp_Status &theTanStatus)
 SetParameter wrapper: sets parameter, evaluates derivatives, resets tangent status.
 
template<typename Access , typename Curve , typename Pnt , typename Vec >
const Vec & EnsureDeriv (Curve &theCurve, double theU, int &theDerOrder, int theRequired, Pnt &thePnt, Vec *theDerivArr)
 Ensure derivatives up to the required order are computed.
 
template<typename Vec , typename Props >
bool IsTangentDefined (Props &theProps, int theCN, double theLinTol, int &theSigOrder, LProp_Status &theTanStatus)
 IsTangentDefined: searches for first non-null derivative. Calls theProps.D1(), theProps.D2(), theProps.D3() to upgrade derivatives as needed.
 
template<typename Access , typename Props , typename Curve , typename Vec , typename Pnt , typename Dir >
void Tangent (Props &theProps, Curve &theCurve, double theU, const Vec *theDerivArr, const Pnt &theRefPnt, const int &theSigOrder, Dir &theDir)
 Tangent: checks IsTangentDefined, then computes tangent direction.
 
template<typename Props , typename Vec >
double Curvature (Props &theProps, const Vec &theD1, const Vec &theD2, double theLinTol, const int &theSigOrder, double &theCurvature)
 Curvature: checks IsTangentDefined, returns RealLast if higher-order, else computes.
 
template<typename Props , typename Vec , typename Dir >
void Normal (Props &theProps, const Vec &theD1, const Vec &theD2, double theLinTol, Dir &theDir)
 Normal: checks curvature, then computes normal direction.
 
template<typename Props , typename Vec , typename Pnt >
void CentreOfCurvature (Props &theProps, const Pnt &thePnt, const Vec &theD1, const Vec &theD2, double theLinTol, double &theCurvature, Pnt &theCentre)
 CentreOfCurvature: checks curvature, then computes centre.
 

Detailed Description

Template utility functions for CLProps curve local property computation. Provides access policies (DirectAccess, ToolAccess) and shared algorithms for evaluating derivatives, tangents, curvature, normals, and centres of curvature.

Function Documentation

◆ CentreOfCurvature()

template<typename Props , typename Vec , typename Pnt >
void LProp_CurveUtils::CentreOfCurvature ( Props & theProps,
const Pnt & thePnt,
const Vec & theD1,
const Vec & theD2,
double theLinTol,
double & theCurvature,
Pnt & theCentre )

CentreOfCurvature: checks curvature, then computes centre.

Parameters
[in,out]thePropsCLProps object
[in]thePntcurrent point
[in]theD1first derivative
[in]theD2second derivative
[in]theLinTollinear tolerance
[in,out]theCurvaturecurvature value field
[out]theCentrecomputed centre of curvature

◆ ComputeCentreOfCurvature()

template<typename Vec , typename Pnt >
void LProp_CurveUtils::ComputeCentreOfCurvature ( const Pnt & thePnt,
const Vec & theD1,
const Vec & theD2,
double theCurvature,
Pnt & theCentre )

Compute centre of curvature from point, derivatives, and curvature. Centre = Point + Normal / Curvature.

Parameters
[in]thePntcurrent point
[in]theD1first derivative
[in]theD2second derivative
[in]theCurvaturecurvature value (must be non-zero)
[out]theCentrecomputed centre of curvature

◆ ComputeCurvature()

template<typename Vec >
double LProp_CurveUtils::ComputeCurvature ( const Vec & theD1,
const Vec & theD2,
double theTolSq )

Compute curvature from first and second derivatives. Returns |D1 x D2| / |D1|^3, or 0 if derivatives are collinear or D2 is null.

Parameters
[in]theD1first derivative
[in]theD2second derivative
[in]theTolSqsquared linear tolerance
Returns
curvature value

◆ ComputeNormal()

template<typename Vec , typename Dir >
void LProp_CurveUtils::ComputeNormal ( const Vec & theD1,
const Vec & theD2,
Dir & theDir )

Compute normal direction from first and second derivatives. Normal = D2*(D1*D1) - D1*(D1*D2), using the vector triple product identity.

Parameters
[in]theD1first derivative
[in]theD2second derivative
[out]theDircomputed normal direction

◆ ComputeTangent()

template<typename Access , typename Curve , typename Vec , typename Pnt , typename Dir >
void LProp_CurveUtils::ComputeTangent ( Curve & theCurve,
double theU,
const Vec * theDerivArr,
const Pnt & ,
int theSigOrder,
Dir & theDir )

Compute tangent direction with sign correction for higher-order derivatives. When the first significant derivative has order > 1, the sign of the tangent is determined by comparing with the chord direction near the point.

Parameters
[in,out]theCurvecurve object
[in]theUcurrent parameter
[in]theDerivArrderivative array
[in]theRefPntreference point (used only for type deduction)
[in]theSigOrderorder of first significant derivative
[out]theDircomputed tangent direction

◆ Curvature()

template<typename Props , typename Vec >
double LProp_CurveUtils::Curvature ( Props & theProps,
const Vec & theD1,
const Vec & theD2,
double theLinTol,
const int & theSigOrder,
double & theCurvature )

Curvature: checks IsTangentDefined, returns RealLast if higher-order, else computes.

Parameters
[in,out]thePropsCLProps object
[in]theD1first derivative
[in]theD2second derivative
[in]theLinTollinear tolerance
[in]theSigOrderorder of first significant derivative
[out]theCurvaturecurvature value field
Returns
computed curvature

◆ Deref() [1/3]

template<typename T >
const T & LProp_CurveUtils::Deref ( const occ::handle< T > & theHandle)

Dereference const occ::handle types.

◆ Deref() [2/3]

template<typename T >
T & LProp_CurveUtils::Deref ( occ::handle< T > & theHandle)

Dereference occ::handle types.

◆ Deref() [3/3]

template<typename T >
T & LProp_CurveUtils::Deref ( T & theObj)

Dereference by-value or reference types (identity).

◆ EnsureDeriv()

template<typename Access , typename Curve , typename Pnt , typename Vec >
const Vec & LProp_CurveUtils::EnsureDeriv ( Curve & theCurve,
double theU,
int & theDerOrder,
int theRequired,
Pnt & thePnt,
Vec * theDerivArr )

Ensure derivatives up to the required order are computed.

Parameters
[in,out]theCurvecurve object
[in]theUparameter value
[in,out]theDerOrdercurrent derivative order (upgraded if needed)
[in]theRequiredrequired derivative order
[out]thePntevaluated point
[out]theDerivArrderivative array
Returns
reference to theDerivArr[theRequired-1]

◆ EvalDerivatives()

template<typename Access , typename Curve , typename Pnt , typename Vec >
void LProp_CurveUtils::EvalDerivatives ( Curve & theCurve,
double theU,
int theOrder,
Pnt & thePnt,
Vec * theDerivArr )

Evaluate curve derivatives at parameter theU up to specified order.

Parameters
[in,out]theCurvecurve object
[in]theUparameter value
[in]theOrdermaximum derivative order (0-3)
[out]thePntevaluated point
[out]theDerivArrderivative array (size >= theOrder)

◆ IsTangentDefined()

template<typename Vec , typename Props >
bool LProp_CurveUtils::IsTangentDefined ( Props & theProps,
int theCN,
double theLinTol,
int & theSigOrder,
LProp_Status & theTanStatus )

IsTangentDefined: searches for first non-null derivative. Calls theProps.D1(), theProps.D2(), theProps.D3() to upgrade derivatives as needed.

Parameters
[in,out]thePropsCLProps object
[in]theCNcontinuity order
[in]theLinTollinear tolerance
[out]theSigOrderorder of first significant derivative
[in,out]theTanStatustangent status field
Returns
true if tangent is defined

◆ Normal()

template<typename Props , typename Vec , typename Dir >
void LProp_CurveUtils::Normal ( Props & theProps,
const Vec & theD1,
const Vec & theD2,
double theLinTol,
Dir & theDir )

Normal: checks curvature, then computes normal direction.

Parameters
[in,out]thePropsCLProps object
[in]theD1first derivative
[in]theD2second derivative
[in]theLinTollinear tolerance
[out]theDircomputed normal direction

◆ SetParameter()

template<typename Access , typename Curve , typename Pnt , typename Vec >
void LProp_CurveUtils::SetParameter ( Curve & theCurve,
double theU,
double & theStoredU,
int theDerOrder,
Pnt & thePnt,
Vec * theDerivArr,
LProp_Status & theTanStatus )

SetParameter wrapper: sets parameter, evaluates derivatives, resets tangent status.

Parameters
[in,out]theCurvecurve object
[in]theUparameter value
[out]theStoredUstored parameter field
[in]theDerOrdercurrent derivative order
[out]thePntevaluated point
[out]theDerivArrderivative array
[out]theTanStatustangent status field

◆ Tangent()

template<typename Access , typename Props , typename Curve , typename Vec , typename Pnt , typename Dir >
void LProp_CurveUtils::Tangent ( Props & theProps,
Curve & theCurve,
double theU,
const Vec * theDerivArr,
const Pnt & theRefPnt,
const int & theSigOrder,
Dir & theDir )

Tangent: checks IsTangentDefined, then computes tangent direction.

Parameters
[in,out]thePropsCLProps object
[in,out]theCurvecurve object
[in]theUcurrent parameter
[in]theDerivArrderivative array
[in]theRefPntreference point (for type deduction)
[in]theSigOrderorder of first significant derivative
[out]theDircomputed tangent direction