Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-21 09:16:09

0001 // Created on: 1993-02-22
0002 // Created by: Modelistation
0003 // Copyright (c) 1993-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _Adaptor3d_CurveOnSurface_HeaderFile
0018 #define _Adaptor3d_CurveOnSurface_HeaderFile
0019 
0020 #include <Adaptor2d_Curve2d.hxx>
0021 #include <Adaptor3d_Surface.hxx>
0022 #include <GeomAbs_CurveType.hxx>
0023 #include <GeomAbs_Shape.hxx>
0024 #include <NCollection_Array1.hxx>
0025 #include <NCollection_Sequence.hxx>
0026 #include <NCollection_HSequence.hxx>
0027 
0028 //! An interface between the services provided by a curve
0029 //! lying on a surface from the package Geom and those
0030 //! required of the curve by algorithms which use it. The
0031 //! curve is defined as a 2D curve from the Geom2d
0032 //! package, in the parametric space of the surface.
0033 class Adaptor3d_CurveOnSurface : public Adaptor3d_Curve
0034 {
0035   DEFINE_STANDARD_RTTIEXT(Adaptor3d_CurveOnSurface, Adaptor3d_Curve)
0036 public:
0037   Standard_EXPORT Adaptor3d_CurveOnSurface();
0038 
0039   Standard_EXPORT Adaptor3d_CurveOnSurface(const occ::handle<Adaptor3d_Surface>& S);
0040 
0041   //! Creates a CurveOnSurface from the 2d curve <C> and
0042   //! the surface <S>.
0043   Standard_EXPORT Adaptor3d_CurveOnSurface(const occ::handle<Adaptor2d_Curve2d>& C,
0044                                            const occ::handle<Adaptor3d_Surface>& S);
0045 
0046   //! Shallow copy of adaptor
0047   Standard_EXPORT occ::handle<Adaptor3d_Curve> ShallowCopy() const override;
0048 
0049   //! Changes the surface.
0050   Standard_EXPORT void Load(const occ::handle<Adaptor3d_Surface>& S);
0051 
0052   //! Changes the 2d curve.
0053   Standard_EXPORT void Load(const occ::handle<Adaptor2d_Curve2d>& C);
0054 
0055   //! Load both curve and surface.
0056   Standard_EXPORT void Load(const occ::handle<Adaptor2d_Curve2d>& C,
0057                             const occ::handle<Adaptor3d_Surface>& S);
0058 
0059   Standard_EXPORT const occ::handle<Adaptor2d_Curve2d>& GetCurve() const;
0060 
0061   Standard_EXPORT const occ::handle<Adaptor3d_Surface>& GetSurface() const;
0062 
0063   Standard_EXPORT occ::handle<Adaptor2d_Curve2d>& ChangeCurve();
0064 
0065   Standard_EXPORT occ::handle<Adaptor3d_Surface>& ChangeSurface();
0066 
0067   Standard_EXPORT double FirstParameter() const override;
0068 
0069   Standard_EXPORT double LastParameter() const override;
0070 
0071   Standard_EXPORT GeomAbs_Shape Continuity() const override;
0072 
0073   //! Returns the number of intervals for continuity
0074   //! <S>. May be one if Continuity(me) >= <S>
0075   Standard_EXPORT int NbIntervals(const GeomAbs_Shape S) const override;
0076 
0077   //! Stores in <T> the parameters bounding the intervals
0078   //! of continuity <S>.
0079   //!
0080   //! The array must provide enough room to accommodate
0081   //! for the parameters. i.e. T.Length() > NbIntervals()
0082   Standard_EXPORT void Intervals(NCollection_Array1<double>& T,
0083                                  const GeomAbs_Shape         S) const override;
0084 
0085   //! Returns a curve equivalent of <me> between
0086   //! parameters <First> and <Last>. <Tol> is used to
0087   //! test for 3d points confusion.
0088   //! If <First> >= <Last>
0089   Standard_EXPORT occ::handle<Adaptor3d_Curve> Trim(const double First,
0090                                                     const double Last,
0091                                                     const double Tol) const override;
0092 
0093   Standard_EXPORT bool IsClosed() const override;
0094 
0095   Standard_EXPORT bool IsPeriodic() const override;
0096 
0097   Standard_EXPORT double Period() const override;
0098 
0099   //! Point evaluation. Raises an exception on failure.
0100   [[nodiscard]] Standard_EXPORT gp_Pnt EvalD0(const double theU) const final;
0101 
0102   //! D1 evaluation. Raises an exception on failure.
0103   [[nodiscard]] Standard_EXPORT Geom_Curve::ResD1 EvalD1(const double theU) const final;
0104 
0105   //! D2 evaluation. Raises an exception on failure.
0106   [[nodiscard]] Standard_EXPORT Geom_Curve::ResD2 EvalD2(const double theU) const final;
0107 
0108   //! D3 evaluation. Raises an exception on failure.
0109   [[nodiscard]] Standard_EXPORT Geom_Curve::ResD3 EvalD3(const double theU) const final;
0110 
0111   //! DN evaluation. Raises an exception on failure.
0112   [[nodiscard]] Standard_EXPORT gp_Vec EvalDN(const double theU, const int theN) const final;
0113 
0114   //! Returns the parametric resolution corresponding
0115   //! to the real space resolution <R3d>.
0116   Standard_EXPORT double Resolution(const double R3d) const override;
0117 
0118   //! Returns the type of the curve in the current
0119   //! interval: Line, Circle, Ellipse, Hyperbola,
0120   //! Parabola, BezierCurve, BSplineCurve, OtherCurve.
0121   Standard_EXPORT GeomAbs_CurveType GetType() const override;
0122 
0123   Standard_EXPORT gp_Lin Line() const override;
0124 
0125   Standard_EXPORT gp_Circ Circle() const override;
0126 
0127   Standard_EXPORT gp_Elips Ellipse() const override;
0128 
0129   Standard_EXPORT gp_Hypr Hyperbola() const override;
0130 
0131   Standard_EXPORT gp_Parab Parabola() const override;
0132 
0133   Standard_EXPORT int Degree() const override;
0134 
0135   Standard_EXPORT bool IsRational() const override;
0136 
0137   Standard_EXPORT int NbPoles() const override;
0138 
0139   Standard_EXPORT int NbKnots() const override;
0140 
0141   Standard_EXPORT occ::handle<Geom_BezierCurve> Bezier() const override;
0142 
0143   Standard_EXPORT occ::handle<Geom_BSplineCurve> BSpline() const override;
0144 
0145 private:
0146   Standard_EXPORT void EvalKPart();
0147 
0148   //! Evaluates myFirstSurf and myLastSurf
0149   //! for trimming the curve on surface.
0150   //! Following methods output left-bottom and right-top points
0151   //! of located part on surface
0152   //! for trimming the curve on surface.
0153   Standard_EXPORT void EvalFirstLastSurf();
0154 
0155   Standard_EXPORT void LocatePart(const gp_Pnt2d&                       UV,
0156                                   const gp_Vec2d&                       DUV,
0157                                   const occ::handle<Adaptor3d_Surface>& S,
0158                                   gp_Pnt2d&                             LeftBot,
0159                                   gp_Pnt2d&                             RightTop) const;
0160 
0161   Standard_EXPORT bool LocatePart_RevExt(const gp_Pnt2d&                       UV,
0162                                          const gp_Vec2d&                       DUV,
0163                                          const occ::handle<Adaptor3d_Surface>& S,
0164                                          gp_Pnt2d&                             LeftBot,
0165                                          gp_Pnt2d&                             RightTop) const;
0166 
0167   Standard_EXPORT bool LocatePart_Offset(const gp_Pnt2d&                       UV,
0168                                          const gp_Vec2d&                       DUV,
0169                                          const occ::handle<Adaptor3d_Surface>& S,
0170                                          gp_Pnt2d&                             LeftBot,
0171                                          gp_Pnt2d&                             RightTop) const;
0172 
0173   //! Extracts the numbers of knots which equal
0174   //! the point and checks derivative components
0175   //! by zero equivalence.
0176   Standard_EXPORT void FindBounds(const NCollection_Array1<double>& Arr,
0177                                   const double                      XYComp,
0178                                   const double                      DUVComp,
0179                                   int&                              Bnd1,
0180                                   int&                              Bnd2,
0181                                   bool&                             DerIsNull) const;
0182 
0183 private:
0184   occ::handle<Adaptor3d_Surface>             mySurface;
0185   occ::handle<Adaptor2d_Curve2d>             myCurve;
0186   GeomAbs_CurveType                          myType;
0187   gp_Circ                                    myCirc;
0188   gp_Lin                                     myLin;
0189   occ::handle<Adaptor3d_Surface>             myFirstSurf;
0190   occ::handle<Adaptor3d_Surface>             myLastSurf;
0191   occ::handle<NCollection_HSequence<double>> myIntervals;
0192   GeomAbs_Shape                              myIntCont;
0193 };
0194 
0195 #endif // _Adaptor3d_CurveOnSurface_HeaderFile