CFx SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
GeVector3d.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
26
27#ifndef OD_GEVEC3D_H
28#define OD_GEVEC3D_H
31#include "Ge/GeGbl.h"
32
33class OdGeMatrix3d;
34class OdGePlane;
35class OdGePlanarEnt;
36class OdGePoint3d;
37class OdGeVector2d;
38
39#include "TD_PackPush.h"
40
55{
56public:
57
64 OdGeVector3d() : x(0.0), y(0.0), z(0.0) {}
65
77 double xx,
78 double yy,
79 double zz) : x(xx), y(yy), z(zz) {}
80
97 const OdGePlanarEnt& plane,
98 const OdGeVector2d& vector2d);
99
100 GE_STATIC_EXPORT static const OdGeVector3d kIdentity; // Additive identity vector.
101 GE_STATIC_EXPORT static const OdGeVector3d kXAxis; // X-Axis vector.
102 GE_STATIC_EXPORT static const OdGeVector3d kYAxis; // Y-Axis vector.
103 GE_STATIC_EXPORT static const OdGeVector3d kZAxis; // Z-Axis vector.
104
113 const OdGeMatrix3d& matrix,
114 const OdGeVector3d& vect);
115
124 const OdGeVector3d& vect,
125 double scale)
126 {
127 x = scale * vect.x;
128 y = scale * vect.y;
129 z = scale * vect.z;
130 return *this;
131 }
132
133
140 const OdGeMatrix3d& xfm);
141
151 double angle,
152 const OdGeVector3d& axis);
153
162 const OdGeVector3d& normalToPlane);
163
174 const OdGePlanarEnt& plane) const;
175
184
194 double scale) const
195 { return OdGeVector3d(x * scale, y * scale, z * scale); }
196
205 OdGeVector3d& operator *=(
206 double scale)
207 {
208 x *= scale;
209 y *= scale;
210 z *= scale;
211 return *this;
212 }
213
222 OdGeVector3d operator /(
223 double scale) const
224 {
225 return OdGeVector3d(x / scale, y / scale, z / scale);
226 }
227
236 OdGeVector3d& operator /=(
237 double scale)
238 {
239 x /= scale;
240 y /= scale;
241 z /= scale;
242 return *this;
243 }
244
253 OdGeVector3d operator +(
254 const OdGeVector3d& vect) const
255 { return OdGeVector3d(x + vect.x, y + vect.y, z + vect.z);}
256
265 OdGeVector3d operator +=(
266 const OdGeVector3d& vect)
267 { return OdGeVector3d(x += vect.x, y += vect.y, z += vect.z);}
268
277 OdGeVector3d operator -(
278 const OdGeVector3d& vect) const
279 { return OdGeVector3d(x - vect.x, y - vect.y, z - vect.z);}
280
289 OdGeVector3d operator -=(
290 const OdGeVector3d& vect)
291 { return OdGeVector3d(x -= vect.x, y -= vect.y, z -= vect.z);}
292
296 const OdGePoint3d& asPoint() const;
297
301 OdGePoint3d& asPoint();
302
310 const OdGeVector3d& vector1,
311 const OdGeVector3d& vector2)
312 {
313 x = vector1.x + vector2.x;
314 y = vector1.y + vector2.y;
315 z = vector1.z + vector2.z;
316 return *this;
317 }
318
325 OdGeVector3d operator -() const { return OdGeVector3d(-x, -y, -z); }
326
331 {
332 x = -x;
333 y = -y;
334 z = -z;
335 return *this;
336 }
337
338
346
347
360 double angleTo(
361 const OdGeVector3d& vect) const;
362
377 double angleTo(
378 const OdGeVector3d& vect,
379 const OdGeVector3d& refVector) const;
380
395 const OdGePlanarEnt& plane) const;
396
406 const OdGeTol& tol = OdGeContext::gTol) const;
407
418 const OdGeTol& tol = OdGeContext::gTol);
419
437 const OdGeTol& tol,
438 OdGe::ErrorCondition& status);
439
449 double normalizeGetLength(double tol = 1.e-300);
450
454 double length() const;
455
461 void setLength(double length);
462
466 double lengthSqrd() const { return x*x + y*y + z*z; }
467
474 const OdGeTol& tol = OdGeContext::gTol) const;
475
482 const OdGeTol& tol = OdGeContext::gTol) const;
483
491 const OdGeVector3d& vect,
492 const OdGeTol& tol = OdGeContext::gTol) const;
493
512 const OdGeVector3d& vect,
513 const OdGeTol& tol,
514 OdGeError& status) const;
515
523 const OdGeVector3d& vect,
524 const OdGeTol& tol = OdGeContext::gTol) const;
525
544 const OdGeVector3d& vect,
545 const OdGeTol& tol,
546 OdGeError& status) const;
547
548
556 const OdGeVector3d& vect,
557 const OdGeTol& tol = OdGeContext::gTol) const;
558
577 const OdGeVector3d& vect,
578 const OdGeTol& tol,
579 OdGeError& status) const;
580
587 const OdGeVector3d& vect) const
588 { return x * vect.x + y * vect.y + z * vect.z; }
589
596 const OdGeVector3d& vect) const
597 {
598 return OdGeVector3d(y * vect.z - z * vect.y, z * vect.x - x * vect.z, x * vect.y - y * vect.x);
599 }
600
601 // OdGeMatrix3d rotateTo(const OdGeVector3d& vector, const OdGeVector3d& axis
602 // = OdGeVector3d::kIdentity) const;
603
611 const OdGeVector3d& projectDirection) const;
612
631 const OdGeVector3d& projectDirection,
632 const OdGeTol& tol, OdGeError& flag) const;
633
639 OdGeVector3d orthoProject(const OdGeVector3d& planeNormal) const;
640
652 const OdGeTol& tol, OdGeError& flag) const;
653
663 const OdGeVector3d& vect) const;
664
674 const OdGeVector3d& vect) const;
675
684 const OdGeVector3d& vect,
685 const OdGeTol& tol = OdGeContext::gTol) const;
686
697 double operator [](
698 unsigned int i) const {return *(&x + i); }
699
710 double& operator [](
711 unsigned int i) {return *(&x + i); }
715 unsigned int largestElement() const;
716
726 double xx,
727 double yy,
728 double zz)
729 {
730 x = xx;
731 y = yy;
732 z = zz;
733 return *this;
734 }
735
757 const OdGePlanarEnt& plane,
758 const OdGeVector2d& vect);
759
763 operator OdGeMatrix3d() const;
764
765/*
766 static OdGeVector3d givePerp(
767 const OdGeVector2d& vector1,
768 const OdGeVector2d& vector2);
769*/
770
771 double x; // X-coordinate.
772 double y; // Y-coordinate.
773 double z; // Z-coordinate.
774};
775
784 const OdGeMatrix3d& matrix,
785 const OdGeVector3d& vect);
786
794static inline OdGeVector3d operator *(
795 double scale,
796 const OdGeVector3d& vect)
797{
798 return OdGeVector3d(vect.x * scale, vect.y * scale, vect.z * scale);
799}
800
801
802#include "TD_PackPop.h"
803
804
805#include "GePoint3d.h"
806//DOM-IGNORE-BEGIN
808{
809 ODA_ASSUME(sizeof(OdGePoint3d) == 3 * sizeof(double));
810 ODA_ASSUME(sizeof(OdGeVector3d) == 3 * sizeof(double));
811 return *reinterpret_cast<const OdGePoint3d*>(this);
812}
813
815{
816 ODA_ASSUME(sizeof(OdGePoint3d) == 3 * sizeof(double));
817 ODA_ASSUME(sizeof(OdGeVector3d) == 3 * sizeof(double));
818 return *reinterpret_cast<OdGePoint3d*>(this);
819}
820//DOM-IGNORE-END
821#endif
822
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
GE_TOOLKIT_EXPORT OdGeVector3d operator*(const OdGeMatrix3d &matrix, const OdGeVector3d &vect)
bool operator!=(T left, const OdGiVariant::EnumType right)
Definition: GiVariant.h:403
bool operator==(T left, const OdGiVariant::EnumType right)
Definition: GiVariant.h:397
Definition: GeTol.h:49
static GE_STATIC_EXPORT const OdGeVector3d kZAxis
Definition: GeVector3d.h:103
bool isZeroLength(const OdGeTol &tol=OdGeContext::gTol) const
bool isPerpendicularTo(const OdGeVector3d &vect, const OdGeTol &tol, OdGeError &status) const
bool isEqualTo(const OdGeVector3d &vect, const OdGeTol &tol=OdGeContext::gTol) const
bool isCodirectionalTo(const OdGeVector3d &vect, const OdGeTol &tol=OdGeContext::gTol) const
OdGeVector3d & negate()
Definition: GeVector3d.h:330
OdGeVector2d convert2d() const
OdGeVector3d perpVector() const
double length() const
bool isParallelTo(const OdGeVector3d &vect, const OdGeTol &tol=OdGeContext::gTol) const
bool isCodirectionalTo(const OdGeVector3d &vect, const OdGeTol &tol, OdGeError &status) const
bool isParallelTo(const OdGeVector3d &vect, const OdGeTol &tol, OdGeError &status) const
static GE_STATIC_EXPORT const OdGeVector3d kIdentity
Definition: GeVector3d.h:100
bool isUnitLength(const OdGeTol &tol=OdGeContext::gTol) const
OdGeVector3d normal(const OdGeTol &tol=OdGeContext::gTol) const
bool isPerpendicularTo(const OdGeVector3d &vect, const OdGeTol &tol=OdGeContext::gTol) const
OdGeVector3d & rotateBy(double angle, const OdGeVector3d &axis)
double dotProduct(const OdGeVector3d &vect) const
Definition: GeVector3d.h:586
unsigned int largestElement() const
OdGeVector3d & mirror(const OdGeVector3d &normalToPlane)
double angleTo(const OdGeVector3d &vect) const
OdGeVector3d(double xx, double yy, double zz)
Definition: GeVector3d.h:76
OdGeVector3d crossProduct(const OdGeVector3d &vect) const
Definition: GeVector3d.h:595
OdGeVector2d convert2d(const OdGePlanarEnt &plane) const
OdGeVector3d & set(const OdGePlanarEnt &plane, const OdGeVector2d &vect)
double angleOnPlane(const OdGePlanarEnt &plane) const
OdGeVector3d(const OdGePlanarEnt &plane, const OdGeVector2d &vector2d)
void setLength(double length)
OdGeVector3d & setToProduct(const OdGeMatrix3d &matrix, const OdGeVector3d &vect)
OdGeVector3d orthoProject(const OdGeVector3d &planeNormal, const OdGeTol &tol, OdGeError &flag) const
OdGeVector3d project(const OdGeVector3d &planeNormal, const OdGeVector3d &projectDirection) const
static GE_STATIC_EXPORT const OdGeVector3d kYAxis
Definition: GeVector3d.h:102
const OdGePoint3d & asPoint() const
Definition: GeVector3d.h:807
OdGeVector3d & setToSum(const OdGeVector3d &vector1, const OdGeVector3d &vector2)
Definition: GeVector3d.h:309
OdGeVector3d & setToProduct(const OdGeVector3d &vect, double scale)
Definition: GeVector3d.h:123
double lengthSqrd() const
Definition: GeVector3d.h:466
OdGeVector3d project(const OdGeVector3d &planeNormal, const OdGeVector3d &projectDirection, const OdGeTol &tol, OdGeError &flag) const
OdGeVector3d & normalize(const OdGeTol &tol=OdGeContext::gTol)
OdGeVector3d & set(double xx, double yy, double zz)
Definition: GeVector3d.h:725
OdGeVector3d & transformBy(const OdGeMatrix3d &xfm)
static GE_STATIC_EXPORT const OdGeVector3d kXAxis
Definition: GeVector3d.h:101
OdGeVector3d orthoProject(const OdGeVector3d &planeNormal) const
OdGeVector3d & normalize(const OdGeTol &tol, OdGe::ErrorCondition &status)
double angleTo(const OdGeVector3d &vect, const OdGeVector3d &refVector) const
double normalizeGetLength(double tol=1.e-300)
GLfloat GLfloat GLfloat z
Definition: gles2_ext.h:318
GLuint GLsizei GLsizei * length
Definition: gles2_ext.h:274
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
ErrorCondition
Definition: Ge.h:413