1 // Created on: 1995-07-17
2 // Created by: Modelistation
3 // Copyright (c) 1995-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _HLRBRep_BCurveTool_HeaderFile
18 #define _HLRBRep_BCurveTool_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
24 #include <Standard_Real.hxx>
25 #include <GeomAbs_Shape.hxx>
26 #include <Standard_Integer.hxx>
27 #include <TColStd_Array1OfReal.hxx>
28 #include <Standard_Boolean.hxx>
31 #include <GeomAbs_CurveType.hxx>
33 #include <gp_Circ.hxx>
34 #include <gp_Elips.hxx>
35 #include <gp_Hypr.hxx>
36 #include <gp_Parab.hxx>
37 #include <TColgp_Array1OfPnt.hxx>
38 class Standard_OutOfRange;
39 class Standard_NoSuchObject;
40 class Standard_DomainError;
41 class BRepAdaptor_Curve;
44 class Geom_BezierCurve;
45 class Geom_BSplineCurve;
49 class HLRBRep_BCurveTool
56 static Standard_Real FirstParameter (const BRepAdaptor_Curve& C);
58 static Standard_Real LastParameter (const BRepAdaptor_Curve& C);
60 static GeomAbs_Shape Continuity (const BRepAdaptor_Curve& C);
62 //! Returns the number of intervals for continuity
63 //! <S>. May be one if Continuity(myclass) >= <S>
64 static Standard_Integer NbIntervals (const BRepAdaptor_Curve& C, const GeomAbs_Shape S);
66 //! Stores in <T> the parameters bounding the intervals
67 //! of continuity <S>.
69 //! The array must provide enough room to accomodate
70 //! for the parameters. i.e. T.Length() > NbIntervals()
71 static void Intervals (const BRepAdaptor_Curve& C, TColStd_Array1OfReal& T, const GeomAbs_Shape S);
73 static Standard_Boolean IsClosed (const BRepAdaptor_Curve& C);
75 static Standard_Boolean IsPeriodic (const BRepAdaptor_Curve& C);
77 static Standard_Real Period (const BRepAdaptor_Curve& C);
79 //! Computes the point of parameter U on the curve.
80 static gp_Pnt Value (const BRepAdaptor_Curve& C, const Standard_Real U);
82 //! Computes the point of parameter U on the curve.
83 static void D0 (const BRepAdaptor_Curve& C, const Standard_Real U, gp_Pnt& P);
85 //! Computes the point of parameter U on the curve with its
87 //! Raised if the continuity of the current interval
89 static void D1 (const BRepAdaptor_Curve& C, const Standard_Real U, gp_Pnt& P, gp_Vec& V);
92 //! Returns the point P of parameter U, the first and second
93 //! derivatives V1 and V2.
94 //! Raised if the continuity of the current interval
96 static void D2 (const BRepAdaptor_Curve& C, const Standard_Real U, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2);
99 //! Returns the point P of parameter U, the first, the second
100 //! and the third derivative.
101 //! Raised if the continuity of the current interval
103 static void D3 (const BRepAdaptor_Curve& C, const Standard_Real U, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2, gp_Vec& V3);
106 //! The returned vector gives the value of the derivative for the
107 //! order of derivation N.
108 //! Raised if the continuity of the current interval
111 static gp_Vec DN (const BRepAdaptor_Curve& C, const Standard_Real U, const Standard_Integer N);
113 //! Returns the parametric resolution corresponding
114 //! to the real space resolution <R3d>.
115 static Standard_Real Resolution (const BRepAdaptor_Curve& C, const Standard_Real R3d);
117 //! Returns the type of the curve in the current
118 //! interval : Line, Circle, Ellipse, Hyperbola,
119 //! Parabola, BezierCurve, BSplineCurve, OtherCurve.
120 static GeomAbs_CurveType GetType (const BRepAdaptor_Curve& C);
122 static gp_Lin Line (const BRepAdaptor_Curve& C);
124 static gp_Circ Circle (const BRepAdaptor_Curve& C);
126 static gp_Elips Ellipse (const BRepAdaptor_Curve& C);
128 static gp_Hypr Hyperbola (const BRepAdaptor_Curve& C);
130 static gp_Parab Parabola (const BRepAdaptor_Curve& C);
132 Standard_EXPORT static Handle(Geom_BezierCurve) Bezier (const BRepAdaptor_Curve& C);
134 Standard_EXPORT static Handle(Geom_BSplineCurve) BSpline (const BRepAdaptor_Curve& C);
136 static Standard_Integer Degree (const BRepAdaptor_Curve& C);
138 static Standard_Boolean IsRational (const BRepAdaptor_Curve& C);
140 static Standard_Integer NbPoles (const BRepAdaptor_Curve& C);
142 static Standard_Integer NbKnots (const BRepAdaptor_Curve& C);
144 Standard_EXPORT static void Poles (const BRepAdaptor_Curve& C, TColgp_Array1OfPnt& T);
146 Standard_EXPORT static void PolesAndWeights (const BRepAdaptor_Curve& C, TColgp_Array1OfPnt& T, TColStd_Array1OfReal& W);
148 Standard_EXPORT static Standard_Integer NbSamples (const BRepAdaptor_Curve& C, const Standard_Real U0, const Standard_Real U1);
168 #include <HLRBRep_BCurveTool.lxx>
174 #endif // _HLRBRep_BCurveTool_HeaderFile