POV-Ray : Newsgroups : povray.general : Transformation problems with stellations Server Time
7 Aug 2024 17:29:12 EDT (-0400)
  Transformation problems with stellations (Message 1 to 9 of 9)  
From: Paul Brants
Subject: Transformation problems with stellations
Date: 25 Jun 2001 07:00:34
Message: <3b3719d2$1@news.povray.org>
Hello all over there
It took a little bit of time to figure out how to post a massage to this
newsgroup but here it is :)
I'm new in this group but I would like to post a problem that I have been
struggling with for some weeks now.
I'm adapting the POV-output of Bulatov's Java stellation applet for
polyhedra and it all boils down to the following:
I have a camera (and a lightbattery associated with it) and an object (let
say a stellation, any other thing with as less symmetry as possible in it
should work)

Mat is a transformation matrix (rotation matrix) and MatInv is the transpose
= inverse of Mat (since it is an orthogonal matrix)



#declare Mat = transform {
matrix <  0.78165571362106,   0.53708769568145,   0.31709801719835,
            -0.61788324155864,   0.59747663990276,   0.51111834693297,
             0.08505671733924,  -0.59544812697505,   0.79887851574402,
            0.00000000000000,   0.00000000000000,   0.00000000000000 >
}

#declare MatInv = transform {
matrix <  0.78165571362106,  -0.61788324155864,   0.08505671733924,
            0.53708769568145,   0.59747663990276,  -0.59544812697505,
          0.31709801719835,   0.51111834693297,   0.79887851574402,
          0.00000000000000,   0.00000000000000,   0.00000000000000 >
}


camera
{
  location  <0.0, 0.0, 3.0>
//   transform MatInv
  direction 1.5*z
  right     4/3*x
  look_at   <0.0, 0.0,  0.0>
}

declare Stellation  =
{
// description of Stellation or any other object centered around origin
follows here....
}

object { Stellation
transform Mat
}

Problem :  if  I  comment out the transform Mat line and uncomment the
transform MatInv line,
this is applying the inverse transformation to the camera (and light
battery) location instead of applying the direct transformation to the
object,
it should give (in my humble opinion) the object in the same position, and I
should have the same image, but this is not the case!
What am I doing wrong??

Paul Brants


Post a reply to this message

From: Warp
Subject: Re: Transformation problems with stellations
Date: 25 Jun 2001 08:19:43
Message: <3b372c5f@news.povray.org>
Paul Brants <pbr### [at] pandorabe> wrote:
: What am I doing wrong??

  The transpose of a matrix and the inverse of a matrix are two completely
different things.
  You are applying the transpose of the matrix to the camera, which has
nothing to do with the inverse.
  Calculating the inverse of a matrix is a bit more complicated. You should
find info in the net about that.

-- 
#macro N(D,I)#if(I<6)cylinder{M()#local D[I]=div(D[I],104);M().5,2pigment{
rgb M()}}N(D,(D[I]>99?I:I+1))#end#end#macro M()<mod(D[I],13)-6,mod(div(D[I
],13),8)-3,10>#end blob{N(array[6]{11117333955,
7382340,3358,3900569407,970,4254934330},0)}//                     - Warp -


Post a reply to this message

From: Gilles Tran
Subject: Re: Transformation problems with stellations
Date: 25 Jun 2001 09:42:50
Message: <3B374033.F7C580F0@inapg.inra.fr>
Warp wrote:

> Paul Brants <pbr### [at] pandorabe> wrote:
> : What am I doing wrong??
>
>   Calculating the inverse of a matrix is a bit more complicated. You should
> find info in the net about that.

Here for instance (see Gauss-Jordan elimination).
http://www.ulib.org/webRoot/Books/Numerical_Recipes/bookcpdf.html
This site is really helpful, BTW.

G.

--

**********************
http://www.oyonale.com
**********************
Graphic experiments
Pov-ray gallery


Post a reply to this message

From: Paul Brants
Subject: Re: Transformation problems with stellations
Date: 25 Jun 2001 11:35:41
Message: <3b375a4d$1@news.povray.org>
"Gilles Tran" <tra### [at] inapginrafr> schreef in bericht
news:3B374033.F7C580F0@inapg.inra.fr...
> Warp wrote:
>
> > Paul Brants <pbr### [at] pandorabe> wrote:
> > : What am I doing wrong??
> >
> >   Calculating the inverse of a matrix is a bit more complicated. You
should
> > find info in the net about that.
>
> Here for instance (see Gauss-Jordan elimination).
> http://www.ulib.org/webRoot/Books/Numerical_Recipes/bookcpdf.html
> This site is really helpful, BTW.
>
> G.
>
> --
>
> **********************
> http://www.oyonale.com
> **********************
> Graphic experiments
> Pov-ray gallery
>
Thanks for the reference, but since Mat is a rotation matrix, it should be
orthogonal, which  means that : its transpose = its inverse
or as you can check out :
 transpose of the matrix * the matrix itself = identity matrix

Paul


Post a reply to this message

From: Ron Parker
Subject: Re: Transformation problems with stellations
Date: 25 Jun 2001 12:10:04
Message: <slrn9jeoiu.2b8.ron.parker@fwi.com>
On Mon, 25 Jun 2001 13:00:23 +0200, Paul Brants wrote:
>camera
>{
>  location  <0.0, 0.0, 3.0>
>//   transform MatInv
>  direction 1.5*z
>  right     4/3*x
>  look_at   <0.0, 0.0,  0.0>
>}

What's the point of doing the transform before setting the direction and
look_at?  Those two will override whatever the transform did for you anyway.

-- 
plane{-z,-3normal{crackle scale.2#local a=5;#while(a)warp{repeat x flip x}rotate
z*60#local a=a-1;#end translate-9*x}pigment{rgb 1}}light_source{-9red 1rotate 60
*z}light_source{-9rgb y rotate-z*60}light_source{9-z*18rgb z}text{ttf"arial.ttf"
"RP".01,0translate-<.6,.4,.02>pigment{bozo}}light_source{-z*3rgb-.2}//Ron Parker


Post a reply to this message

From: Paul Brants
Subject: Re: Transformation problems with stellations
Date: 25 Jun 2001 13:13:52
Message: <3b377150@news.povray.org>
"Ron Parker" <ron### [at] povrayorg> schreef in bericht
news:slr### [at] fwicom...
> On Mon, 25 Jun 2001 13:00:23 +0200, Paul Brants wrote:
> >camera
> >{
> >  location  <0.0, 0.0, 3.0>
> >//   transform MatInv
> >  direction 1.5*z
> >  right     4/3*x
> >  look_at   <0.0, 0.0,  0.0>
> >}
>
> What's the point of doing the transform before setting the direction and
> look_at?  Those two will override whatever the transform did for you
anyway.
>

You could have a point on this but how should I write it then? The purpose
of this all is to rotate the cameraposition and change the view accordingly.
I can't declare an object from a camera and let work the transformation on
it, since I already tried that.

Paul


Post a reply to this message

From: Ron Parker
Subject: Re: Transformation problems with stellations
Date: 25 Jun 2001 14:03:26
Message: <slrn9jev7f.2fa.ron.parker@fwi.com>
On Mon, 25 Jun 2001 19:13:50 +0200, Paul Brants wrote:
>
>"Ron Parker" <ron### [at] povrayorg> schreef in bericht
>news:slr### [at] fwicom...
>> On Mon, 25 Jun 2001 13:00:23 +0200, Paul Brants wrote:
>> >camera
>> >{
>> >  location  <0.0, 0.0, 3.0>
>> >//   transform MatInv
>> >  direction 1.5*z
>> >  right     4/3*x
>> >  look_at   <0.0, 0.0,  0.0>
>> >}
>>
>> What's the point of doing the transform before setting the direction and
>> look_at?  Those two will override whatever the transform did for you
>anyway.
>>
>
>You could have a point on this but how should I write it then? The purpose
>of this all is to rotate the cameraposition and change the view accordingly.
>I can't declare an object from a camera and let work the transformation on
>it, since I already tried that.

Put everything before the transform; that'll get your camera pointed at
the origin (it probably was already, but might as well...) and if that matrix
is indeed just a rotation, it'll stay pointed at the origin.

-- 
plane{-z,-3normal{crackle scale.2#local a=5;#while(a)warp{repeat x flip x}rotate
z*60#local a=a-1;#end translate-9*x}pigment{rgb 1}}light_source{-9red 1rotate 60
*z}light_source{-9rgb y rotate-z*60}light_source{9-z*18rgb z}text{ttf"arial.ttf"
"RP".01,0translate-<.6,.4,.02>pigment{bozo}}light_source{-z*3rgb-.2}//Ron Parker


Post a reply to this message

From: Paul Brants
Subject: Re: Transformation problems with stellations
Date: 25 Jun 2001 14:27:05
Message: <3b378279$1@news.povray.org>
thanks that did the thrick :-)
Paul


Post a reply to this message

From: Mike Williams
Subject: Re: Transformation problems with stellations
Date: 27 Jun 2001 13:45:11
Message: <ZPr9OHAQUdO7Ew2D@econym.demon.co.uk>
Wasn't it Warp who wrote:
>Paul Brants <pbr### [at] pandorabe> wrote:
>: What am I doing wrong??
>
>  The transpose of a matrix and the inverse of a matrix are two completely
>different things.
>  You are applying the transpose of the matrix to the camera, which has
>nothing to do with the inverse.
>  Calculating the inverse of a matrix is a bit more complicated. You should
>find info in the net about that.

If you use MegaPOV, you can ask it to calculate the inverse of the
matrix for you. So you don't have to do any of the complicated maths
yourself. 

      #declare MatInv = transform {Mat inverse}

It's part of the Transform patch, written by Chris Huff.

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

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