1 // Created on: 1993-08-18
2 // Created by: Christophe MARION
3 // Copyright (c) 1993-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_LineTool_HeaderFile
18 #define _HLRBRep_LineTool_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>
29 #include <GeomAbs_CurveType.hxx>
31 #include <gp_Circ.hxx>
32 #include <gp_Elips.hxx>
33 #include <gp_Hypr.hxx>
34 #include <gp_Parab.hxx>
35 #include <TColgp_Array1OfPnt.hxx>
36 #include <TColStd_Array1OfInteger.hxx>
37 #include <TColStd_HArray1OfReal.hxx>
38 class Standard_OutOfRange;
39 class Standard_NoSuchObject;
40 class Standard_DomainError;
43 class Geom_BezierCurve;
44 class Geom_BSplineCurve;
47 //! The LineTool class provides class methods to
48 //! access the methodes of the Line.
49 class HLRBRep_LineTool
56 static Standard_Real FirstParameter (const gp_Lin& C);
58 static Standard_Real LastParameter (const gp_Lin& C);
60 static GeomAbs_Shape Continuity (const gp_Lin& C);
62 //! If necessary, breaks the line in intervals of
63 //! continuity <S>. And returns the number of
65 static Standard_Integer NbIntervals (const gp_Lin& C, const GeomAbs_Shape S);
67 //! Sets the current working interval.
68 static void Intervals (const gp_Lin& C, TColStd_Array1OfReal& T, const GeomAbs_Shape Sh);
70 //! Returns the first parameter of the current
72 static Standard_Real IntervalFirst (const gp_Lin& C);
74 //! Returns the last parameter of the current
76 static Standard_Real IntervalLast (const gp_Lin& C);
78 static GeomAbs_Shape IntervalContinuity (const gp_Lin& C);
80 static Standard_Boolean IsClosed (const gp_Lin& C);
82 static Standard_Boolean IsPeriodic (const gp_Lin& C);
84 static Standard_Real Period (const gp_Lin& C);
86 //! Computes the point of parameter U on the line.
87 static gp_Pnt Value (const gp_Lin& C, const Standard_Real U);
89 //! Computes the point of parameter U on the line.
90 static void D0 (const gp_Lin& C, const Standard_Real U, gp_Pnt& P);
92 //! Computes the point of parameter U on the line with its
94 //! Raised if the continuity of the current interval
96 static void D1 (const gp_Lin& C, const Standard_Real U, gp_Pnt& P, gp_Vec& V);
99 //! Returns the point P of parameter U, the first and second
100 //! derivatives V1 and V2.
101 //! Raised if the continuity of the current interval
103 static void D2 (const gp_Lin& C, const Standard_Real U, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2);
106 //! Returns the point P of parameter U, the first, the second
107 //! and the third derivative.
108 //! Raised if the continuity of the current interval
110 static void D3 (const gp_Lin& C, const Standard_Real U, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2, gp_Vec& V3);
113 //! The returned vector gives the value of the derivative for the
114 //! order of derivation N.
115 //! Raised if the continuity of the current interval
118 static gp_Vec DN (const gp_Lin& C, const Standard_Real U, const Standard_Integer N);
120 //! Returns the parametric resolution corresponding
121 //! to the real space resolution <R3d>.
122 static Standard_Real Resolution (const gp_Lin& C, const Standard_Real R3d);
124 //! Returns the type of the line in the current
125 //! interval : Line, Circle, Ellipse, Hyperbola,
126 //! Parabola, BezierCurve, BSplineCurve, OtherCurve.
127 static GeomAbs_CurveType GetType (const gp_Lin& C);
129 static gp_Lin Line (const gp_Lin& C);
131 static gp_Circ Circle (const gp_Lin& C);
133 static gp_Elips Ellipse (const gp_Lin& C);
135 static gp_Hypr Hyperbola (const gp_Lin& C);
137 static gp_Parab Parabola (const gp_Lin& C);
139 static Handle(Geom_BezierCurve) Bezier (const gp_Lin& C);
141 static Handle(Geom_BSplineCurve) BSpline (const gp_Lin& C);
143 static Standard_Integer Degree (const gp_Lin& C);
145 static Standard_Integer NbPoles (const gp_Lin& C);
147 static void Poles (const gp_Lin& C, TColgp_Array1OfPnt& TP);
149 static Standard_Boolean IsRational (const gp_Lin& C);
151 static void PolesAndWeights (const gp_Lin& C, TColgp_Array1OfPnt& TP, TColStd_Array1OfReal& TW);
153 static Standard_Integer NbKnots (const gp_Lin& C);
155 static void KnotsAndMultiplicities (const gp_Lin& C, TColStd_Array1OfReal& TK, TColStd_Array1OfInteger& TM);
157 static Standard_Integer NbSamples (const gp_Lin& C, const Standard_Real U0, const Standard_Real U1);
159 static void SamplePars (const gp_Lin& C, const Standard_Real U0, const Standard_Real U1, const Standard_Real Defl, const Standard_Integer NbMin, Handle(TColStd_HArray1OfReal)& Pars);
179 #include <HLRBRep_LineTool.lxx>
185 #endif // _HLRBRep_LineTool_HeaderFile