OCCT3D OCCT 8.0.1
OCCT documentation

Search guides and API reference

Enter at least two characters.

    Open CASCADE Technology Reference Manual 8.0.1
    ShapeConstruct_ProjectCurveOnSurface Class Reference

    This tool provides a method for computing pcurve by projecting 3d curve onto a surface. Projection is done by 23 or more points (this number is changed for B-Splines according to the following rule: the total number of the points is not less than number of spans * (degree + 1); it is increased recursively starting with 23 and is added with 22 until the condition is fulfilled). Isoparametric cases (if curve corresponds to U=const or V=const on the surface) are recognized with the given precision. More...

    #include <ShapeConstruct_ProjectCurveOnSurface.hxx>

    Inheritance diagram for ShapeConstruct_ProjectCurveOnSurface:

    Public Types

    using ArrayOfPnt = NCollection_Array1<gp_Pnt>
    using ArrayOfPnt2d = NCollection_Array1<gp_Pnt2d>
    using ArrayOfReal = NCollection_Array1<double>
    using CachePoint = std::pair<gp_Pnt, gp_Pnt2d>
    using CacheArray = NCollection_Array1<CachePoint>
    typedef void base_type
     Returns a type descriptor about this object.

    Public Member Functions

     ShapeConstruct_ProjectCurveOnSurface ()
     Empty constructor.
    virtual void Init (const occ::handle< Geom_Surface > &theSurf, const double thePreci)
     Initializes the object with all necessary parameters, i.e. surface and precision.
    virtual void Init (const occ::handle< ShapeAnalysis_Surface > &theSurf, const double thePreci)
     Initializes the object with all necessary parameters, i.e. surface and precision.
    void SetSurface (const occ::handle< Geom_Surface > &theSurf)
     Loads a surface (in the form of Geom_Surface) to project on.
    void SetSurface (const occ::handle< ShapeAnalysis_Surface > &theSurf)
     Loads a surface (in the form of ShapeAnalysis_Surface) to project on.
    void SetPrecision (const double thePreci)
     Sets value for current precision.
    int & AdjustOverDegenMode ()
     Returns (modifiable) the flag specifying to which side of parametrical space adjust part of pcurve which lies on seam. This is required in very rare case when 3d curve which is to be projected goes partly along the seam on the closed surface with singularity (e.g. sphere), goes through the degenerated point and partly lies on internal area of surface.
    bool Status (const ShapeExtend_Status theStatus) const
     Returns the status of last Perform.
    virtual bool Perform (const occ::handle< Geom_Curve > &theC3D, const double theFirst, const double theLast, occ::handle< Geom2d_Curve > &theC2D, const double theTolFirst=Precision::Confusion(), const double theTolLast=Precision::Confusion())
     Computes the projection of 3d curve onto a surface using the specialized algorithm. Returns False if projector fails, otherwise, if pcurve computed successfully, returns True. The output curve 2D is guaranteed to be same-parameter with input curve 3D on the interval [theFirst, theLast]. If the output curve lies on a direct line the infinite line is returned, in the case same-parameter condition is satisfied.
    Public Member Functions inherited from Standard_Transient
     Standard_Transient ()
     Empty constructor.
     Standard_Transient (const Standard_Transient &)
     Copy constructor – does nothing.
    Standard_Transientoperator= (const Standard_Transient &)
     Assignment operator, needed to avoid copying reference counter.
    virtual ~Standard_Transient ()=default
     Destructor must be virtual.
    virtual const opencascade::handle< Standard_Type > & DynamicType () const
     Returns a type descriptor about this object.
    bool IsInstance (const opencascade::handle< Standard_Type > &theType) const
     Returns a true value if this is an instance of Type.
    bool IsInstance (const char *const theTypeName) const
     Returns a true value if this is an instance of TypeName.
    bool IsKind (const opencascade::handle< Standard_Type > &theType) const
     Returns true if this is an instance of Type or an instance of any class that inherits from Type. Note that multiple inheritance is not supported by OCCT RTTI mechanism.
    bool IsKind (const char *const theTypeName) const
     Returns true if this is an instance of TypeName or an instance of any class that inherits from TypeName. Note that multiple inheritance is not supported by OCCT RTTI mechanism.
    Standard_TransientThis () const
     Returns non-const pointer to this object (like const_cast). For protection against creating handle to objects allocated in stack or call from constructor, it will raise exception Standard_ProgramError if reference counter is zero.
    int GetRefCount () const noexcept
     Get the reference counter of this object.
    void IncrementRefCounter () noexcept
     Increments the reference counter of this object. Uses relaxed memory ordering since incrementing only requires atomicity, not synchronization with other memory operations.
    int DecrementRefCounter () noexcept
     Decrements the reference counter of this object; returns the decremented value. Uses release ordering for the decrement to ensure all writes to the object are visible before the count reaches zero. An acquire fence is added only when the count reaches zero, ensuring proper synchronization before deletion. This is more efficient than using acq_rel for every decrement.
    virtual void Delete () const
     Memory deallocator for transient classes.

    Protected Member Functions

    occ::handle< Geom2d_CurvegetLine (const ArrayOfPnt &thePoints, const ArrayOfReal &theParams, ArrayOfPnt2d &thePoints2d, const double theTol, bool &theIsRecompute, bool &theIsFromCache) const
     Try to approximate 3D curve by Geom2d_Line or Geom2d_BSplineCurve with degree 1 with specified tolerance.
    bool PerformByProjLib (const occ::handle< Geom_Curve > &theC3D, const double theFirst, const double theLast, occ::handle< Geom2d_Curve > &theC2D)
     Computes the projection of 3d curve onto a surface using the standard algorithm from ProjLib. Returns False if standard projector fails or raises an exception or cuts the curve by parametrical bounds of the surface. Else, if pcurve computed successfully, returns True.
    occ::handle< Geom2d_CurveprojectAnalytic (const occ::handle< Geom_Curve > &theC3D) const
     Performs analytical projection for special cases (plane surfaces).
    bool approxPCurve (const int theNbPnt, const occ::handle< Geom_Curve > &theC3D, const double theTolFirst, const double theTolLast, ArrayOfPnt &thePoints, ArrayOfReal &theParams, ArrayOfPnt2d &thePoints2d, occ::handle< Geom2d_Curve > &theC2D)
     Main approximation routine for pcurve computation.
    void correctExtremity (const occ::handle< Geom_Curve > &theC3D, const ArrayOfReal &theParams, ArrayOfPnt2d &thePoints2d, const bool theIsFirstPoint, const gp_Pnt2d &thePointOnIsoLine, const bool theIsUIso)
     Corrects extremity point near singularity.
    void insertAdditionalPointOrAdjust (bool &theToAdjust, const int theIndCoord, const double thePeriod, const double theTolOnPeriod, double &theCurCoord, const double thePrevCoord, const occ::handle< Geom_Curve > &theC3D, int &theIndex, ArrayOfPnt &thePoints, ArrayOfReal &theParams, ArrayOfPnt2d &thePoints2d)
     Inserts additional point or adjusts coordinate to handle period jumps.
    occ::handle< Geom2d_CurveinterpolatePCurve (const int theNbPnt, const ArrayOfPnt2d &thePoints2d, const ArrayOfReal &theParams) const
     Interpolates 2D curve from points.
    occ::handle< Geom2d_CurveapproximatePCurve (const ArrayOfPnt2d &thePoints2d, const ArrayOfReal &theParams) const
     Approximates 2D curve from points.
    void checkPoints (ArrayOfPnt &thePoints, ArrayOfReal &theParams, double &thePreci) const
     Checks and removes coincident 3D points.
    void checkPoints2d (ArrayOfPnt2d &thePoints2d, ArrayOfReal &theParams, double &thePreci) const
     Checks and removes coincident 2D points.
    bool isAnIsoparametric (const int theNbPnt, const ArrayOfPnt &thePoints, const ArrayOfReal &theParams, bool &theIsTypeU, bool &theP1OnIso, gp_Pnt2d &theValueP1, bool &theP2OnIso, gp_Pnt2d &theValueP2, bool &theIsoPar2d3d, occ::handle< Geom_Curve > &theCIso, double &theT1, double &theT2, ArrayOfReal &theParamsOut) const
     Detects if curve is isoparametric (U=const or V=const).

    Additional Inherited Members

    static constexpr const char * get_type_name ()
     Returns a type descriptor about this object.
    static const opencascade::handle< Standard_Type > & get_type_descriptor ()
     Returns type descriptor of Standard_Transient class.

    Detailed Description

    This tool provides a method for computing pcurve by projecting 3d curve onto a surface. Projection is done by 23 or more points (this number is changed for B-Splines according to the following rule: the total number of the points is not less than number of spans * (degree + 1); it is increased recursively starting with 23 and is added with 22 until the condition is fulfilled). Isoparametric cases (if curve corresponds to U=const or V=const on the surface) are recognized with the given precision.

    Member Typedef Documentation

    ◆ ArrayOfPnt

    ◆ ArrayOfPnt2d

    ◆ ArrayOfReal

    ◆ CacheArray

    ◆ CachePoint

    Constructor & Destructor Documentation

    ◆ ShapeConstruct_ProjectCurveOnSurface()

    ShapeConstruct_ProjectCurveOnSurface::ShapeConstruct_ProjectCurveOnSurface ( )

    Empty constructor.

    Member Function Documentation

    ◆ AdjustOverDegenMode()

    int & ShapeConstruct_ProjectCurveOnSurface::AdjustOverDegenMode ( )

    Returns (modifiable) the flag specifying to which side of parametrical space adjust part of pcurve which lies on seam. This is required in very rare case when 3d curve which is to be projected goes partly along the seam on the closed surface with singularity (e.g. sphere), goes through the degenerated point and partly lies on internal area of surface.

    If this flag is True, the seam part of such curve will be adjusted to the left side of parametric space (on sphere U=0), else to the right side (on sphere U=2*PI) Default value is True

    Returns
    modifiable reference to the adjustment flag

    ◆ approximatePCurve()

    occ::handle< Geom2d_Curve > ShapeConstruct_ProjectCurveOnSurface::approximatePCurve ( const ArrayOfPnt2d & thePoints2d,
    const ArrayOfReal & theParams ) const
    protected

    Approximates 2D curve from points.

    Parameters
    [in]thePoints2darray of 2D points
    [in]theParamsarray of parameters
    Returns
    the approximated 2D curve or null on failure

    ◆ approxPCurve()

    bool ShapeConstruct_ProjectCurveOnSurface::approxPCurve ( const int theNbPnt,
    const occ::handle< Geom_Curve > & theC3D,
    const double theTolFirst,
    const double theTolLast,
    ArrayOfPnt & thePoints,
    ArrayOfReal & theParams,
    ArrayOfPnt2d & thePoints2d,
    occ::handle< Geom2d_Curve > & theC2D )
    protected

    Main approximation routine for pcurve computation.

    Parameters
    [in]theNbPntnumber of points
    [in]theC3Dthe 3D curve
    [in]theTolFirsttolerance at first point
    [in]theTolLasttolerance at last point
    [in,out]thePointsarray of 3D points
    [in,out]theParamsarray of parameters
    [out]thePoints2darray of 2D points
    [out]theC2Dresulting 2D curve
    Returns
    true if approximation succeeded

    ◆ checkPoints()

    void ShapeConstruct_ProjectCurveOnSurface::checkPoints ( ArrayOfPnt & thePoints,
    ArrayOfReal & theParams,
    double & thePreci ) const
    protected

    Checks and removes coincident 3D points.

    Parameters
    [in,out]thePointsarray of 3D points
    [in,out]theParamsarray of parameters
    [in,out]thePreciprecision (may be adjusted)

    ◆ checkPoints2d()

    void ShapeConstruct_ProjectCurveOnSurface::checkPoints2d ( ArrayOfPnt2d & thePoints2d,
    ArrayOfReal & theParams,
    double & thePreci ) const
    protected

    Checks and removes coincident 2D points.

    Parameters
    [in,out]thePoints2darray of 2D points
    [in,out]theParamsarray of parameters
    [in,out]thePreciprecision (may be adjusted)

    ◆ correctExtremity()

    void ShapeConstruct_ProjectCurveOnSurface::correctExtremity ( const occ::handle< Geom_Curve > & theC3D,
    const ArrayOfReal & theParams,
    ArrayOfPnt2d & thePoints2d,
    const bool theIsFirstPoint,
    const gp_Pnt2d & thePointOnIsoLine,
    const bool theIsUIso )
    protected

    Corrects extremity point near singularity.

    Parameters
    [in]theC3Dthe 3D curve
    [in]theParamsarray of parameters
    [in,out]thePoints2darray of 2D points
    [in]theIsFirstPointtrue if correcting first point, false for last
    [in]thePointOnIsoLinepoint on isoline
    [in]theIsUIsotrue if U-isoline, false if V-isoline

    ◆ getLine()

    occ::handle< Geom2d_Curve > ShapeConstruct_ProjectCurveOnSurface::getLine ( const ArrayOfPnt & thePoints,
    const ArrayOfReal & theParams,
    ArrayOfPnt2d & thePoints2d,
    const double theTol,
    bool & theIsRecompute,
    bool & theIsFromCache ) const
    protected

    Try to approximate 3D curve by Geom2d_Line or Geom2d_BSplineCurve with degree 1 with specified tolerance.

    Parameters
    [in]thePointspoints obtained from 3d curve
    [in]theParamsparameters corresponding points on 3d curve
    [out]thePoints2d2d points lies on line in parametric space
    [in]theToltolerance used for compare initial points 3d and 3d points obtained from line lying in parametric space of surface
    [out]theIsRecomputeflag indicating if recomputation is needed
    [out]theIsFromCacheflag indicating if result is from cache
    Returns
    the resulting 2D curve or null if line fitting failed

    ◆ Init() [1/2]

    virtual void ShapeConstruct_ProjectCurveOnSurface::Init ( const occ::handle< Geom_Surface > & theSurf,
    const double thePreci )
    virtual

    Initializes the object with all necessary parameters, i.e. surface and precision.

    Parameters
    [in]theSurfthe surface to project on
    [in]thePrecithe precision for projection

    ◆ Init() [2/2]

    virtual void ShapeConstruct_ProjectCurveOnSurface::Init ( const occ::handle< ShapeAnalysis_Surface > & theSurf,
    const double thePreci )
    virtual

    Initializes the object with all necessary parameters, i.e. surface and precision.

    Parameters
    [in]theSurfthe surface to project on (ShapeAnalysis_Surface)
    [in]thePrecithe precision for projection

    ◆ insertAdditionalPointOrAdjust()

    void ShapeConstruct_ProjectCurveOnSurface::insertAdditionalPointOrAdjust ( bool & theToAdjust,
    const int theIndCoord,
    const double thePeriod,
    const double theTolOnPeriod,
    double & theCurCoord,
    const double thePrevCoord,
    const occ::handle< Geom_Curve > & theC3D,
    int & theIndex,
    ArrayOfPnt & thePoints,
    ArrayOfReal & theParams,
    ArrayOfPnt2d & thePoints2d )
    protected

    Inserts additional point or adjusts coordinate to handle period jumps.

    Parameters
    [in,out]theToAdjustflag indicating if adjustment should be done
    [in]theIndCoordcoordinate index (1=U, 2=V)
    [in]thePeriodthe period value
    [in]theTolOnPeriodtolerance on period
    [in,out]theCurCoordcurrent coordinate value
    [in]thePrevCoordprevious coordinate value
    [in]theC3Dthe 3D curve
    [in,out]theIndexcurrent point index
    [in,out]thePointsarray of 3D points
    [in,out]theParamsarray of parameters
    [in,out]thePoints2darray of 2D points

    ◆ interpolatePCurve()

    occ::handle< Geom2d_Curve > ShapeConstruct_ProjectCurveOnSurface::interpolatePCurve ( const int theNbPnt,
    const ArrayOfPnt2d & thePoints2d,
    const ArrayOfReal & theParams ) const
    protected

    Interpolates 2D curve from points.

    Parameters
    [in]theNbPntnumber of points
    [in]thePoints2darray of 2D points
    [in]theParamsarray of parameters
    Returns
    the interpolated 2D curve or null on failure

    ◆ isAnIsoparametric()

    bool ShapeConstruct_ProjectCurveOnSurface::isAnIsoparametric ( const int theNbPnt,
    const ArrayOfPnt & thePoints,
    const ArrayOfReal & theParams,
    bool & theIsTypeU,
    bool & theP1OnIso,
    gp_Pnt2d & theValueP1,
    bool & theP2OnIso,
    gp_Pnt2d & theValueP2,
    bool & theIsoPar2d3d,
    occ::handle< Geom_Curve > & theCIso,
    double & theT1,
    double & theT2,
    ArrayOfReal & theParamsOut ) const
    protected

    Detects if curve is isoparametric (U=const or V=const).

    Parameters
    [in]theNbPntnumber of points
    [in]thePointsarray of 3D points
    [in]theParamsarray of parameters
    [out]theIsTypeUtrue if U-iso, false if V-iso
    [out]theP1OnIsotrue if first point is on iso
    [out]theValueP12D value of first point on iso
    [out]theP2OnIsotrue if last point is on iso
    [out]theValueP22D value of last point on iso
    [out]theIsoPar2d3dtrue if parametrization matches
    [out]theCIsothe isoline curve
    [out]theT1first iso parameter
    [out]theT2last iso parameter
    [out]theParamsOutoutput parameters on isoline
    Returns
    true if curve is isoparametric

    ◆ Perform()

    virtual bool ShapeConstruct_ProjectCurveOnSurface::Perform ( const occ::handle< Geom_Curve > & theC3D,
    const double theFirst,
    const double theLast,
    occ::handle< Geom2d_Curve > & theC2D,
    const double theTolFirst = Precision::Confusion(),
    const double theTolLast = Precision::Confusion() )
    virtual

    Computes the projection of 3d curve onto a surface using the specialized algorithm. Returns False if projector fails, otherwise, if pcurve computed successfully, returns True. The output curve 2D is guaranteed to be same-parameter with input curve 3D on the interval [theFirst, theLast]. If the output curve lies on a direct line the infinite line is returned, in the case same-parameter condition is satisfied.

    Parameters
    [in]theC3Dthe 3D curve to project
    [in]theFirstthe first parameter of the curve
    [in]theLastthe last parameter of the curve
    [out]theC2Dthe resulting 2D curve
    [in]theTolFirstthe tolerance at the first point (default: Precision::Confusion())
    [in]theTolLastthe tolerance at the last point (default: Precision::Confusion())
    Returns
    true if projection succeeded

    ◆ PerformByProjLib()

    bool ShapeConstruct_ProjectCurveOnSurface::PerformByProjLib ( const occ::handle< Geom_Curve > & theC3D,
    const double theFirst,
    const double theLast,
    occ::handle< Geom2d_Curve > & theC2D )
    protected

    Computes the projection of 3d curve onto a surface using the standard algorithm from ProjLib. Returns False if standard projector fails or raises an exception or cuts the curve by parametrical bounds of the surface. Else, if pcurve computed successfully, returns True.

    Parameters
    [in]theC3Dthe 3D curve to project
    [in]theFirstthe first parameter of the curve
    [in]theLastthe last parameter of the curve
    [out]theC2Dthe resulting 2D curve
    Returns
    true if projection succeeded

    ◆ projectAnalytic()

    occ::handle< Geom2d_Curve > ShapeConstruct_ProjectCurveOnSurface::projectAnalytic ( const occ::handle< Geom_Curve > & theC3D) const
    protected

    Performs analytical projection for special cases (plane surfaces).

    Parameters
    [in]theC3Dthe 3D curve to project
    Returns
    the resulting 2D curve or null if analytical projection not applicable

    ◆ SetPrecision()

    void ShapeConstruct_ProjectCurveOnSurface::SetPrecision ( const double thePreci)

    Sets value for current precision.

    Parameters
    [in]thePrecithe precision value

    ◆ SetSurface() [1/2]

    void ShapeConstruct_ProjectCurveOnSurface::SetSurface ( const occ::handle< Geom_Surface > & theSurf)

    Loads a surface (in the form of Geom_Surface) to project on.

    Parameters
    [in]theSurfthe surface to project on

    ◆ SetSurface() [2/2]

    void ShapeConstruct_ProjectCurveOnSurface::SetSurface ( const occ::handle< ShapeAnalysis_Surface > & theSurf)

    Loads a surface (in the form of ShapeAnalysis_Surface) to project on.

    Parameters
    [in]theSurfthe surface to project on

    ◆ Status()

    bool ShapeConstruct_ProjectCurveOnSurface::Status ( const ShapeExtend_Status theStatus) const

    Returns the status of last Perform.

    Parameters
    [in]theStatusthe status to query
    Returns
    true if the specified status is set

    The documentation for this class was generated from the following file: