42cf5bc1 |
1 | // Created on: 1999-03-05 |
2 | // Created by: Fabrice SERVANT |
3 | // Copyright (c) 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 _IntPolyh_Point_HeaderFile |
18 | #define _IntPolyh_Point_HeaderFile |
19 | |
c22b52d6 |
20 | #include <Adaptor3d_Surface.hxx> |
42cf5bc1 |
21 | |
68b07699 |
22 | //! The class represents the point on the surface with |
23 | //! both 3D and 2D points. |
24 | class IntPolyh_Point |
42cf5bc1 |
25 | { |
26 | public: |
27 | |
28 | DEFINE_STANDARD_ALLOC |
29 | |
68b07699 |
30 | //! Constructor |
31 | IntPolyh_Point() : |
32 | myX(0.), myY(0.), myZ(0.), myU(0.), myV(0.), myPOC(1), myDegenerated(Standard_False) |
33 | {} |
34 | //! Constructor |
35 | IntPolyh_Point(const Standard_Real x, |
36 | const Standard_Real y, |
37 | const Standard_Real z, |
38 | const Standard_Real u, |
39 | const Standard_Real v) |
40 | : |
41 | myX(x), myY(y), myZ(z), myU(u), myV(v), myPOC(1), myDegenerated(Standard_False) |
42 | {} |
43 | |
44 | //! Returns X coordinate of the 3D point |
45 | Standard_Real X() const |
46 | { |
47 | return myX; |
48 | } |
49 | //! Returns Y coordinate of the 3D point |
50 | Standard_Real Y() const |
51 | { |
52 | return myY; |
53 | } |
54 | //! Returns the Z coordinate of the 3D point |
55 | Standard_Real Z() const |
56 | { |
57 | return myZ; |
58 | } |
59 | //! Returns the U coordinate of the 2D point |
60 | Standard_Real U() const |
61 | { |
62 | return myU; |
63 | } |
64 | //! Returns the V coordinate of the 2D point |
65 | Standard_Real V() const |
66 | { |
67 | return myV; |
68 | } |
69 | //! Returns 0 if the point is not common with the other surface |
70 | Standard_Integer PartOfCommon() const |
71 | { |
72 | return myPOC; |
73 | } |
158f2931 |
74 | |
68b07699 |
75 | //! Sets the point |
76 | void Set (const Standard_Real x, |
77 | const Standard_Real y, |
78 | const Standard_Real z, |
79 | const Standard_Real u, |
80 | const Standard_Real v, |
81 | const Standard_Integer II = 1) |
82 | { |
83 | myX = x; |
84 | myY = y; |
85 | myZ = z; |
86 | myU = u; |
87 | myV = v; |
88 | myPOC = II; |
89 | } |
90 | //! Sets the X coordinate for the 3D point |
91 | void SetX (const Standard_Real x) |
92 | { |
93 | myX = x; |
94 | } |
95 | //! Sets the Y coordinate for the 3D point |
96 | void SetY (const Standard_Real y) |
97 | { |
98 | myY = y; |
99 | } |
100 | //! Sets the Z coordinate for the 3D point |
101 | void SetZ (const Standard_Real z) |
102 | { |
103 | myZ = z; |
104 | } |
105 | //! Sets the U coordinate for the 2D point |
106 | void SetU (const Standard_Real u) |
107 | { |
108 | myU = u; |
109 | } |
110 | //! Sets the V coordinate for the 2D point |
111 | void SetV (const Standard_Real v) |
112 | { |
113 | myV = v; |
114 | } |
115 | //! Sets the part of common |
116 | void SetPartOfCommon (const Standard_Integer ii) |
117 | { |
118 | myPOC = ii; |
119 | } |
120 | //! Creates middle point from P1 and P2 and stores it to this |
c22b52d6 |
121 | Standard_EXPORT void Middle (const Handle(Adaptor3d_Surface)& MySurface, const IntPolyh_Point& P1, const IntPolyh_Point& P2); |
68b07699 |
122 | //! Addition |
42cf5bc1 |
123 | Standard_EXPORT IntPolyh_Point Add (const IntPolyh_Point& P1) const; |
68b07699 |
124 | IntPolyh_Point operator + (const IntPolyh_Point& P1) const |
125 | { |
126 | return Add(P1); |
127 | } |
128 | //! Subtraction |
42cf5bc1 |
129 | Standard_EXPORT IntPolyh_Point Sub (const IntPolyh_Point& P1) const; |
68b07699 |
130 | IntPolyh_Point operator - (const IntPolyh_Point& P1) const |
131 | { |
132 | return Sub(P1); |
133 | } |
134 | //! Division |
42cf5bc1 |
135 | Standard_EXPORT IntPolyh_Point Divide (const Standard_Real rr) const; |
68b07699 |
136 | IntPolyh_Point operator / (const Standard_Real rr) const |
137 | { |
138 | return Divide(rr); |
139 | } |
140 | //! Multiplication |
42cf5bc1 |
141 | Standard_EXPORT IntPolyh_Point Multiplication (const Standard_Real rr) const; |
68b07699 |
142 | IntPolyh_Point operator * (const Standard_Real rr) const |
143 | { |
144 | return Multiplication(rr); |
145 | } |
146 | //! Square modulus |
42cf5bc1 |
147 | Standard_EXPORT Standard_Real SquareModulus() const; |
68b07699 |
148 | //! Square distance to the other point |
42cf5bc1 |
149 | Standard_EXPORT Standard_Real SquareDistance (const IntPolyh_Point& P2) const; |
68b07699 |
150 | //! Dot |
42cf5bc1 |
151 | Standard_EXPORT Standard_Real Dot (const IntPolyh_Point& P2) const; |
68b07699 |
152 | //! Cross |
42cf5bc1 |
153 | Standard_EXPORT void Cross (const IntPolyh_Point& P1, const IntPolyh_Point& P2); |
68b07699 |
154 | //! Dump |
42cf5bc1 |
155 | Standard_EXPORT void Dump() const; |
68b07699 |
156 | //! Dump |
42cf5bc1 |
157 | Standard_EXPORT void Dump (const Standard_Integer i) const; |
68b07699 |
158 | //! Sets the degenerated flag |
159 | void SetDegenerated (const Standard_Boolean theFlag) |
160 | { |
161 | myDegenerated = theFlag; |
162 | } |
163 | //! Returns the degenerated flag |
164 | Standard_Boolean Degenerated() const |
165 | { |
166 | return myDegenerated; |
167 | } |
42cf5bc1 |
168 | |
169 | protected: |
170 | |
42cf5bc1 |
171 | private: |
172 | |
68b07699 |
173 | Standard_Real myX; |
174 | Standard_Real myY; |
175 | Standard_Real myZ; |
176 | Standard_Real myU; |
177 | Standard_Real myV; |
178 | Standard_Integer myPOC; |
42cf5bc1 |
179 | Standard_Boolean myDegenerated; |
180 | |
42cf5bc1 |
181 | }; |
182 | |
42cf5bc1 |
183 | #endif // _IntPolyh_Point_HeaderFile |