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_CurveTool_HeaderFile
18 #define _HLRBRep_CurveTool_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
24 #include <Standard_Real.hxx>
25 #include <Standard_Address.hxx>
26 #include <GeomAbs_Shape.hxx>
27 #include <Standard_Integer.hxx>
28 #include <TColStd_Array1OfReal.hxx>
29 #include <Standard_Boolean.hxx>
30 #include <gp_Pnt2d.hxx>
31 #include <gp_Vec2d.hxx>
32 #include <GeomAbs_CurveType.hxx>
33 #include <gp_Lin2d.hxx>
34 #include <gp_Circ2d.hxx>
35 #include <gp_Elips2d.hxx>
36 #include <gp_Hypr2d.hxx>
37 #include <gp_Parab2d.hxx>
38 class Standard_OutOfRange;
39 class Standard_NoSuchObject;
40 class Standard_DomainError;
43 class Geom2d_BezierCurve;
44 class Geom2d_BSplineCurve;
48 class HLRBRep_CurveTool
55 static Standard_Real FirstParameter (const Standard_Address C);
57 static Standard_Real LastParameter (const Standard_Address C);
59 static GeomAbs_Shape Continuity (const Standard_Address C);
61 //! Returns the number of intervals for continuity
62 //! <S>. May be one if Continuity(myclass) >= <S>
63 static Standard_Integer NbIntervals (const Standard_Address C);
65 //! Stores in <T> the parameters bounding the intervals
66 //! of continuity <S>.
68 //! The array must provide enough room to accomodate
69 //! for the parameters. i.e. T.Length() > NbIntervals()
70 static void Intervals (const Standard_Address C, TColStd_Array1OfReal& T);
72 //! output the bounds of interval of index <Index>
73 //! used if Type == Composite.
74 static void GetInterval (const Standard_Address C, const Standard_Integer Index, const TColStd_Array1OfReal& Tab, Standard_Real& U1, Standard_Real& U2);
76 static Standard_Boolean IsClosed (const Standard_Address C);
78 static Standard_Boolean IsPeriodic (const Standard_Address C);
80 static Standard_Real Period (const Standard_Address C);
82 //! Computes the point of parameter U on the curve.
83 static gp_Pnt2d Value (const Standard_Address C, const Standard_Real U);
85 //! Computes the point of parameter U on the curve.
86 static void D0 (const Standard_Address C, const Standard_Real U, gp_Pnt2d& P);
88 //! Computes the point of parameter U on the curve
89 //! with its first derivative.
90 //! Raised if the continuity of the current interval
92 static void D1 (const Standard_Address C, const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V);
95 //! Returns the point P of parameter U, the first and second
96 //! derivatives V1 and V2.
97 //! Raised if the continuity of the current interval
99 static void D2 (const Standard_Address C, const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2);
102 //! Returns the point P of parameter U, the first, the second
103 //! and the third derivative.
104 //! Raised if the continuity of the current interval
106 static void D3 (const Standard_Address C, const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2, gp_Vec2d& V3);
109 //! The returned vector gives the value of the derivative for the
110 //! order of derivation N.
111 //! Raised if the continuity of the current interval
114 static gp_Vec2d DN (const Standard_Address C, const Standard_Real U, const Standard_Integer N);
116 //! Returns the parametric resolution corresponding
117 //! to the real space resolution <R3d>.
118 static Standard_Real Resolution (const Standard_Address C, const Standard_Real R3d);
120 //! Returns the type of the curve in the current
121 //! interval : Line, Circle, Ellipse, Hyperbola,
122 //! Parabola, BezierCurve, BSplineCurve, OtherCurve.
123 static GeomAbs_CurveType GetType (const Standard_Address C);
125 //! Returns the type of the curve in the current
126 //! interval : Line, Circle, Ellipse, Hyperbola,
127 //! Parabola, BezierCurve, BSplineCurve, OtherCurve.
128 static GeomAbs_CurveType TheType (const Standard_Address C);
130 static gp_Lin2d Line (const Standard_Address C);
132 static gp_Circ2d Circle (const Standard_Address C);
134 static gp_Elips2d Ellipse (const Standard_Address C);
136 static gp_Hypr2d Hyperbola (const Standard_Address C);
138 static gp_Parab2d Parabola (const Standard_Address C);
140 static Handle(Geom2d_BezierCurve) Bezier (const Standard_Address C);
142 static Handle(Geom2d_BSplineCurve) BSpline (const Standard_Address C);
144 static Standard_Real EpsX (const Standard_Address C);
146 Standard_EXPORT static Standard_Integer NbSamples (const Standard_Address C, const Standard_Real U0, const Standard_Real U1);
148 Standard_EXPORT static Standard_Integer NbSamples (const Standard_Address C);
150 static Standard_Integer Degree (const Standard_Address C);
170 #include <HLRBRep_CurveTool.lxx>
176 #endif // _HLRBRep_CurveTool_HeaderFile