42cf5bc1 |
1 | // Created on: 1991-12-02 |
2 | // Created by: Laurent PAINNOT |
3 | // Copyright (c) 1991-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 _AppParCurves_MultiCurve_HeaderFile |
18 | #define _AppParCurves_MultiCurve_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_DefineAlloc.hxx> |
22 | #include <Standard_Handle.hxx> |
23 | |
24 | #include <AppParCurves_HArray1OfMultiPoint.hxx> |
25 | #include <Standard_Integer.hxx> |
26 | #include <AppParCurves_Array1OfMultiPoint.hxx> |
27 | #include <TColgp_Array1OfPnt.hxx> |
28 | #include <TColgp_Array1OfPnt2d.hxx> |
29 | #include <Standard_Real.hxx> |
30 | #include <Standard_OStream.hxx> |
31 | class Standard_OutOfRange; |
32 | class Standard_DimensionError; |
33 | class Standard_ConstructionError; |
34 | class AppParCurves_MultiPoint; |
35 | class gp_Pnt; |
36 | class gp_Pnt2d; |
37 | class gp_Vec; |
38 | class gp_Vec2d; |
39 | |
40 | |
41 | //! This class describes a MultiCurve approximating a Multiline. |
42 | //! As a Multiline is a set of n lines, a MultiCurve is a set |
43 | //! of n curves. These curves are Bezier curves. |
44 | //! A MultiCurve is composed of m MultiPoint. |
45 | //! The approximating degree of these n curves is the same for |
46 | //! each one. |
47 | //! |
48 | //! Example of a MultiCurve composed of MultiPoints: |
49 | //! |
50 | //! P1______P2_____P3______P4________........_____PNbMPoints |
51 | //! |
52 | //! Q1______Q2_____Q3______Q4________........_____QNbMPoints |
53 | //! . . |
54 | //! . . |
55 | //! . . |
56 | //! R1______R2_____R3______R4________........_____RNbMPoints |
57 | //! |
58 | //! Pi, Qi, ..., Ri are points of dimension 2 or 3. |
59 | //! |
60 | //! (Pi, Qi, ...Ri), i= 1,...NbPoles are MultiPoints. |
61 | //! each MultiPoint has got NbPol Poles. |
62 | class AppParCurves_MultiCurve |
63 | { |
64 | public: |
65 | |
66 | DEFINE_STANDARD_ALLOC |
67 | |
68 | |
69 | //! returns an indefinite MultiCurve. |
70 | Standard_EXPORT AppParCurves_MultiCurve(); |
71 | |
72 | //! creates a MultiCurve, describing Bezier curves all |
73 | //! containing the same number of MultiPoint. |
74 | //! An exception is raised if Degree < 0. |
75 | Standard_EXPORT AppParCurves_MultiCurve(const Standard_Integer NbPol); |
76 | |
77 | //! creates a MultiCurve, describing Bezier curves all |
78 | //! containing the same number of MultiPoint. |
79 | //! Each MultiPoint must have NbCurves Poles. |
80 | Standard_EXPORT AppParCurves_MultiCurve(const AppParCurves_Array1OfMultiPoint& tabMU); |
81 | Standard_EXPORT virtual ~AppParCurves_MultiCurve(); |
82 | |
83 | //! The number of poles of the MultiCurve |
84 | //! will be set to <nbPoles>. |
85 | Standard_EXPORT void SetNbPoles (const Standard_Integer nbPoles); |
86 | |
87 | //! sets the MultiPoint of range Index to the value |
88 | //! <MPoint>. |
89 | //! An exception is raised if Index <0 or Index >NbMPoint. |
90 | Standard_EXPORT void SetValue (const Standard_Integer Index, const AppParCurves_MultiPoint& MPoint); |
91 | |
92 | //! Returns the number of curves resulting from the |
93 | //! approximation of a MultiLine. |
94 | Standard_EXPORT Standard_Integer NbCurves() const; |
95 | |
96 | //! Returns the number of poles on curves resulting from the approximation of a MultiLine. |
97 | Standard_EXPORT virtual Standard_Integer NbPoles() const; |
98 | |
99 | //! returns the degree of the curves. |
100 | Standard_EXPORT virtual Standard_Integer Degree() const; |
101 | |
102 | //! returns the dimension of the CuIndex curve. |
103 | //! An exception is raised if CuIndex<0 or CuIndex>NbCurves. |
104 | Standard_EXPORT Standard_Integer Dimension (const Standard_Integer CuIndex) const; |
105 | |
106 | //! returns the Pole array of the curve of range CuIndex. |
107 | //! An exception is raised if the dimension of the curve |
108 | //! is 2d. |
109 | Standard_EXPORT void Curve (const Standard_Integer CuIndex, TColgp_Array1OfPnt& TabPnt) const; |
110 | |
111 | //! returns the Pole array of the curve of range CuIndex. |
112 | //! An exception is raised if the dimension of the curve |
113 | //! is 3d. |
114 | Standard_EXPORT void Curve (const Standard_Integer CuIndex, TColgp_Array1OfPnt2d& TabPnt) const; |
115 | |
116 | //! returns the Index MultiPoint. |
117 | //! An exception is raised if Index <0 or Index >Degree+1. |
118 | Standard_EXPORT const AppParCurves_MultiPoint& Value (const Standard_Integer Index) const; |
119 | |
120 | //! returns the Nieme pole of the CuIndex curve. |
121 | //! the curve must be a 3D curve. |
122 | Standard_EXPORT const gp_Pnt& Pole (const Standard_Integer CuIndex, const Standard_Integer Nieme) const; |
123 | |
124 | //! returns the Nieme pole of the CuIndex curve. |
125 | //! the curve must be a 2D curve. |
126 | Standard_EXPORT const gp_Pnt2d& Pole2d (const Standard_Integer CuIndex, const Standard_Integer Nieme) const; |
127 | |
128 | //! Applies a transformation to the curve of range |
129 | //! <CuIndex>. |
130 | //! newx = x + dx*oldx |
131 | //! newy = y + dy*oldy for all points of the curve. |
132 | //! newz = z + dz*oldz |
133 | Standard_EXPORT void Transform (const Standard_Integer CuIndex, const Standard_Real x, const Standard_Real dx, const Standard_Real y, const Standard_Real dy, const Standard_Real z, const Standard_Real dz); |
134 | |
135 | //! Applies a transformation to the Curve of range |
136 | //! <CuIndex>. |
137 | //! newx = x + dx*oldx |
138 | //! newy = y + dy*oldy for all points of the curve. |
139 | Standard_EXPORT void Transform2d (const Standard_Integer CuIndex, const Standard_Real x, const Standard_Real dx, const Standard_Real y, const Standard_Real dy); |
140 | |
141 | //! returns the value of the point with a parameter U |
142 | //! on the Bezier curve number CuIndex. |
143 | //! An exception is raised if CuIndex <0 or > NbCurves. |
144 | //! An exception is raised if the curve dimension is 2d. |
145 | Standard_EXPORT virtual void Value (const Standard_Integer CuIndex, const Standard_Real U, gp_Pnt& Pt) const; |
146 | |
147 | //! returns the value of the point with a parameter U |
148 | //! on the Bezier curve number CuIndex. |
149 | //! An exception is raised if CuIndex <0 or > NbCurves. |
150 | //! An exception is raised if the curve dimension is 3d. |
151 | Standard_EXPORT virtual void Value (const Standard_Integer CuIndex, const Standard_Real U, gp_Pnt2d& Pt) const; |
152 | |
153 | //! returns the value of the point with a parameter U |
154 | //! on the Bezier curve number CuIndex. |
155 | //! An exception is raised if CuIndex <0 or > NbCurves. |
156 | //! An exception is raised if the curve dimension is 3d. |
157 | Standard_EXPORT virtual void D1 (const Standard_Integer CuIndex, const Standard_Real U, gp_Pnt& Pt, gp_Vec& V1) const; |
158 | |
159 | //! returns the value of the point with a parameter U |
160 | //! on the Bezier curve number CuIndex. |
161 | //! An exception is raised if CuIndex <0 or > NbCurves. |
162 | //! An exception is raised if the curve dimension is 2d. |
163 | Standard_EXPORT virtual void D1 (const Standard_Integer CuIndex, const Standard_Real U, gp_Pnt2d& Pt, gp_Vec2d& V1) const; |
164 | |
165 | //! returns the value of the point with a parameter U |
166 | //! on the Bezier curve number CuIndex. |
167 | //! An exception is raised if CuIndex <0 or > NbCurves. |
168 | //! An exception is raised if the curve dimension is 3d. |
169 | Standard_EXPORT virtual void D2 (const Standard_Integer CuIndex, const Standard_Real U, gp_Pnt& Pt, gp_Vec& V1, gp_Vec& V2) const; |
170 | |
171 | //! returns the value of the point with a parameter U |
172 | //! on the Bezier curve number CuIndex. |
173 | //! An exception is raised if CuIndex <0 or > NbCurves. |
174 | //! An exception is raised if the curve dimension is 2d. |
175 | Standard_EXPORT virtual void D2 (const Standard_Integer CuIndex, const Standard_Real U, gp_Pnt2d& Pt, gp_Vec2d& V1, gp_Vec2d& V2) const; |
176 | |
177 | //! Prints on the stream o information on the current |
178 | //! state of the object. |
179 | //! Is used to redefine the operator <<. |
180 | Standard_EXPORT virtual void Dump (Standard_OStream& o) const; |
181 | |
182 | |
183 | |
184 | |
185 | protected: |
186 | |
187 | |
188 | |
189 | Handle(AppParCurves_HArray1OfMultiPoint) tabPoint; |
190 | |
191 | |
192 | private: |
193 | |
194 | |
195 | |
196 | |
197 | |
198 | }; |
199 | |
200 | |
201 | |
202 | |
203 | |
204 | |
205 | |
206 | #endif // _AppParCurves_MultiCurve_HeaderFile |