42cf5bc1 |
1 | // Created on: 1993-07-12 |
2 | // Created by: Yves FRICAUD |
3 | // Copyright (c) 1993-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 _MAT2d_Tool2d_HeaderFile |
18 | #define _MAT2d_Tool2d_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_DefineAlloc.hxx> |
22 | #include <Standard_Handle.hxx> |
23 | |
24 | #include <Standard_Real.hxx> |
25 | #include <GeomAbs_JoinType.hxx> |
26 | #include <Standard_Integer.hxx> |
27 | #include <MAT2d_DataMapOfIntegerBisec.hxx> |
28 | #include <MAT2d_DataMapOfIntegerPnt2d.hxx> |
29 | #include <MAT2d_DataMapOfIntegerVec2d.hxx> |
30 | #include <TColStd_SequenceOfInteger.hxx> |
31 | #include <MAT_Side.hxx> |
32 | #include <Standard_Boolean.hxx> |
33 | class MAT2d_Circuit; |
34 | class MAT_Bisector; |
35 | class Bisector_Bisec; |
36 | class Geom2d_Geometry; |
37 | class gp_Pnt2d; |
38 | class gp_Vec2d; |
39 | |
40 | |
41 | //! Set of the methods useful for the MAT's computation. |
42 | //! Tool2d contains the geometry of the bisecting locus. |
43 | class MAT2d_Tool2d |
44 | { |
45 | public: |
46 | |
47 | DEFINE_STANDARD_ALLOC |
48 | |
49 | |
50 | //! Empty Constructor. |
51 | Standard_EXPORT MAT2d_Tool2d(); |
52 | |
53 | //! <aSide> defines the side of the computation of the map. |
54 | Standard_EXPORT void Sense (const MAT_Side aside); |
55 | |
56 | Standard_EXPORT void SetJoinType (const GeomAbs_JoinType aJoinType); |
57 | |
58 | //! InitItems cuts the line in Items. |
59 | //! this Items are the geometrics representations of |
60 | //! the BasicElts from MAT. |
61 | Standard_EXPORT void InitItems (const Handle(MAT2d_Circuit)& aCircuit); |
62 | |
63 | //! Returns the Number of Items . |
64 | Standard_EXPORT Standard_Integer NumberOfItems() const; |
65 | |
66 | //! Returns tolerance to test the confusion of two points. |
67 | Standard_EXPORT Standard_Real ToleranceOfConfusion() const; |
68 | |
69 | //! Creates the point at the origin of the bisector between |
70 | //! anitem and the previous item. |
71 | //! dist is the distance from the FirstPoint to <anitem>. |
72 | //! Returns the index of this point in <theGeomPnts>. |
73 | Standard_EXPORT Standard_Integer FirstPoint (const Standard_Integer anitem, Standard_Real& dist); |
74 | |
75 | //! Creates the Tangent at the end of the Item defined |
76 | //! by <anitem>. Returns the index of this vector in |
77 | //! <theGeomVecs> |
78 | Standard_EXPORT Standard_Integer TangentBefore (const Standard_Integer anitem, const Standard_Boolean IsOpenResult); |
79 | |
80 | //! Creates the Reversed Tangent at the origin of the Item |
81 | //! defined by <anitem>. Returns the index of this vector in |
82 | //! <theGeomVecs> |
83 | Standard_EXPORT Standard_Integer TangentAfter (const Standard_Integer anitem, const Standard_Boolean IsOpenResult); |
84 | |
85 | //! Creates the Tangent at the end of the bisector defined |
86 | //! by <bisector>. Returns the index of this vector in |
87 | //! <theGeomVecs> |
88 | Standard_EXPORT Standard_Integer Tangent (const Standard_Integer bisector); |
89 | |
90 | //! Creates the geometric bisector defined by <abisector>. |
91 | Standard_EXPORT void CreateBisector (const Handle(MAT_Bisector)& abisector); |
92 | |
93 | //! Trims the geometric bisector by the <firstparameter> |
94 | //! of <abisector>. |
95 | //! If the parameter is out of the bisector, Return FALSE. |
96 | //! else Return True. |
97 | Standard_EXPORT Standard_Boolean TrimBisector (const Handle(MAT_Bisector)& abisector); |
98 | |
99 | //! Trims the geometric bisector by the point of index |
100 | //! <apoint> in <theGeomPnts>. |
101 | //! If the point is out of the bisector, Return FALSE. |
102 | //! else Return True. |
103 | Standard_EXPORT Standard_Boolean TrimBisector (const Handle(MAT_Bisector)& abisector, const Standard_Integer apoint); |
104 | |
105 | //! Computes the point of intersection between the |
106 | //! bisectors defined by <bisectorone> and |
107 | //! <bisectortwo> . |
108 | //! If this point exists, <intpnt> is its index |
109 | //! in <theGeomPnts> and Return the distance of the point |
110 | //! from the bisector else Return <RealLast>. |
111 | Standard_EXPORT Standard_Real IntersectBisector (const Handle(MAT_Bisector)& bisectorone, const Handle(MAT_Bisector)& bisectortwo, Standard_Integer& intpnt); |
112 | |
113 | //! Returns the distance between the two points designed |
114 | //! by their parameters on <abisector>. |
115 | Standard_EXPORT Standard_Real Distance (const Handle(MAT_Bisector)& abisector, const Standard_Real param1, const Standard_Real param2) const; |
116 | |
117 | //! displays informations about the bisector defined by |
118 | //! <bisector>. |
119 | Standard_EXPORT void Dump (const Standard_Integer bisector, const Standard_Integer erease) const; |
120 | |
121 | //! Returns the <Bisec> of index <Index> in |
122 | //! <theGeomBisectors>. |
123 | Standard_EXPORT const Bisector_Bisec& GeomBis (const Standard_Integer Index) const; |
124 | |
125 | //! Returns the Geometry of index <Index> in <theGeomElts>. |
126 | Standard_EXPORT Handle(Geom2d_Geometry) GeomElt (const Standard_Integer Index) const; |
127 | |
128 | //! Returns the point of index <Index> in the <theGeomPnts>. |
129 | Standard_EXPORT const gp_Pnt2d& GeomPnt (const Standard_Integer Index) const; |
130 | |
131 | //! Returns the vector of index <Index> in the |
132 | //! <theGeomVecs>. |
133 | Standard_EXPORT const gp_Vec2d& GeomVec (const Standard_Integer Index) const; |
134 | |
135 | Standard_EXPORT Handle(MAT2d_Circuit) Circuit() const; |
136 | |
137 | Standard_EXPORT void BisecFusion (const Standard_Integer Index1, const Standard_Integer Index2); |
138 | |
139 | //! Returns the <Bisec> of index <Index> in |
140 | //! <theGeomBisectors>. |
141 | Standard_EXPORT Bisector_Bisec& ChangeGeomBis (const Standard_Integer Index); |
142 | |
143 | |
144 | |
145 | |
146 | protected: |
147 | |
148 | |
149 | |
150 | |
151 | |
152 | private: |
153 | |
154 | |
155 | //! Returns True if the point <apoint> is equidistant to |
156 | //! the elements separated by bisectors <bisectorone> and |
157 | //! <bisectortwo>. |
158 | //! In this case <adistance> is the distance of the point |
159 | //! from the bisectors. |
160 | Standard_EXPORT Standard_Boolean IsSameDistance (const Handle(MAT_Bisector)& bisectorone, const Handle(MAT_Bisector)& bisectortwo, const gp_Pnt2d& apoint, Standard_Real& adistance) const; |
161 | |
162 | //! Return <True> if the Point can be projected |
163 | //! on the element designed by <IndexElt>. |
164 | //! In this case <Distance> is the minimum of distance |
165 | //! between Point and its projections. |
166 | Standard_EXPORT Standard_Boolean Projection (const Standard_Integer IndexElt, const gp_Pnt2d& Point, Standard_Real& Distance) const; |
167 | |
168 | Standard_EXPORT void TrimBisec (Bisector_Bisec& Bis, const Standard_Integer IndexEdge, const Standard_Boolean OnLine, const Standard_Integer StartOrEnd) const; |
169 | |
170 | |
171 | Standard_Real theDirection; |
172 | GeomAbs_JoinType theJoinType; |
173 | Standard_Integer theNumberOfBisectors; |
174 | Standard_Integer theNumberOfPnts; |
175 | Standard_Integer theNumberOfVecs; |
176 | Handle(MAT2d_Circuit) theCircuit; |
177 | MAT2d_DataMapOfIntegerBisec theGeomBisectors; |
178 | MAT2d_DataMapOfIntegerPnt2d theGeomPnts; |
179 | MAT2d_DataMapOfIntegerVec2d theGeomVecs; |
180 | TColStd_SequenceOfInteger theLinesLength; |
181 | |
182 | |
183 | }; |
184 | |
185 | |
186 | |
187 | |
188 | |
189 | |
190 | |
191 | #endif // _MAT2d_Tool2d_HeaderFile |