CFx SDK Documentation
2020SP3
SDK
CFx
dd_inc
Ge
GePoint2d.h
Go to the documentation of this file.
1
// Copyright (C) 2002-2017, Open Design Alliance (the "Alliance").
3
// All rights reserved.
4
//
5
// This software and its documentation and related materials are owned by
6
// the Alliance. The software may only be incorporated into application
7
// programs owned by members of the Alliance, subject to a signed
8
// Membership Agreement and Supplemental Software License Agreement with the
9
// Alliance. The structure and organization of this software are the valuable
10
// trade secrets of the Alliance and its suppliers. The software is also
11
// protected by copyright law and international treaty provisions. Application
12
// programs incorporating this software must include the following statement
13
// with their copyright notices:
14
//
15
// This application incorporates Teigha(R) software pursuant to a license
16
// agreement with Open Design Alliance.
17
// Teigha(R) Copyright (C) 2002-2017 by Open Design Alliance.
18
// All rights reserved.
19
//
20
// By use of this software, its documentation or related materials, you
21
// acknowledge and accept the above terms.
23
24
25
#ifndef OD_GEPNT2D_H
26
#define OD_GEPNT2D_H
28
#include "Ge/GeVector2d.h"
29
#include "
OdArray.h
"
30
31
#ifdef OD_HAVE_MATH_FILE
32
#include <math.h>
33
#endif
34
35
#ifdef OD_HAVE_COMPLEX_FILE
36
#include <complex>
37
#endif
38
39
class
OdGeMatrix2d
;
40
class
OdGeVector2d
;
41
class
OdGeLinearEnt2d
;
42
class
OdGeLine2d
;
43
44
#include "
TD_PackPush.h
"
45
59
class
GE_TOOLKIT_EXPORT
OdGePoint2d
60
{
61
public
:
69
OdGePoint2d
()
70
:
x
(0.0),
y
(0.0)
71
{
72
}
73
OdGePoint2d
(
74
double
xx,
75
double
yy)
76
:
x
(xx),
y
(yy)
77
{
78
}
79
80
GE_STATIC_EXPORT
static
const
OdGePoint2d
kOrigin
;
// Origin (0,0).
81
90
friend
GE_TOOLKIT_EXPORT
OdGePoint2d
operator *
(
91
const
OdGeMatrix2d
& matrix,
92
const
OdGePoint2d
& point);
93
94
friend
GE_TOOLKIT_EXPORT
OdGePoint2d
operator *
(
95
double
scale
,
96
const
OdGePoint2d
& point);
97
105
OdGePoint2d
&
setToProduct
(
106
const
OdGeMatrix2d
& matrix,
107
const
OdGePoint2d
& point);
108
115
OdGePoint2d
&
transformBy
(
116
const
OdGeMatrix2d
& xfm);
117
124
OdGePoint2d
&
rotateBy
(
125
double
angle,
126
const
OdGePoint2d
& basePoint = kOrigin);
127
133
OdGePoint2d
&
mirror
(
134
const
OdGeLine2d
& line);
135
142
OdGePoint2d
&
scaleBy
(
143
double
scaleFactor,
144
const
OdGePoint2d
& basePoint = kOrigin);
145
146
OdGePoint2d
operator *
(
147
double
scale
)
const
148
{
149
return
OdGePoint2d
(
x
*
scale
,
y
*
scale
);
150
}
151
152
OdGePoint2d
& operator *=(
153
double
scale
)
154
{
155
x
*=
scale
;
156
y
*=
scale
;
157
return
*
this
;
158
}
159
160
OdGePoint2d
operator /(
161
double
scale
)
const
162
{
163
return
OdGePoint2d
(
x
/
scale
,
y
/
scale
);
164
}
165
166
OdGePoint2d
& operator /=(
167
double
scale
)
168
{
169
x
/=
scale
;
170
y
/=
scale
;
171
return
*
this
;
172
}
173
174
OdGePoint2d
operator +(
175
const
OdGeVector2d
& vect)
const
176
{
177
return
OdGePoint2d
(
x
+ vect.
x
,
y
+ vect.
y
);
178
}
179
180
OdGePoint2d
& operator +=(
181
const
OdGeVector2d
& vect)
182
{
183
x
+= vect.
x
;
184
y
+= vect.
y
;
185
return
*
this
;
186
}
187
188
OdGePoint2d
operator -(
189
const
OdGeVector2d
& vect)
const
190
{
191
return
OdGePoint2d
(
x
- vect.
x
,
y
- vect.
y
);
192
}
193
194
OdGePoint2d
& operator -=(
195
const
OdGeVector2d
& vect)
196
{
197
x
-= vect.
x
;
198
y
-= vect.
y
;
199
return
*
this
;
200
}
201
208
OdGePoint2d
&
setToSum
(
209
const
OdGePoint2d
& point,
210
const
OdGeVector2d
& vect)
211
{
212
x
= point.
x
+ vect.
x
;
213
y
= point.
y
+ vect.
y
;
214
return
*
this
;
215
}
216
217
OdGeVector2d
operator -(
218
const
OdGePoint2d
& point)
const
219
{
220
return
OdGeVector2d
(
x
- point.
x
,
y
- point.
y
);
221
}
222
226
const
OdGeVector2d
&
asVector
()
const
227
{
228
return
*
reinterpret_cast<
const
OdGeVector2d
*
>
(
this
);
229
}
230
236
double
distanceTo
(
237
const
OdGePoint2d
& point)
const
238
{
239
return
sqrt ( (
x
-point.
x
)* (
x
-point.
x
)+ (
y
-point.
y
)* (
y
-point.
y
));
240
}
241
242
bool
operator ==
(
243
const
OdGePoint2d
& point)
const
244
{
245
return
isEqualTo (point);
246
}
247
bool
operator !=
(
248
const
OdGePoint2d
& point)
const
249
{
250
return
!isEqualTo (point);
251
}
252
260
bool
isEqualTo
(
261
const
OdGePoint2d
& point,
262
const
OdGeTol
&
tol
=
OdGeContext::gTol
)
const
;
263
272
double
& operator [](
273
unsigned
int
i)
274
{
275
return
* (&
x
+i);
276
}
277
double
operator [](
278
unsigned
int
i)
const
279
{
280
return
* (&
x
+i);
281
}
282
290
OdGePoint2d
&
set
(
291
double
xx,
292
double
yy)
293
{
294
x
= xx;
295
y
= yy;
296
return
*
this
;
297
}
298
299
double
x
;
// X-coordinate
300
double
y
;
// Y-coordinate
301
};
302
303
#include "
TD_PackPop.h
"
304
305
#endif
306
OdGePoint2d::mirror
OdGePoint2d & mirror(const OdGeLine2d &line)
scale
scale
Definition:
DimVarDefs.h:1684
OdGeVector2d::x
double x
Definition:
GeVector2d.h:453
tol
tol
Definition:
DimVarDefs.h:2287
OdGePoint2d::rotateBy
OdGePoint2d & rotateBy(double angle, const OdGePoint2d &basePoint=kOrigin)
OdGePoint2d::y
double y
Definition:
GePoint2d.h:300
TD_PackPop.h
OdGeLinearEnt2d
Definition:
GeLinearEnt2d.h:43
x
GLfloat x
Definition:
gles2_ext.h:314
OdGePoint2d::setToProduct
OdGePoint2d & setToProduct(const OdGeMatrix2d &matrix, const OdGePoint2d &point)
operator*
GE_TOOLKIT_EXPORT OdGeVector3d operator*(const OdGeMatrix3d &matrix, const OdGeVector3d &vect)
OdGePoint2d::OdGePoint2d
OdGePoint2d()
Definition:
GePoint2d.h:69
OdArray.h
OdDAI::operator!=
bool DAI_EXPORT operator!=(const OdDAI::OdSelect &left, const OdDAI::OdSelect &right)
OdGeLine2d
Definition:
GeLine2d.h:43
OdGePoint2d::transformBy
OdGePoint2d & transformBy(const OdGeMatrix2d &xfm)
OdGePoint2d::OdGePoint2d
OdGePoint2d(double xx, double yy)
Definition:
GePoint2d.h:73
y
GLfloat GLfloat y
Definition:
gles2_ext.h:316
OdGeVector2d
Definition:
GeVector2d.h:51
OdGeVector2d::y
double y
Definition:
GeVector2d.h:454
TD_PackPush.h
OdGePoint2d::scaleBy
OdGePoint2d & scaleBy(double scaleFactor, const OdGePoint2d &basePoint=kOrigin)
OdGePoint2d::setToSum
OdGePoint2d & setToSum(const OdGePoint2d &point, const OdGeVector2d &vect)
Definition:
GePoint2d.h:208
OdGePoint2d::isEqualTo
bool isEqualTo(const OdGePoint2d &point, const OdGeTol &tol=OdGeContext::gTol) const
OdGeContext::gTol
static GE_STATIC_EXPORT OdGeTol gTol
Definition:
GeGbl.h:60
GE_TOOLKIT_EXPORT
#define GE_TOOLKIT_EXPORT
Definition:
GeExport.h:49
OdGeMatrix2d
Definition:
GeMatrix2d.h:73
OdGePoint2d::asVector
const OdGeVector2d & asVector() const
Definition:
GePoint2d.h:226
OdDAI::operator==
bool DAI_EXPORT operator==(const OdFileDescriptionAuto &left, const OdFileDescriptionAuto &right)
GE_STATIC_EXPORT
#define GE_STATIC_EXPORT
Definition:
GeExport.h:53
OdGePoint2d::kOrigin
static GE_STATIC_EXPORT const OdGePoint2d kOrigin
Definition:
GePoint2d.h:80
OdGeTol
Definition:
GeTol.h:49
OdGePoint2d::set
OdGePoint2d & set(double xx, double yy)
Definition:
GePoint2d.h:290
OdGePoint2d::distanceTo
double distanceTo(const OdGePoint2d &point) const
Definition:
GePoint2d.h:236
OdGePoint2d::x
double x
Definition:
GePoint2d.h:299
OdGePoint2d
Definition:
GePoint2d.h:60
Generated on Mon Oct 12 2020 11:49:33