CFx SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
GePoint3d.h
Go to the documentation of this file.
1
2// Copyright (C) 2002-2022, 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 Open Design Alliance software pursuant to a license
16// agreement with Open Design Alliance.
17// Open Design Alliance Copyright (C) 2002-2022 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_GEPNT3D_H
26#define OD_GEPNT3D_H
28#include "Ge/GeGbl.h"
29
30#ifdef OD_HAVE_MATH_FILE
31#include <math.h>
32#endif
33
34class OdGeMatrix3d;
35class OdGeLinearEnt3d;
36class OdGePlane;
37class OdGePlanarEnt;
38class OdGeVector3d;
39class OdGePoint2d;
40
41#include "TD_PackPush.h"
42
57{
58public:
59
67 : x (0.0), y (0.0), z (0.0)
68 {
69 }
70
82 double xx,
83 double yy,
84 double zz)
85 : x (xx), y (yy), z (zz)
86 {
87 }
88
103 const OdGePlanarEnt& plane,
104 const OdGePoint2d& pnt2d);
105
106 GE_STATIC_EXPORT static const OdGePoint3d kOrigin; // Origin (0,0,0).
107
115 const OdGeMatrix3d& matrix,
116 const OdGePoint3d& point);
117
124 friend inline OdGePoint3d operator *(
125 double scale,
126 const OdGePoint3d& point)
127 {
128 return OdGePoint3d(point.x * scale, point.y * scale, point.z * scale);
129 }
130
138 const OdGeMatrix3d& xfm,
139 const OdGePoint3d& point);
140
148 const OdGeMatrix3d& xfm);
149
158 double angle,
159 const OdGeVector3d& vect,
160 const OdGePoint3d& basePoint = OdGePoint3d::kOrigin);
161
168 const OdGePlane& plane);
169
177 double scaleFactor,
178 const OdGePoint3d& basePoint = OdGePoint3d::kOrigin);
179
190 const OdGePlanarEnt& plane) const;
191
196
206 double scale) const
207 {
208 return OdGePoint3d (x * scale, y * scale, z * scale);
209 }
210
219 OdGePoint3d& operator *=(
220 double scale)
221 {
222 x *= scale;
223 y *= scale;
224 z *= scale;
225 return *this;
226 }
227
236 OdGePoint3d operator /(
237 double scale) const
238 {
239 return OdGePoint3d (x / scale, y / scale, z / scale);
240 }
241
250 OdGePoint3d& operator /=(
251 double scale)
252 {
253 x /= scale;
254 y /= scale;
255 z /= scale;
256 return *this;
257 }
258
267 OdGePoint3d operator +(
268 const OdGeVector3d& vect) const;
269
278 OdGePoint3d& operator +=(
279 const OdGeVector3d& vect);
280
289 OdGePoint3d operator -(
290 const OdGeVector3d& vect) const;
291
300 OdGePoint3d& operator -=(
301 const OdGeVector3d& vect);
302
310 const OdGePoint3d& point,
311 const OdGeVector3d& vect);
312
321 OdGeVector3d operator -(
322 const OdGePoint3d& point) const;
323
327 const OdGeVector3d& asVector() const;
328
332 OdGeVector3d& asVector();
333
340 const OdGePoint3d& point) const
341 {
342 double dx = x - point.x, dy = y - point.y, dz = z - point.z;
343 return sqrt(dx*dx + dy*dy + dz*dz);
344 }
345
352 const OdGePoint3d& point) const
353 {
354 double dx = x - point.x;
355 double dy = y - point.y;
356 double dz = z - point.z;
357 double r = dx*dx + dy*dy + dz*dz;
358 return r;
359 }
360
368 const OdGePlanarEnt& plane,
369 const OdGeVector3d& vect) const;
370
377 const OdGePlane& plane) const;
378
386 const OdGePoint3d& point) const
387 {
388 return isEqualTo (point);
389 }
390
398 const OdGePoint3d& point) const
399 {
400 return !isEqualTo (point);
401 }
402
411 const OdGePoint3d& point,
412 const OdGeTol& tol = OdGeContext::gTol) const;
413
425 double operator [](
426 unsigned int i) const
427 {
428 return * (&x+i);
429 }
430
442 double& operator [](
443 unsigned int i)
444 {
445 return * (&x+i);
446 }
447
456 double xx,
457 double yy,
458 double zz)
459 {
460 x = xx;
461 y = yy;
462 z = zz;
463 return *this;
464 }
465
473 const OdGePoint2d& xy,
474 double zz = 0.0);
475
492 const OdGePlanarEnt& plane,
493 const OdGePoint2d& point);
494
495 double x; // X-coordinate
496 double y; // Y-coordinate
497 double z; // Z-coordinate
498
505 OdGePoint3d& point);
506};
507
508#include "TD_PackPop.h"
509
510
511#include "Ge/GeVector3d.h"
512//DOM-IGNORE-BEGIN
514 const OdGeVector3d& vect) const
515{
516 return OdGePoint3d(x + vect.x, y + vect.y, z + vect.z);
517}
518
520 const OdGeVector3d& vect)
521{
522 x += vect.x;
523 y += vect.y;
524 z += vect.z;
525 return *this;
526}
527
529 const OdGeVector3d& vect) const
530{
531 return OdGePoint3d(x - vect.x, y - vect.y, z - vect.z);
532}
533
535 const OdGeVector3d& vect)
536{
537 x -= vect.x;
538 y -= vect.y;
539 z -= vect.z;
540 return *this;
541}
542
544 const OdGePoint3d& point) const
545{
546 return OdGeVector3d(x - point.x, y - point.y, z - point.z);
547}
548
550{
551 ODA_ASSUME(sizeof(OdGePoint3d) == 3 * sizeof(double));
552 ODA_ASSUME(sizeof(OdGeVector3d) == 3 * sizeof(double));
553 return *reinterpret_cast<const OdGeVector3d*>(this);
554}
555
557{
558 ODA_ASSUME(sizeof(OdGePoint3d) == 3 * sizeof(double));
559 ODA_ASSUME(sizeof(OdGeVector3d) == 3 * sizeof(double));
560 return *reinterpret_cast<OdGeVector3d*>(this);
561}
562//DOM-IGNORE-END
563#endif
564
AECBASE_API OdGePoint3d operator*(const AECECS &matrix, const OdGePoint3d &point)
#define ODA_ASSUME(expr)
Definition: DebugStuff.h:180
tol
Definition: DimVarDefs.h:2287
scale
Definition: DimVarDefs.h:1684
#define GE_TOOLKIT_EXPORT
Definition: GeExport.h:49
#define GE_STATIC_EXPORT
Definition: GeExport.h:52
bool operator!=(T left, const OdGiVariant::EnumType right)
Definition: GiVariant.h:403
bool operator==(T left, const OdGiVariant::EnumType right)
Definition: GiVariant.h:397
OdGePoint3d & set(const OdGePlanarEnt &plane, const OdGePoint2d &point)
bool isEqualTo(const OdGePoint3d &point, const OdGeTol &tol=OdGeContext::gTol) const
OdGePoint3d & scaleBy(double scaleFactor, const OdGePoint3d &basePoint=OdGePoint3d::kOrigin)
OdGePoint2d convert2d() const
double distanceSqrdTo(const OdGePoint3d &point) const
Definition: GePoint3d.h:351
OdGePoint3d & setToSum(const OdGePoint3d &point, const OdGeVector3d &vect)
OdGePoint3d & mirror(const OdGePlane &plane)
double z
Definition: GePoint3d.h:497
OdGePoint3d operator-(const OdGeVector3d &vect) const
Definition: GePoint3d.h:528
double distanceTo(const OdGePoint3d &point) const
Definition: GePoint3d.h:339
OdGePoint3d & transformBy(const OdGeMatrix3d &xfm)
OdGePoint3d & set(const OdGePoint2d &xy, double zz=0.0)
OdGePoint3d(const OdGePlanarEnt &plane, const OdGePoint2d &pnt2d)
OdGePoint3d operator+(const OdGeVector3d &vect) const
Definition: GePoint3d.h:513
OdGePoint3d & operator+=(const OdGeVector3d &vect)
Definition: GePoint3d.h:519
double y
Definition: GePoint3d.h:496
double x
Definition: GePoint3d.h:495
const OdGeVector3d & asVector() const
Definition: GePoint3d.h:549
OdGePoint2d convert2d(const OdGePlanarEnt &plane) const
OdGePoint3d & rotateBy(double angle, const OdGeVector3d &vect, const OdGePoint3d &basePoint=OdGePoint3d::kOrigin)
OdGePoint3d orthoProject(const OdGePlane &plane) const
OdGePoint3d(double xx, double yy, double zz)
Definition: GePoint3d.h:81
OdGePoint3d project(const OdGePlanarEnt &plane, const OdGeVector3d &vect) const
OdGePoint3d & swapWithPoint(OdGePoint3d &point)
OdGePoint3d & operator-=(const OdGeVector3d &vect)
Definition: GePoint3d.h:534
static GE_STATIC_EXPORT const OdGePoint3d kOrigin
Definition: GePoint3d.h:106
OdGePoint3d & setToProduct(const OdGeMatrix3d &xfm, const OdGePoint3d &point)
OdGePoint3d & set(double xx, double yy, double zz)
Definition: GePoint3d.h:455
Definition: GeTol.h:49
GLfloat GLfloat GLfloat z
Definition: gles2_ext.h:318
GLfloat x
Definition: gles2_ext.h:314
GLfloat GLfloat y
Definition: gles2_ext.h:316
static GE_STATIC_EXPORT OdGeTol gTol
Definition: GeGbl.h:65