CFx SDK Documentation  2020SP3
GeVector2d.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_GEVEC2D_H
28 #define OD_GEVEC2D_H
30 #include "Ge/GeGbl.h"
31 #include "Ge/GeTol.h"
32 
33 #include "TD_PackPush.h"
34 
35 class OdGeMatrix2d;
36 
51 {
52 public:
60  OdGeVector2d () : x (0.0), y (0.0) {}
62  double xx,
63  double yy) : x (xx), y (yy) {}
64 
65  GE_STATIC_EXPORT static const OdGeVector2d kIdentity; // Additive identity vector.
66  GE_STATIC_EXPORT static const OdGeVector2d kXAxis; // X-Axis vector.
67  GE_STATIC_EXPORT static const OdGeVector2d kYAxis; // Y-Axis vector.
68 
70  const OdGeMatrix2d& xfm,
71  const OdGeVector2d& vect);
72 
73 
82  const OdGeMatrix2d& matrix,
83  const OdGeVector2d& vect)
84  {
85  *this = matrix * vect;
86  return *this;
87  }
88 
97  const OdGeVector2d& vect,
98  double scale);
99 
107  const OdGeMatrix2d& xfm) { return *this = xfm * *this;}
108 
116  double angle);
117 
125  const OdGeVector2d& line);
126 
128  double scale) const;
130  double scale, const OdGeVector2d& vector);
131 
132  OdGeVector2d& operator*= (
133  double scale);
134 
135  OdGeVector2d operator/ (
136  double scale) const;
137  OdGeVector2d& operator/= (double scale);
138 
139  OdGeVector2d operator+ (
140  const OdGeVector2d& vect) const;
141  OdGeVector2d& operator+= (
142  const OdGeVector2d& vect);
143  OdGeVector2d operator- (
144  const OdGeVector2d& vect) const;
145  OdGeVector2d& operator-= (
146  const OdGeVector2d& vect);
147 
155  const OdGeVector2d& vector1,
156  const OdGeVector2d& vector2);
157 
158  OdGeVector2d operator- () const;
159 
164 
169 
176  double angle () const;
177 
190  double angleTo (
191  const OdGeVector2d& vect) const;
192 
201  double angleToCCW (
202  const OdGeVector2d& vect) const
203  {
204  return crossProduct (vect) > 0.0 ? angleTo(vect) : -angleTo(vect);
205  }
206 
216  const OdGeTol& tol = OdGeContext::gTol) const;
217 
228  const OdGeTol& tol = OdGeContext::gTol);
229 
247  const OdGeTol& tol,
248  OdGeError& status);
249 
259  double normalizeGetLength (double tol = 1.e-300);
260 
264  double length () const;
265 
269  double lengthSqrd () const;
270 
277  const OdGeTol& tol = OdGeContext::gTol) const;
278 
285  const OdGeTol& tol = OdGeContext::gTol) const;
286 
294  const OdGeVector2d& vect,
295  const OdGeTol& tol = OdGeContext::gTol) const;
296 
315  const OdGeVector2d& vect,
316  const OdGeTol& tol,
317  OdGeError& status) const;
318 
326  const OdGeVector2d& vect,
327  const OdGeTol& tol=OdGeContext::gTol) const;
328 
347  const OdGeVector2d& vect,
348  const OdGeTol& tol,
349  OdGeError& status) const;
350 
358  const OdGeVector2d& vect,
359  const OdGeTol& tol = OdGeContext::gTol) const;
360 
379  const OdGeVector2d& vect,
380  const OdGeTol& tol,
381  OdGeError& status) const;
382 
388  double dotProduct (
389  const OdGeVector2d& vect) const;
390 
397  double crossProduct (
398  const OdGeVector2d& vect) const
399  {
400  return x * vect.y - y * vect.x;
401  }
402 
404  const OdGeVector2d& vect) const;
406  const OdGeVector2d& vect) const;
407 
415  bool isEqualTo (
416  const OdGeVector2d& vect,
417  const OdGeTol& tol = OdGeContext::gTol) const;
418 
427  double operator[] (
428  unsigned int i) const;
429  double& operator[] (
430  unsigned int i) ;
431 
440  double xx,
441  double yy)
442  {
443  x = xx;
444  y = yy;
445  return *this;
446  }
447 
451  operator OdGeMatrix2d () const;
452 
453  double x; // X-coordinate.
454  double y; // Y-coordinate.
455 };
456 
457 
458 #include "TD_PackPop.h"
459 
460 #endif
461 
OdGeVector2d::isUnitLength
bool isUnitLength(const OdGeTol &tol=OdGeContext::gTol) const
OdGeVector2d::isPerpendicularTo
bool isPerpendicularTo(const OdGeVector2d &vect, const OdGeTol &tol, OdGeError &status) const
OdGeVector2d::isEqualTo
bool isEqualTo(const OdGeVector2d &vect, const OdGeTol &tol=OdGeContext::gTol) const
OdGeVector2d::normalize
OdGeVector2d & normalize(const OdGeTol &tol=OdGeContext::gTol)
OdGeVector2d::kYAxis
static GE_STATIC_EXPORT const OdGeVector2d kYAxis
Definition: GeVector2d.h:67
scale
scale
Definition: DimVarDefs.h:1684
OdGeVector2d::x
double x
Definition: GeVector2d.h:453
OdGeVector2d::angle
double angle() const
tol
tol
Definition: DimVarDefs.h:2287
OdGeVector2d::isZeroLength
bool isZeroLength(const OdGeTol &tol=OdGeContext::gTol) const
OdGeVector2d::setToSum
OdGeVector2d & setToSum(const OdGeVector2d &vector1, const OdGeVector2d &vector2)
OdGeVector2d::dotProduct
double dotProduct(const OdGeVector2d &vect) const
OdGeVector2d::isParallelTo
bool isParallelTo(const OdGeVector2d &vect, const OdGeTol &tol=OdGeContext::gTol) const
TD_PackPop.h
OdGeVector2d::isPerpendicularTo
bool isPerpendicularTo(const OdGeVector2d &vect, const OdGeTol &tol=OdGeContext::gTol) const
x
GLfloat x
Definition: gles2_ext.h:314
OdGeVector2d::transformBy
OdGeVector2d & transformBy(const OdGeMatrix2d &xfm)
Definition: GeVector2d.h:106
OdGeVector2d::mirror
OdGeVector2d & mirror(const OdGeVector2d &line)
OdGeVector2d::normalize
OdGeVector2d & normalize(const OdGeTol &tol, OdGeError &status)
operator*
GE_TOOLKIT_EXPORT OdGeVector3d operator*(const OdGeMatrix3d &matrix, const OdGeVector3d &vect)
OdDAI::operator!=
bool DAI_EXPORT operator!=(const OdDAI::OdSelect &left, const OdDAI::OdSelect &right)
OdGeVector2d::normal
OdGeVector2d normal(const OdGeTol &tol=OdGeContext::gTol) const
OdGeVector2d::kIdentity
static GE_STATIC_EXPORT const OdGeVector2d kIdentity
Definition: GeVector2d.h:65
y
GLfloat GLfloat y
Definition: gles2_ext.h:316
OdGeVector2d::set
OdGeVector2d & set(double xx, double yy)
Definition: GeVector2d.h:439
OdGeVector2d
Definition: GeVector2d.h:51
OdGeVector2d::y
double y
Definition: GeVector2d.h:454
OdGeVector2d::angleToCCW
double angleToCCW(const OdGeVector2d &vect) const
Definition: GeVector2d.h:201
OdGeVector2d::lengthSqrd
double lengthSqrd() const
TD_PackPush.h
OdGeVector2d::perpVector
OdGeVector2d perpVector() const
OdGeVector2d::setToProduct
OdGeVector2d & setToProduct(const OdGeVector2d &vect, double scale)
OdGeVector2d::negate
OdGeVector2d & negate()
OdGeVector2d::rotateBy
OdGeVector2d & rotateBy(double angle)
OdGeVector2d::isCodirectionalTo
bool isCodirectionalTo(const OdGeVector2d &vect, 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
OdGeVector2d::angleTo
double angleTo(const OdGeVector2d &vect) const
OdGeMatrix2d
Definition: GeMatrix2d.h:73
OdGe::ErrorCondition
ErrorCondition
Definition: Ge.h:228
OdDAI::operator==
bool DAI_EXPORT operator==(const OdFileDescriptionAuto &left, const OdFileDescriptionAuto &right)
OdGeVector2d::kXAxis
static GE_STATIC_EXPORT const OdGeVector2d kXAxis
Definition: GeVector2d.h:66
GE_STATIC_EXPORT
#define GE_STATIC_EXPORT
Definition: GeExport.h:53
OdGeVector2d::normalizeGetLength
double normalizeGetLength(double tol=1.e-300)
OdGeVector2d::setToProduct
OdGeVector2d & setToProduct(const OdGeMatrix2d &matrix, const OdGeVector2d &vect)
Definition: GeVector2d.h:81
OdGeVector2d::OdGeVector2d
OdGeVector2d(double xx, double yy)
Definition: GeVector2d.h:61
OdGeTol
Definition: GeTol.h:49
OdGeVector2d::isCodirectionalTo
bool isCodirectionalTo(const OdGeVector2d &vect, const OdGeTol &tol, OdGeError &status) const
GeTol.h
OdGeVector2d::crossProduct
double crossProduct(const OdGeVector2d &vect) const
Definition: GeVector2d.h:397
OdGeVector2d::isParallelTo
bool isParallelTo(const OdGeVector2d &vect, const OdGeTol &tol, OdGeError &status) const
OdGeVector2d::length
double length() const
OdGeVector2d::OdGeVector2d
OdGeVector2d()
Definition: GeVector2d.h:60