polyeder.c++
1.89 KB
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
#include "polyeder.h"
polyeder::polyeder(const polygon& p, const vertex_list& vl) :
container<polygon>(p), vl(vl) {
for(unsigned i=0; i<count; i++) {
content[i].set_vertex_list(&this->vl);
content[i]._init_normal_();
content[i].set_polyeder(this);
}
}
polyeder::polyeder(const polygon* p, unsigned c, const vertex_list& vl) :
container<polygon>(p, c), vl(vl) {
for(unsigned i=0; i<count; i++) {
content[i].set_vertex_list(&this->vl);
content[i]._init_normal_();
content[i].set_polyeder(this);
}
}
polyeder::polyeder(const polyeder& p) :
container<polygon>(p), vl(p.vl) {
for(unsigned i=0; i<count; i++) {
content[i].set_vertex_list(&this->vl);
content[i].set_polyeder(this);
}
}
const polyeder& polyeder::operator=(const polyeder& p) {
if(this==&p)
return *this;
container<polygon>::operator=(p);
vl=p.vl;
for(unsigned i=0; i<count; i++) {
content[i].set_vertex_list(&vl);
content[i].set_polyeder(this);
}
return *this;
}
void polyeder::transform(const Mmn<double>& tm, int p) {
for(unsigned i=0; i<count; i++) {
content[i].transform(tm, p);
}
}
void polyeder::transform_normals(const Mmn<double>& tm, int p) {
for(unsigned i=0; i<count; i++) {
content[i].transform_normal(tm, p);
}
}
void polyeder::reset(void) {
vl.reset();
for(unsigned i=0; i<count; i++) {
content[i].reset();
}
}
void polyeder::trans_poly(unsigned i, const Mmn<double>& tm, int p) {
content[i].transform(tm, p);
}
void polyeder::project_2d(double lcx, double sw, double sh,
double ph_ar, double sy, int p) {
for(unsigned i=0; i<count; i++) {
content[i].project_2d(lcx, sw, sh, ph_ar, sy, p+1);
}
for(unsigned i=0; i<vl.card(); i++) {
vl[i].set_trans_stage(p);
}
}