1 // Created on: 1995-07-17
2 // Created by: Laurent BUCHARD
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 _BRepBlend_HCurve2dTool_HeaderFile
18 #define _BRepBlend_HCurve2dTool_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 <gp_Pnt2d.hxx>
30 #include <gp_Vec2d.hxx>
31 #include <GeomAbs_CurveType.hxx>
32 #include <gp_Lin2d.hxx>
33 #include <gp_Circ2d.hxx>
34 #include <gp_Elips2d.hxx>
35 #include <gp_Hypr2d.hxx>
36 #include <gp_Parab2d.hxx>
37 class Standard_OutOfRange;
38 class Standard_NoSuchObject;
39 class Standard_DomainError;
40 class Adaptor2d_HCurve2d;
43 class Geom2d_BezierCurve;
44 class Geom2d_BSplineCurve;
48 class BRepBlend_HCurve2dTool
55 static Standard_Real FirstParameter (const Handle(Adaptor2d_HCurve2d)& C);
57 static Standard_Real LastParameter (const Handle(Adaptor2d_HCurve2d)& C);
59 static GeomAbs_Shape Continuity (const Handle(Adaptor2d_HCurve2d)& C);
61 //! Returns the number of intervals for continuity
62 //! <S>. May be one if Continuity(myclass) >= <S>
63 static Standard_Integer NbIntervals (const Handle(Adaptor2d_HCurve2d)& C, const GeomAbs_Shape S);
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 Handle(Adaptor2d_HCurve2d)& C, TColStd_Array1OfReal& T, const GeomAbs_Shape S);
72 static Standard_Boolean IsClosed (const Handle(Adaptor2d_HCurve2d)& C);
74 static Standard_Boolean IsPeriodic (const Handle(Adaptor2d_HCurve2d)& C);
76 static Standard_Real Period (const Handle(Adaptor2d_HCurve2d)& C);
78 //! Computes the point of parameter U on the curve.
79 static gp_Pnt2d Value (const Handle(Adaptor2d_HCurve2d)& C, const Standard_Real U);
81 //! Computes the point of parameter U on the curve.
82 static void D0 (const Handle(Adaptor2d_HCurve2d)& C, const Standard_Real U, gp_Pnt2d& P);
84 //! Computes the point of parameter U on the curve with its
86 //! Raised if the continuity of the current interval
88 static void D1 (const Handle(Adaptor2d_HCurve2d)& C, const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V);
91 //! Returns the point P of parameter U, the first and second
92 //! derivatives V1 and V2.
93 //! Raised if the continuity of the current interval
95 static void D2 (const Handle(Adaptor2d_HCurve2d)& C, const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2);
98 //! Returns the point P of parameter U, the first, the second
99 //! and the third derivative.
100 //! Raised if the continuity of the current interval
102 static void D3 (const Handle(Adaptor2d_HCurve2d)& C, const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2, gp_Vec2d& V3);
105 //! The returned vector gives the value of the derivative for the
106 //! order of derivation N.
107 //! Raised if the continuity of the current interval
110 static gp_Vec2d DN (const Handle(Adaptor2d_HCurve2d)& C, const Standard_Real U, const Standard_Integer N);
112 //! Returns the parametric resolution corresponding
113 //! to the real space resolution <R3d>.
114 static Standard_Real Resolution (const Handle(Adaptor2d_HCurve2d)& C, const Standard_Real R3d);
116 //! Returns the type of the curve in the current
117 //! interval : Line, Circle, Ellipse, Hyperbola,
118 //! Parabola, BezierCurve, BSplineCurve, OtherCurve.
119 static GeomAbs_CurveType GetType (const Handle(Adaptor2d_HCurve2d)& C);
121 static gp_Lin2d Line (const Handle(Adaptor2d_HCurve2d)& C);
123 static gp_Circ2d Circle (const Handle(Adaptor2d_HCurve2d)& C);
125 static gp_Elips2d Ellipse (const Handle(Adaptor2d_HCurve2d)& C);
127 static gp_Hypr2d Hyperbola (const Handle(Adaptor2d_HCurve2d)& C);
129 static gp_Parab2d Parabola (const Handle(Adaptor2d_HCurve2d)& C);
131 static Handle(Geom2d_BezierCurve) Bezier (const Handle(Adaptor2d_HCurve2d)& C);
133 static Handle(Geom2d_BSplineCurve) BSpline (const Handle(Adaptor2d_HCurve2d)& C);
135 Standard_EXPORT static Standard_Integer NbSamples (const Handle(Adaptor2d_HCurve2d)& C, const Standard_Real U0, const Standard_Real U1);
155 #include <BRepBlend_HCurve2dTool.lxx>
161 #endif // _BRepBlend_HCurve2dTool_HeaderFile