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 _AppDef_MultiPointConstraint_HeaderFile |
18 | #define _AppDef_MultiPointConstraint_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_DefineAlloc.hxx> |
22 | #include <Standard_Handle.hxx> |
23 | |
24 | #include <AppParCurves_MultiPoint.hxx> |
25 | #include <Standard_Integer.hxx> |
26 | #include <TColgp_Array1OfPnt.hxx> |
27 | #include <TColgp_Array1OfPnt2d.hxx> |
28 | #include <TColgp_Array1OfVec.hxx> |
29 | #include <TColgp_Array1OfVec2d.hxx> |
30 | #include <Standard_Boolean.hxx> |
31 | #include <Standard_OStream.hxx> |
32 | class MMgt_TShared; |
33 | class Standard_OutOfRange; |
34 | class Standard_ConstructionError; |
35 | class Standard_DimensionError; |
36 | class gp_Vec; |
37 | class gp_Vec2d; |
38 | |
39 | |
40 | //! Describes a MultiPointConstraint used in a |
41 | //! Multiline. MultiPointConstraints are composed |
42 | //! of several two or three-dimensional points. |
43 | //! The purpose is to define the corresponding |
44 | //! points that share a common constraint in order |
45 | //! to compute the approximation of several lines in parallel. |
46 | //! Notes: |
47 | //! - The order of points of a MultiPointConstraints is very important. |
48 | //! Users must give 3D points first, and then 2D points. |
49 | //! - The constraints for the points included in a |
50 | //! MultiPointConstraint are always identical for |
51 | //! all points, including the parameter. |
52 | //! - If a MultiPointConstraint is a "tangency" |
53 | //! point, the point is also a "passing" point. |
54 | class AppDef_MultiPointConstraint : public AppParCurves_MultiPoint |
55 | { |
56 | public: |
57 | |
58 | DEFINE_STANDARD_ALLOC |
59 | |
60 | |
61 | //! creates an undefined MultiPointConstraint. |
62 | Standard_EXPORT AppDef_MultiPointConstraint(); |
63 | |
64 | //! constructs a set of Points used to approximate a Multiline. |
65 | //! These Points can be of 2 or 3 dimensions. |
66 | //! Points will be initialized with SetPoint and SetPoint2d. |
67 | Standard_EXPORT AppDef_MultiPointConstraint(const Standard_Integer NbPoints, const Standard_Integer NbPoints2d); |
68 | |
69 | //! creates a MultiPoint only composed of 3D points. |
70 | Standard_EXPORT AppDef_MultiPointConstraint(const TColgp_Array1OfPnt& tabP); |
71 | |
72 | //! creates a MultiPoint only composed of 2D points. |
73 | Standard_EXPORT AppDef_MultiPointConstraint(const TColgp_Array1OfPnt2d& tabP); |
74 | |
75 | //! constructs a set of Points used to approximate a Multiline. |
76 | //! These Points can be of 2 or 3 dimensions. |
77 | //! Points will be initialized with SetPoint and SetPoint2d. |
78 | Standard_EXPORT AppDef_MultiPointConstraint(const TColgp_Array1OfPnt& tabP, const TColgp_Array1OfPnt2d& tabP2d); |
79 | |
80 | //! creates a MultiPointConstraint with a constraint of |
81 | //! Curvature. |
82 | //! An exception is raised if |
83 | //! (length of <tabP> + length of <tabP2d> ) is different |
84 | //! from (length of <tabVec> + length of <tabVec2d> ) or |
85 | //! from (length of <tabCur> + length of <tabCur2d> ) |
86 | Standard_EXPORT AppDef_MultiPointConstraint(const TColgp_Array1OfPnt& tabP, const TColgp_Array1OfPnt2d& tabP2d, const TColgp_Array1OfVec& tabVec, const TColgp_Array1OfVec2d& tabVec2d, const TColgp_Array1OfVec& tabCur, const TColgp_Array1OfVec2d& tabCur2d); |
87 | |
88 | //! creates a MultiPointConstraint with a constraint of |
89 | //! Tangency. |
90 | //! An exception is raised if |
91 | //! (length of <tabP> + length of <tabP2d> ) is different |
92 | //! from (length of <tabVec> + length of <tabVec2d> ) |
93 | Standard_EXPORT AppDef_MultiPointConstraint(const TColgp_Array1OfPnt& tabP, const TColgp_Array1OfPnt2d& tabP2d, const TColgp_Array1OfVec& tabVec, const TColgp_Array1OfVec2d& tabVec2d); |
94 | |
95 | //! creates a MultiPointConstraint only composed of 3d points |
96 | //! with constraints of curvature. |
97 | //! An exception is raised if the length of tabP is different |
98 | //! from the length of tabVec or from tabCur. |
99 | Standard_EXPORT AppDef_MultiPointConstraint(const TColgp_Array1OfPnt& tabP, const TColgp_Array1OfVec& tabVec, const TColgp_Array1OfVec& tabCur); |
100 | |
101 | //! creates a MultiPointConstraint only composed of 3d points |
102 | //! with constraints of tangency. |
103 | //! An exception is raised if the length of tabP is different |
104 | //! from the length of tabVec. |
105 | Standard_EXPORT AppDef_MultiPointConstraint(const TColgp_Array1OfPnt& tabP, const TColgp_Array1OfVec& tabVec); |
106 | |
107 | //! creates a MultiPointConstraint only composed of 2d points |
108 | //! with constraints of tangency. |
109 | //! An exception is raised if the length of tabP is different |
110 | //! from the length of tabVec2d. |
111 | Standard_EXPORT AppDef_MultiPointConstraint(const TColgp_Array1OfPnt2d& tabP2d, const TColgp_Array1OfVec2d& tabVec2d); |
112 | |
113 | //! creates a MultiPointConstraint only composed of 2d points |
114 | //! with constraints of curvature. |
115 | //! An exception is raised if the length of tabP is different |
116 | //! from the length of tabVec2d or from tabCur2d. |
117 | Standard_EXPORT AppDef_MultiPointConstraint(const TColgp_Array1OfPnt2d& tabP2d, const TColgp_Array1OfVec2d& tabVec2d, const TColgp_Array1OfVec2d& tabCur2d); |
118 | |
119 | //! sets the value of the tangency of the point of range |
120 | //! Index. |
121 | //! An exception is raised if Index <0 or if Index > number |
122 | //! of 3d points. |
123 | //! An exception is raised if Tang has an incorrect number of |
124 | //! dimensions. |
125 | Standard_EXPORT void SetTang (const Standard_Integer Index, const gp_Vec& Tang); |
126 | |
127 | //! returns the tangency value of the point of range Index. |
128 | //! An exception is raised if Index < 0 or if Index > number |
129 | //! of 3d points. |
130 | Standard_EXPORT gp_Vec Tang (const Standard_Integer Index) const; |
131 | |
132 | //! sets the value of the tangency of the point of range |
133 | //! Index. |
134 | //! An exception is raised if Index <number of 3d points or if |
135 | //! Index > total number of Points |
136 | //! An exception is raised if Tang has an incorrect number of |
137 | //! dimensions. |
138 | Standard_EXPORT void SetTang2d (const Standard_Integer Index, const gp_Vec2d& Tang2d); |
139 | |
140 | //! returns the tangency value of the point of range Index. |
141 | //! An exception is raised if Index < number of 3d points or |
142 | //! if Index > total number of points. |
143 | Standard_EXPORT gp_Vec2d Tang2d (const Standard_Integer Index) const; |
144 | |
145 | //! Vec sets the value of the normal vector at the |
146 | //! point of index Index. The norm of the normal |
147 | //! vector at the point of position Index is set to the normal curvature. |
148 | //! An exception is raised if Index <0 or if Index > number |
149 | //! of 3d points. |
150 | //! An exception is raised if Curv has an incorrect number of |
151 | //! dimensions. |
152 | Standard_EXPORT void SetCurv (const Standard_Integer Index, const gp_Vec& Curv); |
153 | |
154 | //! returns the normal vector at the point of range Index. |
155 | //! An exception is raised if Index < 0 or if Index > number |
156 | //! of 3d points. |
157 | Standard_EXPORT gp_Vec Curv (const Standard_Integer Index) const; |
158 | |
159 | //! Vec sets the value of the normal vector at the |
160 | //! point of index Index. The norm of the normal |
161 | //! vector at the point of position Index is set to the normal curvature. |
162 | //! An exception is raised if Index <0 or if Index > number |
163 | //! of 3d points. |
164 | //! An exception is raised if Curv has an incorrect number of |
165 | //! dimensions. |
166 | Standard_EXPORT void SetCurv2d (const Standard_Integer Index, const gp_Vec2d& Curv2d); |
167 | |
168 | //! returns the normal vector at the point of range Index. |
169 | //! An exception is raised if Index < 0 or if Index > number |
170 | //! of 3d points. |
171 | Standard_EXPORT gp_Vec2d Curv2d (const Standard_Integer Index) const; |
172 | |
173 | //! returns True if the MultiPoint has a tangency value. |
174 | Standard_EXPORT Standard_Boolean IsTangencyPoint() const; |
175 | |
176 | //! returns True if the MultiPoint has a curvature value. |
177 | Standard_EXPORT Standard_Boolean IsCurvaturePoint() const; |
178 | |
179 | //! Prints on the stream o information on the current |
180 | //! state of the object. |
181 | //! Is used to redefine the operator <<. |
182 | Standard_EXPORT virtual void Dump (Standard_OStream& o) const Standard_OVERRIDE; |
183 | |
184 | |
185 | |
186 | |
187 | protected: |
188 | |
189 | |
190 | |
191 | |
192 | |
193 | private: |
194 | |
195 | |
196 | |
197 | Handle(MMgt_TShared) ttabTang; |
198 | Handle(MMgt_TShared) ttabCurv; |
199 | Handle(MMgt_TShared) ttabTang2d; |
200 | Handle(MMgt_TShared) ttabCurv2d; |
201 | |
202 | |
203 | }; |
204 | |
205 | |
206 | |
207 | |
208 | |
209 | |
210 | |
211 | #endif // _AppDef_MultiPointConstraint_HeaderFile |