CFx SDK Documentation  2023 SP0
GeVector3d.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 
26 
27 #ifndef OD_GEVEC3D_H
28 #define OD_GEVEC3D_H
31 #include "Ge/GeGbl.h"
32 #include "Ge/GeVector2d.h" // for convert2d
33 
34 class OdGeMatrix3d;
35 class OdGePlane;
36 class OdGePlanarEnt;
37 
38 #include "TD_PackPush.h"
39 
54 {
55 public:
78  OdGeVector3d () : x(0.0), y(0.0), z(0.0) {}
79 
81  double xx,
82  double yy,
83  double zz) : x(xx), y(yy), z(zz) {}
85  const OdGePlanarEnt& plane,
86  const OdGeVector2d& vector2d);
87 
88  GE_STATIC_EXPORT static const OdGeVector3d kIdentity; // Additive identity vector.
89  GE_STATIC_EXPORT static const OdGeVector3d kXAxis; // X-Axis vector.
90  GE_STATIC_EXPORT static const OdGeVector3d kYAxis; // Y-Axis vector.
91  GE_STATIC_EXPORT static const OdGeVector3d kZAxis; // Z-Axis vector.
92 
101  const OdGeMatrix3d& matrix,
102  const OdGeVector3d& vect);
103 
112  const OdGeVector3d& vect,
113  double scale)
114  {
115  x = scale * vect.x;
116  y = scale * vect.y;
117  z = scale * vect.z;
118  return *this;
119  }
120 
121 
128  const OdGeMatrix3d& xfm);
129 
139  double angle,
140  const OdGeVector3d& axis);
141 
150  const OdGeVector3d& normalToPlane);
151 
162  const OdGePlanarEnt& plane) const;
163 
173  OdGeVector2d convert2d () const { return OdGeVector2d(x, y); }
174 
176  double scale) const
177  { return OdGeVector3d (x * scale, y * scale, z * scale); }
178 
179  OdGeVector3d& operator *= (
180  double scale)
181  {
182  x *= scale;
183  y *= scale;
184  z *= scale;
185  return *this;
186  }
187 
188  OdGeVector3d operator / (
189  double scale) const
190  {
191  return OdGeVector3d (x/scale, y/scale, z/scale);
192  }
193 
194  OdGeVector3d& operator /= (
195  double scale)
196  {
197  x /= scale;
198  y /= scale;
199  z /= scale;
200  return *this;
201  }
202 
203  OdGeVector3d operator + (
204  const OdGeVector3d& vect) const
205  { return OdGeVector3d (x + vect.x, y + vect.y, z + vect.z);}
206  OdGeVector3d operator += (
207  const OdGeVector3d& vect)
208  { return OdGeVector3d (x += vect.x, y += vect.y, z += vect.z);}
209 
210  OdGeVector3d operator - (
211  const OdGeVector3d& vect) const
212  { return OdGeVector3d (x - vect.x, y - vect.y, z - vect.z);}
213  OdGeVector3d operator -= (
214  const OdGeVector3d& vect)
215  { return OdGeVector3d (x -= vect.x, y -= vect.y, z -= vect.z);}
216 
217 
225  const OdGeVector3d& vector1,
226  const OdGeVector3d& vector2)
227  {
228  x = vector1.x + vector2.x;
229  y = vector1.y + vector2.y;
230  z = vector1.z + vector2.z;
231  return *this;
232  }
233 
234  OdGeVector3d operator - () const { return OdGeVector3d (-x, -y, -z); }
235 
240  {
241  x = -x;
242  y = -y;
243  z = -z;
244  return *this;
245  }
246 
247 
255 
256 
267  double angleTo (
268  const OdGeVector3d& vect) const;
269 
281  double angleTo (
282  const OdGeVector3d& vect,
283  const OdGeVector3d& refVector) const;
284 
298  double angleOnPlane(
299  const OdGePlanarEnt& plane) const;
300 
310  const OdGeTol& tol = OdGeContext::gTol) const;
311 
322  const OdGeTol& tol = OdGeContext::gTol);
323 
341  const OdGeTol& tol,
342  OdGe::ErrorCondition& status);
343 
351  double normalizeGetLength(double tol = 1.e-300);
352 
356  double length () const;
357 
361  void setLength(double length);
362 
366  double lengthSqrd () const { return x*x + y*y + z*z; }
367 
368 
375  const OdGeTol& tol = OdGeContext::gTol) const;
376 
383  const OdGeTol& tol = OdGeContext::gTol) const;
384 
392  const OdGeVector3d& vect,
393  const OdGeTol& tol = OdGeContext::gTol) const;
394 
413  const OdGeVector3d& vect,
414  const OdGeTol& tol,
415  OdGeError& status) const;
416 
424  const OdGeVector3d& vect,
425  const OdGeTol& tol = OdGeContext::gTol) const;
426 
445  const OdGeVector3d& vect,
446  const OdGeTol& tol,
447  OdGeError& status) const;
448 
449 
457  const OdGeVector3d& vect,
458  const OdGeTol& tol = OdGeContext::gTol) const;
459 
478  const OdGeVector3d& vect,
479  const OdGeTol& tol,
480  OdGeError& status) const;
481 
487  double dotProduct (
488  const OdGeVector3d& vect) const
489  { return x * vect.x + y * vect.y + z * vect.z; }
490 
491 
498  const OdGeVector3d& vect) const;
499 
500  // OdGeMatrix3d rotateTo (const OdGeVector3d& vector, const OdGeVector3d& axis
501  // = OdGeVector3d::kIdentity) const;
502 
503  // OdGeVector3d project (const OdGeVector3d& planeNormal,
504  // const OdGeVector3d& projectDirection) const;
505  // OdGeVector3d project (const OdGeVector3d& planeNormal,
506  // const OdGeVector3d& projectDirection,
507  // const OdGeTol& tol, OdGeError& flag) const;
508 
509  OdGeVector3d orthoProject (const OdGeVector3d& planeNormal) const;
510  OdGeVector3d orthoProject (const OdGeVector3d& planeNormal,
511  const OdGeTol& tol, OdGeError& flag) const;
512 
514  const OdGeVector3d& vect) const;
516  const OdGeVector3d& vect) const;
517 
525  bool isEqualTo (
526  const OdGeVector3d& vect,
527  const OdGeTol& tol = OdGeContext::gTol) const;
528 
538  double operator [] (
539  unsigned int i) const {return * (&x + i); }
540  double& operator [] (
541  unsigned int i) {return * (&x + i); }
545  unsigned int largestElement() const;
546 
556  double xx,
557  double yy,
558  double zz)
559  {
560  x = xx;
561  y = yy;
562  z = zz;
563  return *this;
564  }
565 
587  const OdGePlanarEnt& plane,
588  const OdGeVector2d& vect);
589 
593  operator OdGeMatrix3d () const;
594 
595 /*
596  static OdGeVector3d givePerp (
597  const OdGeVector2d& vector1,
598  const OdGeVector2d& vector2);
599 */
600 
601  double x; // X-coordinate.
602  double y; // Y-coordinate.
603  double z; // Z-coordinate.
604 
605  //FELIX_CHANGE_BEGIN
609  const OdGePoint3d& asPoint() const;
610 
614  OdGePoint3d& asPoint();
615  //FELIX_CHANGE_END
616 };
617 
618 
629  const OdGeMatrix3d& matrix,
630  const OdGeVector3d& vect);
632  double scale,
633  const OdGeVector3d& vect);
634 
635 #include "TD_PackPop.h"
636 
637 
638 //FELIX_CHANGE_BEGIN
639 
640 #include "GePoint3d.h"
641 //DOM-IGNORE-BEGIN
642 inline const OdGePoint3d& OdGeVector3d::asPoint() const
643 {
644  return *reinterpret_cast<const OdGePoint3d*>(this);
645 }
646 
648 {
649  return *reinterpret_cast<OdGePoint3d*>(this);
650 }
651 //DOM-IGNORE-END
652 //FELIX_CHANGE_END
653 #endif
654 
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:53
GE_TOOLKIT_EXPORT OdGeVector3d operator*(const OdGeMatrix3d &matrix, const OdGeVector3d &vect)
Definition: GeTol.h:49
static GE_STATIC_EXPORT const OdGeVector3d kZAxis
Definition: GeVector3d.h:91
OdGeVector3d & set(double xx, double yy, double zz)
Definition: GeVector3d.h:555
bool isZeroLength(const OdGeTol &tol=OdGeContext::gTol) const
OdGeVector3d & normalize(const OdGeTol &tol, OdGe::ErrorCondition &status)
OdGeVector3d & negate()
Definition: GeVector3d.h:239
bool isPerpendicularTo(const OdGeVector3d &vect, const OdGeTol &tol, OdGeError &status) const
OdGeVector3d & setToProduct(const OdGeVector3d &vect, double scale)
Definition: GeVector3d.h:111
bool isEqualTo(const OdGeVector3d &vect, const OdGeTol &tol=OdGeContext::gTol) const
bool isCodirectionalTo(const OdGeVector3d &vect, const OdGeTol &tol=OdGeContext::gTol) const
OdGeVector2d convert2d() const
Definition: GeVector3d.h:173
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
OdGeVector3d & set(const OdGePlanarEnt &plane, const OdGeVector2d &vect)
bool isParallelTo(const OdGeVector3d &vect, const OdGeTol &tol, OdGeError &status) const
static GE_STATIC_EXPORT const OdGeVector3d kIdentity
Definition: GeVector3d.h:88
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
double dotProduct(const OdGeVector3d &vect) const
Definition: GeVector3d.h:487
unsigned int largestElement() const
OdGeVector3d & rotateBy(double angle, const OdGeVector3d &axis)
double angleTo(const OdGeVector3d &vect) const
OdGeVector3d(double xx, double yy, double zz)
Definition: GeVector3d.h:80
OdGeVector3d crossProduct(const OdGeVector3d &vect) const
OdGeVector2d convert2d(const OdGePlanarEnt &plane) const
double angleOnPlane(const OdGePlanarEnt &plane) const
OdGeVector3d(const OdGePlanarEnt &plane, const OdGeVector2d &vector2d)
void setLength(double length)
OdGeVector3d orthoProject(const OdGeVector3d &planeNormal, const OdGeTol &tol, OdGeError &flag) const
static GE_STATIC_EXPORT const OdGeVector3d kYAxis
Definition: GeVector3d.h:90
const OdGePoint3d & asPoint() const
Definition: GeVector3d.h:642
OdGeVector3d & setToProduct(const OdGeMatrix3d &matrix, const OdGeVector3d &vect)
OdGeVector3d & setToSum(const OdGeVector3d &vector1, const OdGeVector3d &vector2)
Definition: GeVector3d.h:224
double lengthSqrd() const
Definition: GeVector3d.h:366
OdGeVector3d & normalize(const OdGeTol &tol=OdGeContext::gTol)
OdGeVector3d & mirror(const OdGeVector3d &normalToPlane)
OdGeVector3d & transformBy(const OdGeMatrix3d &xfm)
static GE_STATIC_EXPORT const OdGeVector3d kXAxis
Definition: GeVector3d.h:89
OdGeVector3d orthoProject(const OdGeVector3d &planeNormal) const
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
bool operator==(const BlockRefPath &rA, const BlockRefPath &rB)
DOM.
bool operator!=(const BlockRefPath &rA, const BlockRefPath &rB)
DOM.
static GE_STATIC_EXPORT OdGeTol gTol
Definition: GeGbl.h:60
ErrorCondition
Definition: Ge.h:229