POV-Ray : Newsgroups : povray.advanced-users : Matrix question : Re: Matrix question Server Time
18 May 2024 13:26:31 EDT (-0400)
  Re: Matrix question  
From: Ben Birdsey
Date: 31 Dec 2000 15:26:36
Message: <3A4F971F.8C76F672@mail.com>
Here's a slightly different method which might be a little faster,
since it uses intrinsically defined functions and pre-calculates more of
the values.

Taking my cue from Rune, define

/////////////////////////////////

#declare bX = <1,-0.05,0>;
#declare bY = <-0.5,0.5,0>;
#declare bZ = <0,0,1>;
#declare bC = <0,0,0>;

// The 16 statements to fill out the 16 elements of the inverse
// New system devised by Ben Birdsey (12/31/00)

#declare xp  = vcross(bY,bZ);
#declare yp  = vcross(bZ,bX);
#declare zp  = vcross(bX,bY);
#declare det = vdot(bX,xp);

#declare c11 = xp.x / det;
#declare c12 = yp.x / det;
#declare c13 = zp.x / det;
#declare c14 = 0;

#declare c21 = xp.y / det;
#declare c22 = yp.y / det;
#declare c23 = zp.y / det;
#declare c24 = 0;

#declare c31 = xp.z / det;
#declare c32 = yp.z / det;
#declare c33 = zp.z / det;
#declare c34 = 0;

#declare c41 = -vdot(xp,bC)/det;
#declare c42 = -vdot(yp,bC)/det;
#declare c43 = -vdot(zp,bC)/det;
#declare c44 = 1;

/////////////////////////////////

I checked the math on Mathematica, so it *should* be right.

You could look at this as some kind of matrix transform and lit it go
there, but maybe we can get some more understanding.

1) The new vectors xp,yp, and zp are the closest thing that the original
transformation could give you for an ordinary coordinate system.  (
because <1,0,0> is equal to vcross(<0,1,0>,<0,0,1>) ...)

2) det, which equals vdot(bX,vcross(bY,bZ)) is equal to the volume
inside the box with corners at 0, bX, bY, bZ, bX+bY, bX+bZ, bY+bZ and
bX+bY+bZ

3) the expressions for the c4x are similar to the amount of bC along
xp,yp,and zp

I hope this helps.

Ben
<><


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.