Matrix "split"


Re: Matrix "split"
#3
I decided to test my LDCad scripting api whith this as an exercise, it might hold some info for you.

Source:
Code:
src=ldc.matrix(
  0, -4, 0,  
  4.243, 0, -4.243,  
  0, -8, 0,  
  -4.243, 0, -4.243
);
print('org: ', src);

a,b,c,d,e,f,g,h,i=src:getOri();

vx=ldc.vector(a, b, c);
vy=ldc.vector(d, e, f);
vz=ldc.vector(g, h, i);

lx=vx:length();
ly=vy:length();
lz=vz:length();

vx:normalize();
vy:normalize();
vz:normalize();

ori=ldc.matrix(vx, vy, vz);
print('ori: ', ori);

scale=ldc.matrix(
  lx, 0, 0,
  0, ly, 0,
  0, 0, lz
);

print('scale: ', scale);

test=scale*ori;
print('scale*ori: ', test);

Output:
Code:
org: 0 -4 0 4.243 0 -4.243 0 -8 0 -4.243 0 -4.243
ori: 0 0 0 0.707 0 -0.707 0 -1 0 -0.707 0 -0.707
scale: 0 0 0 6.001 0 0 0 8 0 0 0 6.001
scale*ori: 0 0 0 4.243 0 -4.243 0 -8 0 -4.243 0 -4.243
Reply
« Next Oldest | Next Newest »



Messages In This Thread
Matrix "split" - by Santeri Piippo - 2014-07-13, 12:41
Re: Matrix "split" - by Roland Melkert - 2014-07-13, 17:08
Re: Matrix "split" - by Roland Melkert - 2014-07-13, 18:26
Re: Matrix "split" - by Tim Gould - 2014-07-13, 22:21

Forum Jump:


Users browsing this thread: 1 Guest(s)