View difference between Paste ID: SanUQSEg and aCc0UhQm
SHOW: | | - or go back to the newest paste.
1
i=[ //I
2
1,0,0,0;
3
0,1,0,0;
4
0,0,1,0;
5
0,0,0,1
6
]
7
//scale
8
s1=[
9
3,0,0,0;
10
0,2,0,0;
11
0,0,1,0;
12
0,0,0,1
13
]
14
15
s2=i
16
s3=i
17
s4=i
18
//translate
19
t1=[
20
1,0,0,5;
21
0,1,0,2;
22
0,0,1,0;
23
0,0,0,1
24
]
25
26
t2=[
27
1,0,0,7;
28
0,1,0,0;
29
0,0,1,0;
30
0,0,0,1
31
]
32
33
t3=[
34
1,0,0,8;
35
0,1,0,1;
36
0,0,1,0;
37
0,0,0,1
38
]
39
40
t4=[
41
1,0,0,3;
42
0,1,0,-1;
43
0,0,1,0;
44
0,0,0,1
45
]
46
47
//rotate
48
r1=[
49
0,1,0,0;
50
-1,0,0,0;
51
0,0,1,0;
52
0,0,0,1
53
]
54
55
r2=[
56
-1,0,0,0;
57
0,-1,0,0;
58
0,0,1,0;
59
0,0,0,1
60
]
61
62
r3=[
63
0,-1,0,0;
64
1,0,0,0;
65
0,0,1,0;
66
0,0,0,1
67
]
68
69
r4=[
70
0,-1,0,0;
71
1,0,0,0;
72
0,0,1,0;
73
0,0,0,1
74
]
75
76
rc=[//rot cam
77
0,-1,0,0;
78
1,0,0,0;
79
0,0,1,0;
80
0,0,0,1
81
]
82
83
tc=[//trans camera
84
1,0,0,2;
85
0,1,0,0;
86
0,0,1,0;
87
0,0,0,1
88
]
89
90
v1=[    //triangle
91
0,1,0;
92
0,0,1;
93
0,0,0;
94
1,1,1
95
]
96
97
cv = rc*tc*inv(t1*r1);//  camera transformation attached to 1
98
m1=t1*r1
99
m2=t2*r2
100
m3=t3*r3
101
m4=t4*r4
102
103
//T=cv*m *s *v
104
a = cv*m1*s1*v1;
105
b = cv*m2*s2*v1;
106
c = cv*m3*s3*v1;
107
d = cv*m1*m4*s4*v1; //4 ist kind von 1
108
109
110
111
print(%io(2),a);
112
print(%io(2),b);
113
print(%io(2),c);
114
print(%io(2),d);
115
116
//  T = I
117
//  T = T*cv
118
//  foreachChildren(drawElement())
119
//
120
//  drawElement()
121
//      push T
122-
print(%io(2),va);
122+
123
//      foreachChildren(drawElement())
124
//      T = T*s
125
//	draw()
126
//      T = pop
127
128-
print(%io(2),d);
128+
129
va = rc*tc*v1;
130
131
132
133
print(%io(2),va);