Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-11-09 10:26:56

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_BCurveTool_HeaderFile
0018 #define _HLRBRep_BCurveTool_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <GeomAbs_Shape.hxx>
0025 #include <Standard_Integer.hxx>
0026 #include <NCollection_Array1.hxx>
0027 #include <gp_Pnt.hxx>
0028 #include <gp_Vec.hxx>
0029 #include <GeomAbs_CurveType.hxx>
0030 #include <gp_Lin.hxx>
0031 #include <gp_Circ.hxx>
0032 #include <gp_Elips.hxx>
0033 #include <gp_Hypr.hxx>
0034 #include <gp_Parab.hxx>
0035 class BRepAdaptor_Curve;
0036 class gp_Pnt;
0037 class gp_Vec;
0038 class Geom_BezierCurve;
0039 class Geom_BSplineCurve;
0040 
0041 class HLRBRep_BCurveTool
0042 {
0043 public:
0044   DEFINE_STANDARD_ALLOC
0045 
0046   static double FirstParameter(const BRepAdaptor_Curve& C);
0047 
0048   static double LastParameter(const BRepAdaptor_Curve& C);
0049 
0050   static GeomAbs_Shape Continuity(const BRepAdaptor_Curve& C);
0051 
0052   //! Returns the number of intervals for continuity
0053   //! <S>. May be one if Continuity(myclass) >= <S>
0054   static int NbIntervals(const BRepAdaptor_Curve& C, const GeomAbs_Shape S);
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 BRepAdaptor_Curve&    C,
0062                         NCollection_Array1<double>& T,
0063                         const GeomAbs_Shape         S);
0064 
0065   static bool IsClosed(const BRepAdaptor_Curve& C);
0066 
0067   static bool IsPeriodic(const BRepAdaptor_Curve& C);
0068 
0069   static double Period(const BRepAdaptor_Curve& C);
0070 
0071   //! Computes the point of parameter U on the curve.
0072   static gp_Pnt Value(const BRepAdaptor_Curve& C, const double U);
0073 
0074   //! Computes the point of parameter U on the curve.
0075   static void D0(const BRepAdaptor_Curve& C, const double U, gp_Pnt& P);
0076 
0077   //! Computes the point of parameter U on the curve with its
0078   //! first derivative.
0079   //! Raised if the continuity of the current interval
0080   //! is not C1.
0081   static void D1(const BRepAdaptor_Curve& C, const double U, gp_Pnt& P, gp_Vec& V);
0082 
0083   //! Returns the point P of parameter U, the first and second
0084   //! derivatives V1 and V2.
0085   //! Raised if the continuity of the current interval
0086   //! is not C2.
0087   static void D2(const BRepAdaptor_Curve& C, const double U, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2);
0088 
0089   //! Returns the point P of parameter U, the first, the second
0090   //! and the third derivative.
0091   //! Raised if the continuity of the current interval
0092   //! is not C3.
0093   static void D3(const BRepAdaptor_Curve& C,
0094                  const double             U,
0095                  gp_Pnt&                  P,
0096                  gp_Vec&                  V1,
0097                  gp_Vec&                  V2,
0098                  gp_Vec&                  V3);
0099 
0100   //! The returned vector gives the value of the derivative for the
0101   //! order of derivation N.
0102   //! Raised if the continuity of the current interval
0103   //! is not CN.
0104   //! Raised if N < 1.
0105   static gp_Vec DN(const BRepAdaptor_Curve& C, const double U, const int N);
0106 
0107   //! Returns the parametric resolution corresponding
0108   //! to the real space resolution <R3d>.
0109   static double Resolution(const BRepAdaptor_Curve& C, const double R3d);
0110 
0111   //! Returns the type of the curve in the current
0112   //! interval: Line, Circle, Ellipse, Hyperbola,
0113   //! Parabola, BezierCurve, BSplineCurve, OtherCurve.
0114   static GeomAbs_CurveType GetType(const BRepAdaptor_Curve& C);
0115 
0116   static gp_Lin Line(const BRepAdaptor_Curve& C);
0117 
0118   static gp_Circ Circle(const BRepAdaptor_Curve& C);
0119 
0120   static gp_Elips Ellipse(const BRepAdaptor_Curve& C);
0121 
0122   static gp_Hypr Hyperbola(const BRepAdaptor_Curve& C);
0123 
0124   static gp_Parab Parabola(const BRepAdaptor_Curve& C);
0125 
0126   Standard_EXPORT static occ::handle<Geom_BezierCurve> Bezier(const BRepAdaptor_Curve& C);
0127 
0128   Standard_EXPORT static occ::handle<Geom_BSplineCurve> BSpline(const BRepAdaptor_Curve& C);
0129 
0130   static int Degree(const BRepAdaptor_Curve& C);
0131 
0132   static bool IsRational(const BRepAdaptor_Curve& C);
0133 
0134   static int NbPoles(const BRepAdaptor_Curve& C);
0135 
0136   static int NbKnots(const BRepAdaptor_Curve& C);
0137 
0138   Standard_EXPORT static void Poles(const BRepAdaptor_Curve& C, NCollection_Array1<gp_Pnt>& T);
0139 
0140   Standard_EXPORT static void PolesAndWeights(const BRepAdaptor_Curve&    C,
0141                                               NCollection_Array1<gp_Pnt>& T,
0142                                               NCollection_Array1<double>& W);
0143 
0144   Standard_EXPORT static int NbSamples(const BRepAdaptor_Curve& C,
0145                                        const double             U0,
0146                                        const double             U1);
0147 };
0148 
0149 #include <HLRBRep_BCurveTool.lxx>
0150 
0151 #endif // _HLRBRep_BCurveTool_HeaderFile