42cf5bc1 |
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 |
5 | // |
6 | // This file is part of Open CASCADE Technology software library. |
7 | // |
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. |
13 | // |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
16 | |
17 | #ifndef _ProjLib_ProjectOnPlane_HeaderFile |
18 | #define _ProjLib_ProjectOnPlane_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_DefineAlloc.hxx> |
22 | #include <Standard_Handle.hxx> |
23 | |
24 | #include <gp_Ax3.hxx> |
25 | #include <gp_Dir.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; |
40 | class gp_Ax3; |
41 | class gp_Dir; |
42 | class gp_Pnt; |
43 | class gp_Vec; |
44 | class gp_Lin; |
45 | class gp_Circ; |
46 | class gp_Elips; |
47 | class gp_Hypr; |
48 | class gp_Parab; |
49 | class Geom_BezierCurve; |
50 | class Geom_BSplineCurve; |
51 | |
52 | |
53 | //! Class used to project a 3d curve on a plane. The |
54 | //! result will be a 3d curve. |
55 | //! |
56 | //! You can ask the projected curve to have the same |
57 | //! parametrization as the original curve. |
58 | //! |
59 | //! The projection can be done along every direction not |
60 | //! parallel to the plane. |
61 | class ProjLib_ProjectOnPlane : public Adaptor3d_Curve |
62 | { |
63 | public: |
64 | |
65 | DEFINE_STANDARD_ALLOC |
66 | |
67 | |
68 | //! Empty constructor. |
69 | Standard_EXPORT ProjLib_ProjectOnPlane(); |
70 | |
71 | //! The projection will be normal to the Plane defined |
72 | //! by the Ax3 <Pl>. |
73 | Standard_EXPORT ProjLib_ProjectOnPlane(const gp_Ax3& Pl); |
74 | |
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 |
78 | //! plane <Pl>. |
79 | Standard_EXPORT ProjLib_ProjectOnPlane(const gp_Ax3& Pl, const gp_Dir& D); |
80 | |
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); |
88 | |
89 | Standard_EXPORT const gp_Ax3& GetPlane() const; |
90 | |
91 | Standard_EXPORT const gp_Dir& GetDirection() const; |
92 | |
93 | Standard_EXPORT const Handle(Adaptor3d_HCurve)& GetCurve() const; |
94 | |
f48cb55d |
95 | Standard_EXPORT const Handle(GeomAdaptor_HCurve)& GetResult() const; |
96 | |
42cf5bc1 |
97 | Standard_EXPORT Standard_Real FirstParameter() const Standard_OVERRIDE; |
98 | |
99 | Standard_EXPORT Standard_Real LastParameter() const Standard_OVERRIDE; |
100 | |
101 | Standard_EXPORT GeomAbs_Shape Continuity() const Standard_OVERRIDE; |
102 | |
103 | //! If necessary, breaks the curve in intervals of |
104 | //! continuity <S>. And returns the number of |
105 | //! intervals. |
106 | Standard_EXPORT Standard_Integer NbIntervals (const GeomAbs_Shape S) const Standard_OVERRIDE; |
107 | |
108 | //! Stores in <T> the parameters bounding the intervals |
109 | //! of continuity <S>. |
110 | //! |
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; |
114 | |
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; |
120 | |
121 | Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE; |
122 | |
123 | Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE; |
124 | |
125 | Standard_EXPORT Standard_Real Period() const Standard_OVERRIDE; |
126 | |
127 | //! Computes the point of parameter U on the curve. |
128 | Standard_EXPORT gp_Pnt Value (const Standard_Real U) const Standard_OVERRIDE; |
129 | |
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; |
132 | |
133 | //! Computes the point of parameter U on the curve with its |
134 | //! first derivative. |
135 | //! Raised if the continuity of the current interval |
136 | //! is not C1. |
137 | Standard_EXPORT void D1 (const Standard_Real U, gp_Pnt& P, gp_Vec& V) const Standard_OVERRIDE; |
138 | |
139 | |
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 |
143 | //! is not C2. |
144 | Standard_EXPORT void D2 (const Standard_Real U, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2) const Standard_OVERRIDE; |
145 | |
146 | |
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 |
150 | //! is not C3. |
151 | Standard_EXPORT void D3 (const Standard_Real U, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2, gp_Vec& V3) const Standard_OVERRIDE; |
152 | |
153 | |
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 |
157 | //! is not CN. |
158 | //! Raised if N < 1. |
159 | Standard_EXPORT gp_Vec DN (const Standard_Real U, const Standard_Integer N) const Standard_OVERRIDE; |
160 | |
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; |
164 | |
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; |
169 | |
170 | Standard_EXPORT gp_Lin Line() const Standard_OVERRIDE; |
171 | |
172 | Standard_EXPORT gp_Circ Circle() const Standard_OVERRIDE; |
173 | |
174 | Standard_EXPORT gp_Elips Ellipse() const Standard_OVERRIDE; |
175 | |
176 | Standard_EXPORT gp_Hypr Hyperbola() const Standard_OVERRIDE; |
177 | |
178 | Standard_EXPORT gp_Parab Parabola() const Standard_OVERRIDE; |
179 | |
180 | Standard_EXPORT Standard_Integer Degree() const Standard_OVERRIDE; |
181 | |
182 | Standard_EXPORT Standard_Boolean IsRational() const Standard_OVERRIDE; |
183 | |
184 | Standard_EXPORT Standard_Integer NbPoles() const Standard_OVERRIDE; |
185 | |
186 | Standard_EXPORT Standard_Integer NbKnots() const Standard_OVERRIDE; |
187 | |
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 |
192 | //! myFirst/Last. |
193 | Standard_EXPORT Handle(Geom_BezierCurve) Bezier() const Standard_OVERRIDE; |
194 | |
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 |
199 | //! myFirst/Last. |
200 | Standard_EXPORT Handle(Geom_BSplineCurve) BSpline() const Standard_OVERRIDE; |
201 | |
202 | |
203 | |
204 | |
205 | protected: |
206 | |
207 | |
208 | |
209 | |
210 | |
211 | private: |
212 | |
213 | |
214 | |
215 | Handle(Adaptor3d_HCurve) myCurve; |
216 | gp_Ax3 myPlane; |
217 | gp_Dir myDirection; |
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; |
225 | |
226 | |
227 | }; |
228 | |
229 | |
230 | |
231 | |
232 | |
233 | |
234 | |
235 | #endif // _ProjLib_ProjectOnPlane_HeaderFile |