1 // Created on: 1994-09-02
2 // Created by: Bruno DUMORTIER
3 // Copyright (c) 1994-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 _ProjLib_ProjectOnPlane_HeaderFile
18 #define _ProjLib_ProjectOnPlane_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
26 #include <Standard_Boolean.hxx>
27 #include <Standard_Real.hxx>
28 #include <GeomAbs_CurveType.hxx>
29 #include <Adaptor3d_Curve.hxx>
30 #include <GeomAbs_Shape.hxx>
31 #include <Standard_Integer.hxx>
32 #include <TColStd_Array1OfReal.hxx>
33 class Adaptor3d_HCurve;
34 class GeomAdaptor_HCurve;
35 class Standard_OutOfRange;
36 class Standard_NoSuchObject;
37 class Standard_DomainError;
38 class Standard_ConstructionError;
39 class Standard_NotImplemented;
49 class Geom_BezierCurve;
50 class Geom_BSplineCurve;
53 //! Class used to project a 3d curve on a plane. The
54 //! result will be a 3d curve.
56 //! You can ask the projected curve to have the same
57 //! parametrization as the original curve.
59 //! The projection can be done along every direction not
60 //! parallel to the plane.
61 class ProjLib_ProjectOnPlane : public Adaptor3d_Curve
68 //! Empty constructor.
69 Standard_EXPORT ProjLib_ProjectOnPlane();
71 //! The projection will be normal to the Plane defined
73 Standard_EXPORT ProjLib_ProjectOnPlane(const gp_Ax3& Pl);
75 //! The projection will be along the direction <D> on
76 //! the plane defined by the Ax3 <Pl>.
77 //! raises if the direction <D> is parallel to the
79 Standard_EXPORT ProjLib_ProjectOnPlane(const gp_Ax3& Pl, const gp_Dir& D);
81 //! Sets the Curve and perform the projection. if
82 //! <KeepParametrization> is true, the parametrization
83 //! of the Projected Curve <PC> will be the same as
84 //! the parametrization of the initial curve <C>. It
85 //! meens: proj(C(u)) = PC(u) for each u. Otherwize,
86 //! the parametrization may change.
87 Standard_EXPORT void Load (const Handle(Adaptor3d_HCurve)& C, const Standard_Real Tolerance, const Standard_Boolean KeepParametrization = Standard_True);
89 Standard_EXPORT const gp_Ax3& GetPlane() const;
91 Standard_EXPORT const gp_Dir& GetDirection() const;
93 Standard_EXPORT const Handle(Adaptor3d_HCurve)& GetCurve() const;
95 Standard_EXPORT const Handle(GeomAdaptor_HCurve)& GetResult() const;
97 Standard_EXPORT Standard_Real FirstParameter() const Standard_OVERRIDE;
99 Standard_EXPORT Standard_Real LastParameter() const Standard_OVERRIDE;
101 Standard_EXPORT GeomAbs_Shape Continuity() const Standard_OVERRIDE;
103 //! If necessary, breaks the curve in intervals of
104 //! continuity <S>. And returns the number of
106 Standard_EXPORT Standard_Integer NbIntervals (const GeomAbs_Shape S) const Standard_OVERRIDE;
108 //! Stores in <T> the parameters bounding the intervals
109 //! of continuity <S>.
111 //! The array must provide enough room to accomodate
112 //! for the parameters. i.e. T.Length() > NbIntervals()
113 Standard_EXPORT void Intervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const Standard_OVERRIDE;
115 //! Returns a curve equivalent of <me> between
116 //! parameters <First> and <Last>. <Tol> is used to
117 //! test for 3d points confusion.
118 //! If <First> >= <Last>
119 Standard_EXPORT Handle(Adaptor3d_HCurve) Trim (const Standard_Real First, const Standard_Real Last, const Standard_Real Tol) const Standard_OVERRIDE;
121 Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE;
123 Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE;
125 Standard_EXPORT Standard_Real Period() const Standard_OVERRIDE;
127 //! Computes the point of parameter U on the curve.
128 Standard_EXPORT gp_Pnt Value (const Standard_Real U) const Standard_OVERRIDE;
130 //! Computes the point of parameter U on the curve.
131 Standard_EXPORT void D0 (const Standard_Real U, gp_Pnt& P) const Standard_OVERRIDE;
133 //! Computes the point of parameter U on the curve with its
134 //! first derivative.
135 //! Raised if the continuity of the current interval
137 Standard_EXPORT void D1 (const Standard_Real U, gp_Pnt& P, gp_Vec& V) const Standard_OVERRIDE;
140 //! Returns the point P of parameter U, the first and second
141 //! derivatives V1 and V2.
142 //! Raised if the continuity of the current interval
144 Standard_EXPORT void D2 (const Standard_Real U, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2) const Standard_OVERRIDE;
147 //! Returns the point P of parameter U, the first, the second
148 //! and the third derivative.
149 //! Raised if the continuity of the current interval
151 Standard_EXPORT void D3 (const Standard_Real U, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2, gp_Vec& V3) const Standard_OVERRIDE;
154 //! The returned vector gives the value of the derivative for the
155 //! order of derivation N.
156 //! Raised if the continuity of the current interval
159 Standard_EXPORT gp_Vec DN (const Standard_Real U, const Standard_Integer N) const Standard_OVERRIDE;
161 //! Returns the parametric resolution corresponding
162 //! to the real space resolution <R3d>.
163 Standard_EXPORT Standard_Real Resolution (const Standard_Real R3d) const Standard_OVERRIDE;
165 //! Returns the type of the curve in the current
166 //! interval : Line, Circle, Ellipse, Hyperbola,
167 //! Parabola, BezierCurve, BSplineCurve, OtherCurve.
168 Standard_EXPORT GeomAbs_CurveType GetType() const Standard_OVERRIDE;
170 Standard_EXPORT gp_Lin Line() const Standard_OVERRIDE;
172 Standard_EXPORT gp_Circ Circle() const Standard_OVERRIDE;
174 Standard_EXPORT gp_Elips Ellipse() const Standard_OVERRIDE;
176 Standard_EXPORT gp_Hypr Hyperbola() const Standard_OVERRIDE;
178 Standard_EXPORT gp_Parab Parabola() const Standard_OVERRIDE;
180 Standard_EXPORT Standard_Integer Degree() const Standard_OVERRIDE;
182 Standard_EXPORT Standard_Boolean IsRational() const Standard_OVERRIDE;
184 Standard_EXPORT Standard_Integer NbPoles() const Standard_OVERRIDE;
186 Standard_EXPORT Standard_Integer NbKnots() const Standard_OVERRIDE;
188 //! Warning ! this will NOT make a copy of the
189 //! Bezier Curve : If you want to modify
190 //! the Curve please make a copy yourself
191 //! Also it will NOT trim the surface to
193 Standard_EXPORT Handle(Geom_BezierCurve) Bezier() const Standard_OVERRIDE;
195 //! Warning ! this will NOT make a copy of the
196 //! BSpline Curve : If you want to modify
197 //! the Curve please make a copy yourself
198 //! Also it will NOT trim the surface to
200 Standard_EXPORT Handle(Geom_BSplineCurve) BSpline() const Standard_OVERRIDE;
215 Handle(Adaptor3d_HCurve) myCurve;
218 Standard_Boolean myKeepParam;
219 Standard_Real myFirstPar;
220 Standard_Real myLastPar;
221 Standard_Real myTolerance;
222 GeomAbs_CurveType myType;
223 Handle(GeomAdaptor_HCurve) myResult;
224 Standard_Boolean myIsApprox;
235 #endif // _ProjLib_ProjectOnPlane_HeaderFile