Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Copyright (c) 1993-1999 Matra Datavision
0002 // Copyright (c) 1999-2024 OPEN CASCADE SAS
0003 //
0004 // This file is part of Open CASCADE Technology software library.
0005 //
0006 // This library is free software; you can redistribute it and/or modify it under
0007 // the terms of the GNU Lesser General Public License version 2.1 as published
0008 // by the Free Software Foundation, with special exception defined in the file
0009 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0010 // distribution for complete text of the license and disclaimer of any warranty.
0011 //
0012 // Alternatively, this file may be used under the terms of Open CASCADE
0013 // commercial license or contractual agreement.
0014 
0015 #ifndef _IntCurveSurface_TheHCurveTool_HeaderFile
0016 #define _IntCurveSurface_TheHCurveTool_HeaderFile
0017 
0018 #include <Adaptor3d_Curve.hxx>
0019 #include <GeomAbs_CurveType.hxx>
0020 #include <GeomAbs_Shape.hxx>
0021 #include <Geom_BSplineCurve.hxx>
0022 #include <Geom_BezierCurve.hxx>
0023 #include <NCollection_Array1.hxx>
0024 #include <NCollection_HArray1.hxx>
0025 #include <gp_Circ.hxx>
0026 #include <gp_Elips.hxx>
0027 #include <gp_Hypr.hxx>
0028 #include <gp_Lin.hxx>
0029 #include <gp_Parab.hxx>
0030 #include <gp_Pnt.hxx>
0031 #include <gp_Vec.hxx>
0032 
0033 class Standard_OutOfRange;
0034 class Standard_NoSuchObject;
0035 class Standard_DomainError;
0036 class gp_Pnt;
0037 class gp_Vec;
0038 class Geom_BezierCurve;
0039 class Geom_BSplineCurve;
0040 
0041 class IntCurveSurface_TheHCurveTool
0042 {
0043 public:
0044   DEFINE_STANDARD_ALLOC
0045 
0046   static double FirstParameter(const occ::handle<Adaptor3d_Curve>& C)
0047   {
0048     return C->FirstParameter();
0049   }
0050 
0051   static double LastParameter(const occ::handle<Adaptor3d_Curve>& C) { return C->LastParameter(); }
0052 
0053   static GeomAbs_Shape Continuity(const occ::handle<Adaptor3d_Curve>& C) { return C->Continuity(); }
0054 
0055   //! Returns the number of intervals for continuity
0056   //! <S>. May be one if Continuity(myclass) >= <S>
0057   static int NbIntervals(const occ::handle<Adaptor3d_Curve>& C, const GeomAbs_Shape S)
0058   {
0059     return C->NbIntervals(S);
0060   }
0061 
0062   //! Stores in <T> the parameters bounding the intervals
0063   //! of continuity <S>.
0064   //!
0065   //! The array must provide enough room to accommodate
0066   //! for the parameters. i.e. T.Length() > NbIntervals()
0067   static void Intervals(const occ::handle<Adaptor3d_Curve>& C,
0068                         NCollection_Array1<double>&         T,
0069                         const GeomAbs_Shape                 S)
0070   {
0071     C->Intervals(T, S);
0072   }
0073 
0074   static bool IsClosed(const occ::handle<Adaptor3d_Curve>& C) { return C->IsClosed(); }
0075 
0076   static bool IsPeriodic(const occ::handle<Adaptor3d_Curve>& C) { return C->IsPeriodic(); }
0077 
0078   static double Period(const occ::handle<Adaptor3d_Curve>& C) { return C->Period(); }
0079 
0080   //! Computes the point of parameter U on the curve.
0081   static gp_Pnt Value(const occ::handle<Adaptor3d_Curve>& C, const double U) { return C->Value(U); }
0082 
0083   //! Computes the point of parameter U on the curve.
0084   static void D0(const occ::handle<Adaptor3d_Curve>& C, const double U, gp_Pnt& P) { C->D0(U, P); }
0085 
0086   //! Computes the point of parameter U on the curve with its
0087   //! first derivative.
0088   //! Raised if the continuity of the current interval
0089   //! is not C1.
0090   static void D1(const occ::handle<Adaptor3d_Curve>& C, const double U, gp_Pnt& P, gp_Vec& V)
0091   {
0092     C->D1(U, P, V);
0093   }
0094 
0095   //! Returns the point P of parameter U, the first and second
0096   //! derivatives V1 and V2.
0097   //! Raised if the continuity of the current interval
0098   //! is not C2.
0099   static void D2(const occ::handle<Adaptor3d_Curve>& C,
0100                  const double                        U,
0101                  gp_Pnt&                             P,
0102                  gp_Vec&                             V1,
0103                  gp_Vec&                             V2)
0104   {
0105     C->D2(U, P, V1, V2);
0106   }
0107 
0108   //! Returns the point P of parameter U, the first, the second
0109   //! and the third derivative.
0110   //! Raised if the continuity of the current interval
0111   //! is not C3.
0112   static void D3(const occ::handle<Adaptor3d_Curve>& C,
0113                  const double                        U,
0114                  gp_Pnt&                             P,
0115                  gp_Vec&                             V1,
0116                  gp_Vec&                             V2,
0117                  gp_Vec&                             V3)
0118   {
0119     C->D3(U, P, V1, V2, V3);
0120   }
0121 
0122   //! The returned vector gives the value of the derivative for the
0123   //! order of derivation N.
0124   //! Raised if the continuity of the current interval
0125   //! is not CN.
0126   //! Raised if N < 1.
0127   static gp_Vec DN(const occ::handle<Adaptor3d_Curve>& C, const double U, const int N)
0128   {
0129     return C->DN(U, N);
0130   }
0131 
0132   //! Returns the parametric resolution corresponding
0133   //! to the real space resolution <R3d>.
0134   static double Resolution(const occ::handle<Adaptor3d_Curve>& C, const double R3d)
0135   {
0136     return C->Resolution(R3d);
0137   }
0138 
0139   //! Returns the type of the curve in the current
0140   //! interval: Line, Circle, Ellipse, Hyperbola,
0141   //! Parabola, BezierCurve, BSplineCurve, OtherCurve.
0142   static GeomAbs_CurveType GetType(const occ::handle<Adaptor3d_Curve>& C) { return C->GetType(); }
0143 
0144   static gp_Lin Line(const occ::handle<Adaptor3d_Curve>& C) { return C->Line(); }
0145 
0146   static gp_Circ Circle(const occ::handle<Adaptor3d_Curve>& C) { return C->Circle(); }
0147 
0148   static gp_Elips Ellipse(const occ::handle<Adaptor3d_Curve>& C) { return C->Ellipse(); }
0149 
0150   static gp_Hypr Hyperbola(const occ::handle<Adaptor3d_Curve>& C) { return C->Hyperbola(); }
0151 
0152   static gp_Parab Parabola(const occ::handle<Adaptor3d_Curve>& C) { return C->Parabola(); }
0153 
0154   static occ::handle<Geom_BezierCurve> Bezier(const occ::handle<Adaptor3d_Curve>& C)
0155   {
0156     return C->Bezier();
0157   }
0158 
0159   static occ::handle<Geom_BSplineCurve> BSpline(const occ::handle<Adaptor3d_Curve>& C)
0160   {
0161     return C->BSpline();
0162   }
0163 
0164   Standard_EXPORT static int NbSamples(const occ::handle<Adaptor3d_Curve>& C,
0165                                        const double                        U0,
0166                                        const double                        U1);
0167 
0168   //! Returns sample parameters for the curve within [U0, U1] range,
0169   //! computed based on deflection and minimum number of points.
0170   //! @param[in] C the curve adaptor
0171   //! @param[in] U0 start parameter
0172   //! @param[in] U1 end parameter
0173   //! @param[in] Defl deflection tolerance
0174   //! @param[in] NbMin minimum number of sample points
0175   //! @return array of sample parameter values
0176   [[nodiscard]] Standard_EXPORT static occ::handle<NCollection_HArray1<double>> SamplePars(
0177     const occ::handle<Adaptor3d_Curve>& C,
0178     const double                        U0,
0179     const double                        U1,
0180     const double                        Defl,
0181     const int                           NbMin);
0182 
0183   //! @deprecated Use SamplePars() returning handle by value instead.
0184   Standard_DEPRECATED("Use SamplePars() returning handle by value instead")
0185   Standard_EXPORT static void SamplePars(const occ::handle<Adaptor3d_Curve>&       C,
0186                                          const double                              U0,
0187                                          const double                              U1,
0188                                          const double                              Defl,
0189                                          const int                                 NbMin,
0190                                          occ::handle<NCollection_HArray1<double>>& Pars);
0191 };
0192 
0193 #endif // _IntCurveSurface_TheHCurveTool_HeaderFile