CFx SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
AECUtils.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
16// license 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#ifndef __AECUTILS_H__
25#define __AECUTILS_H__
26
27#include <set>
28#include "Ge/GePoint3d.h"
29#include "Ge/GePoint2d.h"
30#include "Ge/GeVector3d.h"
31#include "Modeler/FMDrawBody.h"
33#include "Ge/GeGbl.h"
34
35namespace AecUtils
36{
38 {
39 bool operator()(const OdGeVector3d& a, const OdGeVector3d& b) const
40 {
41 if (OdEqual(a.x, b.x))
42 {
43 if (OdEqual(a.y, b.y))
44 return OdGreater(a.z, b.z);
45 else
46 return OdGreater(a.y, b.y);
47 }
48 else return OdGreater(a.x, b.x);
49 }
50 };
51
53 {
54 public:
56 AecVector3d(const OdGeVector3d &vector3d): OdGeVector3d(vector3d){}
57
58 bool operator <(const AecVector3d& a) const
59 {
60 return OdGeVector3dComparator()(a, *this);
61 }
62
64 if(isZeroLength())
65 return *this;
66
68 }
69
71 {
72 z = 0;
73 if (isZeroLength())
74 return *this;
75
76 *this = normalize();
77 return *this;
78 }
79
81 {
82 return v.dotProduct(*this) * *this;
83 }
84 };
85
86 typedef std::set<OdGeVector3d, AecUtils::OdGeVector3dComparator> OdGeVector3dSet;
87
89 {
90 bool operator()(const OdGePoint3d& a, const OdGePoint3d& b) const
91 {
92 if (OdEqual(a.x, b.x))
93 {
94 if (OdEqual(a.y, b.y))
95 return OdGreater(a.z, b.z);
96 else
97 return OdGreater(a.y, b.y);
98 }
99 else return OdGreater(a.x, b.x);
100 }
101 };
102
103 typedef std::set<OdGePoint3d, AecUtils::OdGePoint3dComparator> OdGePoint3dSet;
104
106 {
107 bool operator()(const OdGePoint2d& a, const OdGePoint2d& b) const
108 {
109 if (OdEqual(a.x, b.x))
110 return OdGreater(a.y, b.y);
111 else return OdGreater(a.x, b.x);
112 }
113 };
114
116 {
117 return OdGeVector3d(pt.x, pt.y, pt.z);
118 }
119}
120
121#endif // __AECUTILS_H__
bool OdEqual(double x, double y, double tol=1.e-10)
Definition: OdaDefs.h:542
bool OdGreater(double x, double y, double tol=1.e-10)
Definition: OdaDefs.h:557
OdGeVector3d projectToVector(const OdGeVector3d &v)
Definition: AECUtils.h:80
OdGeVector3d perpVector() const
Definition: AECUtils.h:63
AecVector3d(const OdGeVector3d &vector3d)
Definition: AECUtils.h:56
AecVector3d & projectOnXY()
Definition: AECUtils.h:70
bool operator<(const AecVector3d &a) const
Definition: AECUtils.h:58
double x
Definition: GePoint2d.h:409
double y
Definition: GePoint2d.h:410
double z
Definition: GePoint3d.h:497
double y
Definition: GePoint3d.h:496
double x
Definition: GePoint3d.h:495
bool isZeroLength(const OdGeTol &tol=OdGeContext::gTol) const
OdGeVector3d perpVector() const
double dotProduct(const OdGeVector3d &vect) const
Definition: GeVector3d.h:586
OdGeVector3d & normalize(const OdGeTol &tol=OdGeContext::gTol)
GLfloat GLfloat GLfloat z
Definition: gles2_ext.h:318
const GLfloat * v
Definition: gles2_ext.h:315
OdGeVector3d toVector(const OdGePoint3d &pt)
Definition: AECUtils.h:115
std::set< OdGePoint3d, AecUtils::OdGePoint3dComparator > OdGePoint3dSet
Definition: AECUtils.h:103
std::set< OdGeVector3d, AecUtils::OdGeVector3dComparator > OdGeVector3dSet
Definition: AECUtils.h:86
bool operator()(const OdGePoint2d &a, const OdGePoint2d &b) const
Definition: AECUtils.h:107
bool operator()(const OdGePoint3d &a, const OdGePoint3d &b) const
Definition: AECUtils.h:90
bool operator()(const OdGeVector3d &a, const OdGeVector3d &b) const
Definition: AECUtils.h:39