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