-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathExtrudedObj.h
83 lines (69 loc) · 2.09 KB
/
ExtrudedObj.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#pragma once
#include "HeeksObj.h"
template<typename T>
class ExtrudedObj : public T
{
public:
double m_thickness;
double m_extrusion_vector[3];
~ExtrudedObj(void);
ExtrudedObj(void)
{
m_thickness = 0.0;
m_extrusion_vector[0] = 0.0;
m_extrusion_vector[1] = 0.0;
m_extrusion_vector[2] = 0.0;
}
ExtrudedObj(const ExtrudedObj& e);
const ExtrudedObj& operator=(const ExtrudedObj &b);
// HeeksObj's virtual functions
void ModifyByMatrix(const double* m);
void CopyFrom(const HeeksObj* object){ operator=(*((ExtrudedObj*)object)); }
HeeksObj* MakeACopyWithID();
bool IsDifferent(HeeksObj* other);
};
template<typename T>
ExtrudedObj<T>::ExtrudedObj(const ExtrudedObj& e)
{
operator=(e);
}
template < typename T >
ExtrudedObj<T>::~ExtrudedObj(){
}
template < typename T >
const ExtrudedObj<T>& ExtrudedObj<T>::operator=(const ExtrudedObj<T> &b){
T::operator = (b);
m_thickness = b.m_thickness;
m_extrusion_vector[0] = b.m_extrusion_vector[0];
m_extrusion_vector[1] = b.m_extrusion_vector[1];
m_extrusion_vector[2] = b.m_extrusion_vector[2];
return *this;
}
template < typename T > HeeksObj* ExtrudedObj<T>::MakeACopyWithID()
{
ExtrudedObj<T>* pnew = (ExtrudedObj<T>*)T::MakeACopyWithID();
pnew->m_thickness = m_thickness;
pnew->m_extrusion_vector[0] = m_extrusion_vector[0];
pnew->m_extrusion_vector[1] = m_extrusion_vector[1];
pnew->m_extrusion_vector[2] = m_extrusion_vector[2];
return (HeeksObj*)pnew;
}
template < typename T >
bool ExtrudedObj<T>::IsDifferent(HeeksObj *other)
{
ExtrudedObj<T>* eobj = (ExtrudedObj<T>*)other;
if (fabs(eobj->m_thickness - m_thickness) > theApp.m_geom_tol)
return true;
for (int i = 0; i<3; i++)
{
if (fabs(eobj->m_extrusion_vector[i] - m_extrusion_vector[i]) > 0.000000000001)
return true;
}
return T::IsDifferent(other);
}
template < typename T > void ExtrudedObj<T>::ModifyByMatrix(const double* m){
gp_Trsf mat = make_matrix(m);
gp_Vec v(m_extrusion_vector[0], m_extrusion_vector[1], m_extrusion_vector[2]);
v.Transform(mat);
extract(v, m_extrusion_vector);
}