Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Created on: 1995-07-18
0002 // Created by: Modelistation
0003 // Copyright (c) 1995-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 _Extrema_Curve2dTool_HeaderFile
0018 #define _Extrema_Curve2dTool_HeaderFile
0019 
0020 #include <Adaptor2d_Curve2d.hxx>
0021 #include <Geom2d_BezierCurve.hxx>
0022 #include <Geom2d_BSplineCurve.hxx>
0023 #include <GeomAbs_CurveType.hxx>
0024 #include <GeomAbs_Shape.hxx>
0025 #include <gp_Circ2d.hxx>
0026 #include <gp_Elips2d.hxx>
0027 #include <gp_Hypr2d.hxx>
0028 #include <gp_Lin2d.hxx>
0029 #include <gp_Parab2d.hxx>
0030 #include <gp_Pnt2d.hxx>
0031 #include <gp_Vec2d.hxx>
0032 #include <Standard.hxx>
0033 #include <Standard_DefineAlloc.hxx>
0034 #include <Standard_Handle.hxx>
0035 #include <NCollection_Array1.hxx>
0036 #include <NCollection_HArray1.hxx>
0037 
0038 class Extrema_Curve2dTool
0039 {
0040 public:
0041   DEFINE_STANDARD_ALLOC
0042 
0043   static double FirstParameter(const Adaptor2d_Curve2d& theC) { return theC.FirstParameter(); }
0044 
0045   static double LastParameter(const Adaptor2d_Curve2d& theC) { return theC.LastParameter(); }
0046 
0047   static GeomAbs_Shape Continuity(const Adaptor2d_Curve2d& theC) { return theC.Continuity(); }
0048 
0049   //! If necessary, breaks the curve in intervals of continuity <S>.
0050   //! And returns the number of intervals.
0051   static int NbIntervals(const Adaptor2d_Curve2d& theC, const GeomAbs_Shape theS)
0052   {
0053     return theC.NbIntervals(theS);
0054   }
0055 
0056   //! Stores in <T> the parameters bounding the intervals of continuity <S>.
0057   static void Intervals(const Adaptor2d_Curve2d&    theC,
0058                         NCollection_Array1<double>& theT,
0059                         const GeomAbs_Shape         theS)
0060   {
0061     theC.Intervals(theT, theS);
0062   }
0063 
0064   //! Returns the parameters bounding the intervals of subdivision of curve
0065   //! according to Curvature deflection. Value of deflection is defined in method.
0066   Standard_EXPORT static occ::handle<NCollection_HArray1<double>> DeflCurvIntervals(
0067     const Adaptor2d_Curve2d& theC);
0068 
0069   static bool IsClosed(const Adaptor2d_Curve2d& theC) { return theC.IsClosed(); }
0070 
0071   static bool IsPeriodic(const Adaptor2d_Curve2d& theC) { return theC.IsPeriodic(); }
0072 
0073   static double Period(const Adaptor2d_Curve2d& theC) { return theC.Period(); }
0074 
0075   //! Computes the point of parameter U on the curve.
0076   static gp_Pnt2d Value(const Adaptor2d_Curve2d& theC, const double theU)
0077   {
0078     return theC.Value(theU);
0079   }
0080 
0081   //! Computes the point of parameter U on the curve.
0082   static void D0(const Adaptor2d_Curve2d& theC, const double theU, gp_Pnt2d& theP)
0083   {
0084     theC.D0(theU, theP);
0085   }
0086 
0087   //! Computes the point of parameter U on the curve with its first derivative.
0088   static void D1(const Adaptor2d_Curve2d& theC, const double theU, gp_Pnt2d& theP, gp_Vec2d& theV)
0089   {
0090     theC.D1(theU, theP, theV);
0091   }
0092 
0093   //! Returns the point P of parameter U, the first and second derivatives V1 and V2.
0094   static void D2(const Adaptor2d_Curve2d& theC,
0095                  const double             theU,
0096                  gp_Pnt2d&                theP,
0097                  gp_Vec2d&                theV1,
0098                  gp_Vec2d&                theV2)
0099   {
0100     theC.D2(theU, theP, theV1, theV2);
0101   }
0102 
0103   //! Returns the point P of parameter U, the first, the second and the third derivative.
0104   static void D3(const Adaptor2d_Curve2d& theC,
0105                  const double             theU,
0106                  gp_Pnt2d&                theP,
0107                  gp_Vec2d&                theV1,
0108                  gp_Vec2d&                theV2,
0109                  gp_Vec2d&                theV3)
0110   {
0111     theC.D3(theU, theP, theV1, theV2, theV3);
0112   }
0113 
0114   //! The returned vector gives the value of the derivative for the order of derivation N.
0115   static gp_Vec2d DN(const Adaptor2d_Curve2d& theC, const double theU, const int theN)
0116   {
0117     return theC.DN(theU, theN);
0118   }
0119 
0120   //! Returns the parametric resolution corresponding to the real space resolution <R3d>.
0121   static double Resolution(const Adaptor2d_Curve2d& theC, const double theR3d)
0122   {
0123     return theC.Resolution(theR3d);
0124   }
0125 
0126   //! Returns the type of the curve in the current interval:
0127   //! Line, Circle, Ellipse, Hyperbola, Parabola, BezierCurve, BSplineCurve, OtherCurve.
0128   static GeomAbs_CurveType GetType(const Adaptor2d_Curve2d& theC) { return theC.GetType(); }
0129 
0130   static gp_Lin2d Line(const Adaptor2d_Curve2d& theC) { return theC.Line(); }
0131 
0132   static gp_Circ2d Circle(const Adaptor2d_Curve2d& theC) { return theC.Circle(); }
0133 
0134   static gp_Elips2d Ellipse(const Adaptor2d_Curve2d& theC) { return theC.Ellipse(); }
0135 
0136   static gp_Hypr2d Hyperbola(const Adaptor2d_Curve2d& theC) { return theC.Hyperbola(); }
0137 
0138   static gp_Parab2d Parabola(const Adaptor2d_Curve2d& theC) { return theC.Parabola(); }
0139 
0140   static int Degree(const Adaptor2d_Curve2d& theC) { return theC.Degree(); }
0141 
0142   static bool IsRational(const Adaptor2d_Curve2d& theC) { return theC.IsRational(); }
0143 
0144   static int NbPoles(const Adaptor2d_Curve2d& theC) { return theC.NbPoles(); }
0145 
0146   static int NbKnots(const Adaptor2d_Curve2d& theC) { return theC.NbKnots(); }
0147 
0148   static occ::handle<Geom2d_BezierCurve> Bezier(const Adaptor2d_Curve2d& theC)
0149   {
0150     return theC.Bezier();
0151   }
0152 
0153   static occ::handle<Geom2d_BSplineCurve> BSpline(const Adaptor2d_Curve2d& theC)
0154   {
0155     return theC.BSpline();
0156   }
0157 };
0158 
0159 #endif // _Extrema_Curve2dTool_HeaderFile