POV-Ray : Newsgroups : povray.advanced-users : Tranformation matrix to change coordinate spaces : Re: Tranformation matrix to change coordinate spaces Server Time
6 May 2024 07:01:00 EDT (-0400)
  Re: Tranformation matrix to change coordinate spaces  
From: Ron Parker
Date: 11 May 2001 08:57:44
Message: <slrn9fnoed.m36.ron.parker@fwi.com>
On Fri, 11 May 2001 10:58:10 +0300, Peter Popov wrote:
>This probably does not deserve being here but anyway...
>
>Can anyone (John? Please :) ) show me how to find a matrix that
>changes from one coordinate space (A0, Ax, Ay, Az) to another (A0',
>Ax', Ay', Az')? I found some info on the Net but I have problems
>finding the signs of the angles involved and it will probably be
>slower than some things I recall seeing here.

First you need to calculate the inverse of 

  Ax.x Ax.y Ax.z A0.x
  Ay.x Ay.y Ay.z A0.y
  Az.x Az.y Az.z A0.z
   0    0    0    1

and then multiply that by 

  Ax'.x Ax'.y Ax'.z A0'.x
  Ay'.x Ay'.y Ay'.z A0'.y
  Az'.x Az'.y Az'.z A0'.z
    0     0     0     1

(but I might have that transposed from what you expect, or I might have the 
A0s running along the wrong side of the matrix, so check it first.)

The first matrix (once inverted) should transform back into (0,x,y,z) space, 
and the second transforms to your second space.

-- 
#macro R(L P)sphere{L F}cylinder{L P F}#end#macro P(V)merge{R(z+a z)R(-z a-z)R(a
-z-z-z a+z)torus{1F clipped_by{plane{a 0}}}translate V}#end#macro Z(a F T)merge{
P(z+a)P(z-a)R(-z-z-x a)pigment{rgbf 1}hollow interior{media{emission 3-T}}}#end 
Z(-x-x.2x)camera{location z*-10rotate x*90normal{bumps.02scale.05}}


Post a reply to this message

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