Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-10-05 09:22:32

0001 // Created on: 1995-07-17
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 _HLRBRep_CurveTool_HeaderFile
0018 #define _HLRBRep_CurveTool_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <HLRBRep_TypeDef.hxx>
0025 #include <Standard_Real.hxx>
0026 #include <GeomAbs_Shape.hxx>
0027 #include <Standard_Integer.hxx>
0028 #include <NCollection_Array1.hxx>
0029 #include <Standard_Boolean.hxx>
0030 #include <GeomAbs_CurveType.hxx>
0031 #include <gp_Lin2d.hxx>
0032 #include <gp_Circ2d.hxx>
0033 #include <gp_Elips2d.hxx>
0034 #include <gp_Hypr2d.hxx>
0035 #include <gp_Parab2d.hxx>
0036 class gp_Pnt2d;
0037 class gp_Vec2d;
0038 class Geom2d_BezierCurve;
0039 class Geom2d_BSplineCurve;
0040 
0041 class HLRBRep_CurveTool
0042 {
0043 public:
0044   DEFINE_STANDARD_ALLOC
0045 
0046   static double FirstParameter(const HLRBRep_CurvePtr C);
0047 
0048   static double LastParameter(const HLRBRep_CurvePtr C);
0049 
0050   static GeomAbs_Shape Continuity(const HLRBRep_CurvePtr C);
0051 
0052   //! Returns the number of intervals for continuity
0053   //! <S>. May be one if Continuity(myclass) >= <S>
0054   static int NbIntervals(const HLRBRep_CurvePtr C);
0055 
0056   //! Stores in <T> the parameters bounding the intervals
0057   //! of continuity <S>.
0058   //!
0059   //! The array must provide enough room to accommodate
0060   //! for the parameters. i.e. T.Length() > NbIntervals()
0061   static void Intervals(const HLRBRep_CurvePtr C, NCollection_Array1<double>& T);
0062 
0063   //! output the bounds of interval of index <Index>
0064   //! used if Type == Composite.
0065   static void GetInterval(const HLRBRep_CurvePtr            C,
0066                           const int                         Index,
0067                           const NCollection_Array1<double>& Tab,
0068                           double&                           U1,
0069                           double&                           U2);
0070 
0071   static bool IsClosed(const HLRBRep_CurvePtr C);
0072 
0073   static bool IsPeriodic(const HLRBRep_CurvePtr C);
0074 
0075   static double Period(const HLRBRep_CurvePtr C);
0076 
0077   //! Computes the point of parameter U on the curve.
0078   static gp_Pnt2d Value(const HLRBRep_CurvePtr C, const double U);
0079 
0080   //! Computes the point of parameter U on the curve.
0081   static void D0(const HLRBRep_CurvePtr C, const double U, gp_Pnt2d& P);
0082 
0083   //! Computes the point of parameter U on the curve
0084   //! with its first derivative.
0085   //! Raised if the continuity of the current interval
0086   //! is not C1.
0087   static void D1(const HLRBRep_CurvePtr C, const double U, gp_Pnt2d& P, gp_Vec2d& V);
0088 
0089   //! Returns the point P of parameter U, the first and second
0090   //! derivatives V1 and V2.
0091   //! Raised if the continuity of the current interval
0092   //! is not C2.
0093   static void D2(const HLRBRep_CurvePtr C, const double U, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2);
0094 
0095   //! Returns the point P of parameter U, the first, the second
0096   //! and the third derivative.
0097   //! Raised if the continuity of the current interval
0098   //! is not C3.
0099   static void D3(const HLRBRep_CurvePtr C,
0100                  const double           U,
0101                  gp_Pnt2d&              P,
0102                  gp_Vec2d&              V1,
0103                  gp_Vec2d&              V2,
0104                  gp_Vec2d&              V3);
0105 
0106   //! The returned vector gives the value of the derivative for the
0107   //! order of derivation N.
0108   //! Raised if the continuity of the current interval
0109   //! is not CN.
0110   //! Raised if N < 1.
0111   static gp_Vec2d DN(const HLRBRep_CurvePtr C, const double U, const int N);
0112 
0113   //! Returns the parametric resolution corresponding
0114   //! to the real space resolution <R3d>.
0115   static double Resolution(const HLRBRep_CurvePtr C, const double R3d);
0116 
0117   //! Returns the type of the curve in the current
0118   //! interval: Line, Circle, Ellipse, Hyperbola,
0119   //! Parabola, BezierCurve, BSplineCurve, OtherCurve.
0120   static GeomAbs_CurveType GetType(const HLRBRep_CurvePtr C);
0121 
0122   //! Returns the type of the curve in the current
0123   //! interval: Line, Circle, Ellipse, Hyperbola,
0124   //! Parabola, BezierCurve, BSplineCurve, OtherCurve.
0125   static GeomAbs_CurveType TheType(const HLRBRep_CurvePtr C);
0126 
0127   static gp_Lin2d Line(const HLRBRep_CurvePtr C);
0128 
0129   static gp_Circ2d Circle(const HLRBRep_CurvePtr C);
0130 
0131   static gp_Elips2d Ellipse(const HLRBRep_CurvePtr C);
0132 
0133   static gp_Hypr2d Hyperbola(const HLRBRep_CurvePtr C);
0134 
0135   static gp_Parab2d Parabola(const HLRBRep_CurvePtr C);
0136 
0137   static occ::handle<Geom2d_BezierCurve> Bezier(const HLRBRep_CurvePtr C);
0138 
0139   static occ::handle<Geom2d_BSplineCurve> BSpline(const HLRBRep_CurvePtr C);
0140 
0141   static double EpsX(const HLRBRep_CurvePtr C);
0142 
0143   Standard_EXPORT static int NbSamples(const HLRBRep_CurvePtr C, const double U0, const double U1);
0144 
0145   Standard_EXPORT static int NbSamples(const HLRBRep_CurvePtr C);
0146 
0147   static int Degree(const HLRBRep_CurvePtr C);
0148 };
0149 
0150 #include <HLRBRep_CurveTool.lxx>
0151 
0152 #endif // _HLRBRep_CurveTool_HeaderFile