Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- i=[ //I
- 1,0,0,0;
- 0,1,0,0;
- 0,0,1,0;
- 0,0,0,1
- ]
- //scale
- s1=[
- 3,0,0,0;
- 0,2,0,0;
- 0,0,1,0;
- 0,0,0,1
- ]
- s2=i
- s3=i
- s4=i
- //translate
- t1=[
- 1,0,0,5;
- 0,1,0,2;
- 0,0,1,0;
- 0,0,0,1
- ]
- t2=[
- 1,0,0,7;
- 0,1,0,0;
- 0,0,1,0;
- 0,0,0,1
- ]
- t3=[
- 1,0,0,8;
- 0,1,0,1;
- 0,0,1,0;
- 0,0,0,1
- ]
- t4=[
- 1,0,0,3;
- 0,1,0,-1;
- 0,0,1,0;
- 0,0,0,1
- ]
- //rotate
- r1=[
- 0,1,0,0;
- -1,0,0,0;
- 0,0,1,0;
- 0,0,0,1
- ]
- r2=[
- -1,0,0,0;
- 0,-1,0,0;
- 0,0,1,0;
- 0,0,0,1
- ]
- r3=[
- 0,-1,0,0;
- 1,0,0,0;
- 0,0,1,0;
- 0,0,0,1
- ]
- r4=[
- 0,-1,0,0;
- 1,0,0,0;
- 0,0,1,0;
- 0,0,0,1
- ]
- rc=[//rot cam
- 0,-1,0,0;
- 1,0,0,0;
- 0,0,1,0;
- 0,0,0,1
- ]
- tc=[//trans camera
- 1,0,0,2;
- 0,1,0,0;
- 0,0,1,0;
- 0,0,0,1
- ]
- v1=[ //triangle
- 0,1,0;
- 0,0,1;
- 0,0,0;
- 1,1,1
- ]
- cv = rc*tc*inv(t1*r1);// camera transformation attached to 1
- m1=t1*r1
- m2=t2*r2
- m3=t3*r3
- m4=t4*r4
- //T=cv*m *s *v
- a = cv*m1*s1*v1;
- b = cv*m2*s2*v1;
- c = cv*m3*s3*v1;
- d = cv*m1*m4*s4*v1; //4 ist kind von 1
- print(%io(2),a);
- print(%io(2),b);
- print(%io(2),c);
- print(%io(2),d);
- // T = I
- // T = T*cv
- // foreachChildren(drawElement())
- //
- // drawElement()
- // push T
- // T = T*m
- // foreachChildren(drawElement())
- // T = T*s
- // draw()
- // T = pop
- va = rc*tc*v1;
- print(%io(2),va);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement