CFx SDK Documentation 2026 SP0
Loading...
Searching...
No Matches
GePoint3d.h
Go to the documentation of this file.
1
2// Copyright (C) 2002-2024, 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-2024 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
27
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
168 const OdGeMatrix3d& xfm,
169 OdGe::ErrorCondition& status);
170
179 double angle,
180 const OdGeVector3d& vect,
181 const OdGePoint3d& basePoint = OdGePoint3d::kOrigin);
182
189 const OdGePlane& plane);
190
198 double scaleFactor,
199 const OdGePoint3d& basePoint = OdGePoint3d::kOrigin);
200
211 const OdGePlanarEnt& plane) const;
212
217
227 double scale) const
228 {
229 return OdGePoint3d (x * scale, y * scale, z * scale);
230 }
231
240 OdGePoint3d& operator *=(
241 double scale)
242 {
243 x *= scale;
244 y *= scale;
245 z *= scale;
246 return *this;
247 }
248
257 OdGePoint3d operator /(
258 double scale) const
259 {
260 return OdGePoint3d (x / scale, y / scale, z / scale);
261 }
262
271 OdGePoint3d& operator /=(
272 double scale)
273 {
274 x /= scale;
275 y /= scale;
276 z /= scale;
277 return *this;
278 }
279
289 const OdGeVector3d& vect) const;
290
299 OdGePoint3d& operator +=(
300 const OdGeVector3d& vect);
301
310 OdGePoint3d operator -(
311 const OdGeVector3d& vect) const;
312
321 OdGePoint3d& operator -=(
322 const OdGeVector3d& vect);
323
331 const OdGePoint3d& point,
332 const OdGeVector3d& vect);
333
342 OdGeVector3d operator -(
343 const OdGePoint3d& point) const;
344
348 const OdGeVector3d& asVector() const;
349
354
361 const OdGePoint3d& point) const
362 {
363 double dx = x - point.x, dy = y - point.y, dz = z - point.z;
364 return sqrt(dx*dx + dy*dy + dz*dz);
365 }
366
373 const OdGePoint3d& point) const
374 {
375 double dx = x - point.x;
376 double dy = y - point.y;
377 double dz = z - point.z;
378 double r = dx*dx + dy*dy + dz*dz;
379 return r;
380 }
381
389 const OdGePlanarEnt& plane,
390 const OdGeVector3d& vect) const;
391
398 const OdGePlane& plane) const;
399
407 const OdGePoint3d& point) const
408 {
409 return isEqualTo (point);
410 }
411
419 const OdGePoint3d& point) const
420 {
421 return !isEqualTo (point);
422 }
423
432 const OdGePoint3d& point,
433 const OdGeTol& tol = OdGeContext::gTol) const;
434
446 double operator [](
447 unsigned int i) const
448 {
449 return * (&x+i);
450 }
451
463 double& operator [](
464 unsigned int i)
465 {
466 return * (&x+i);
467 }
468
477 double xx,
478 double yy,
479 double zz)
480 {
481 x = xx;
482 y = yy;
483 z = zz;
484 return *this;
485 }
486
494 const OdGePoint2d& xy,
495 double zz = 0.0);
496
513 const OdGePlanarEnt& plane,
514 const OdGePoint2d& point);
515
516 double x; // X-coordinate
517 double y; // Y-coordinate
518 double z; // Z-coordinate
519
526 OdGePoint3d& point);
527};
528
529#include "TD_PackPop.h"
530
531
532#include "Ge/GeVector3d.h"
533//DOM-IGNORE-BEGIN
535 const OdGeVector3d& vect) const
536{
537 return OdGePoint3d(x + vect.x, y + vect.y, z + vect.z);
538}
539
541 const OdGeVector3d& vect)
542{
543 x += vect.x;
544 y += vect.y;
545 z += vect.z;
546 return *this;
547}
548
550 const OdGeVector3d& vect) const
551{
552 return OdGePoint3d(x - vect.x, y - vect.y, z - vect.z);
553}
554
556 const OdGeVector3d& vect)
557{
558 x -= vect.x;
559 y -= vect.y;
560 z -= vect.z;
561 return *this;
562}
563
565 const OdGePoint3d& point) const
566{
567 return OdGeVector3d(x - point.x, y - point.y, z - point.z);
568}
569
571{
572 ODA_ASSUME(sizeof(OdGePoint3d) == 3 * sizeof(double));
573 ODA_ASSUME(sizeof(OdGeVector3d) == 3 * sizeof(double));
574 return *reinterpret_cast<const OdGeVector3d*>(this);
575}
576
578{
579 ODA_ASSUME(sizeof(OdGePoint3d) == 3 * sizeof(double));
580 ODA_ASSUME(sizeof(OdGeVector3d) == 3 * sizeof(double));
581 return *reinterpret_cast<OdGeVector3d*>(this);
582}
583//DOM-IGNORE-END
584#endif
585
AECBASE_API OdGePoint3d operator*(const AECECS &matrix, const OdGePoint3d &point)
#define ODA_ASSUME(expr)
Definition DebugStuff.h:180
tol
scale
#define GE_TOOLKIT_EXPORT
Definition GeExport.h:35
#define GE_STATIC_EXPORT
Definition GeExport.h:52
bool operator!=(T left, const OdGiVariant::EnumType right)
Definition GiVariant.h:405
bool operator==(T left, const OdGiVariant::EnumType right)
Definition GiVariant.h:399
OdTrVisMiniVec4d< DataType > operator+(const OdTrVisMiniVec4d< DataType > &v1, const OdTrVisMiniVec4d< DataType > &v2)
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:372
OdGePoint3d & setToSum(const OdGePoint3d &point, const OdGeVector3d &vect)
OdGePoint3d & mirror(const OdGePlane &plane)
OdGePoint3d operator-(const OdGeVector3d &vect) const
Definition GePoint3d.h:549
double distanceTo(const OdGePoint3d &point) const
Definition GePoint3d.h:360
OdGePoint3d & transformBy(const OdGeMatrix3d &xfm)
OdGePoint3d & set(const OdGePoint2d &xy, double zz=0.0)
OdGePoint3d & transformBy(const OdGeMatrix3d &xfm, OdGe::ErrorCondition &status)
OdGePoint3d(const OdGePlanarEnt &plane, const OdGePoint2d &pnt2d)
OdGePoint3d operator+(const OdGeVector3d &vect) const
Definition GePoint3d.h:534
OdGePoint3d & operator+=(const OdGeVector3d &vect)
Definition GePoint3d.h:540
const OdGeVector3d & asVector() const
Definition GePoint3d.h:570
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:555
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:476
static GE_STATIC_EXPORT OdGeTol gTol
Definition GeGbl.h:67
ErrorCondition
Definition Ge.h:415