POV-Ray : Newsgroups : povray.advanced-users : matrix extraction from transformation Server Time
25 Nov 2024 23:42:09 EST (-0500)
  matrix extraction from transformation (Message 1 to 8 of 8)  
From:
Subject: matrix extraction from transformation
Date: 9 Nov 2001 04:41:30
Message: <qf8nut4o6ahanjc7s6jc8kqnub2735js8p@4ax.com>
How can I extract components of matrix from Transform identifier ? At source
level it is easy and I can patch it easy to get array from transform. But with
3.5 I have no sources so I have to extract it with manipulation. I suppose
taking some unit vectors and read it after this transformation I can achive
components on transformation matrix. It could be simple when it could be only
translation and scale. But I think about universal macro with transform as
parameter and array[4][3] as result. Should I resolve as many equations as it
contain? What is the shortest way? Anybody have ready solution or should I fight
with it?

ABX
--
#declare _=function(a,b,x){((a^2)+(b^2))^.5-x}#default {pigment{color rgb 1}}
union{plane{y,-3}plane{-x,-3}finish{reflection 1 ambient 0}}isosurface{ //ABX
function{_(x-2,y,1)|_((x+y)*.7,z,.1)|_((x+y+2)*.7,z,.1)|_(x/2+y*.8+1.5,z,.1)}
contained_by{box{<0,-3,-.1>,<3,0,.1>}}translate z*15finish{ambient 1}}//POV35


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: matrix extraction from transformation
Date: 9 Nov 2001 06:00:13
Message: <3bebb73d$1@news.povray.org>

Skiba <abx### [at] babilonorg>  wrote:

> How can I extract components of matrix from Transform identifier ? At source
> level it is easy and I can patch it easy to get array from transform. But with
> 3.5 I have no sources so I have to extract it with manipulation. I suppose
> taking some unit vectors and read it after this transformation I can achive
> components on transformation matrix. It could be simple when it could be only
> translation and scale. But I think about universal macro with transform as
> parameter and array[4][3] as result. Should I resolve as many equations as it
> contain? What is the shortest way? Anybody have ready solution or should I
> fight with it?

Do the reverse:  Have an array keep your matrix components and use a macro
to turn it into a transform block when needed.

    Thorsten

____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trfde

Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

From:
Subject: Re: matrix extraction from transformation
Date: 9 Nov 2001 06:13:27
Message: <lvdnutobd5r1l07jspqdh7dgo7h8gfvdhi@4ax.com>
On Fri, 09 Nov 2001 12:00:12 +0100, "Thorsten Froehlich" <tho### [at] trfde>
wrote:

>In article <qf8nut4o6ahanjc7s6jc8kqnub2735js8p@4ax.com> , Wlodzimierz ABX 
>Skiba <abx### [at] babilonorg>  wrote:
>
> Do the reverse:  Have an array keep your matrix components and use a macro
> to turn it into a transform block when needed.

Yes. That is solution however not in my case IMO. Imagine complicated CSG (I
work on gilles tree macro). This CSG is ready. I want to do as less as possible
to convert this CSG to mesh or mesh2. I builded set of macros to generate meshes
from primitives. Then I wan't write it to file. Since I write only vertices it
is easy becouse they are transformed. But how can I write textures after
transformation? I can do it your way but it will be slower to parse and need
more ingerention sources.

ABX
--
#declare _=function(a,b,x){((a^2)+(b^2))^.5-x}#default {pigment{color rgb 1}}
union{plane{y,-3}plane{-x,-3}finish{reflection 1 ambient 0}}isosurface{ //ABX
function{_(x-2,y,1)|_((x+y)*.7,z,.1)|_((x+y+2)*.7,z,.1)|_(x/2+y*.8+1.5,z,.1)}
contained_by{box{<0,-3,-.1>,<3,0,.1>}}translate z*15finish{ambient 1}}//POV35


Post a reply to this message

From:
Subject: Re: matrix extraction from transformation
Date: 9 Nov 2001 08:18:11
Message: <ellnutkf348dnukghhpth789pc7o4hknvn@4ax.com>

wrote:

> Anybody have ready solution or should I fight with it?

Dear ABX, you should fight alone and not affraid this "awful" matrixes. You
probably not expected it was so simple:

#macro Transform_To_Array(Trans)
  #local A=vtransform(x,Trans);
  #local B=vtransform(y,Trans);
  #local C=vtransform(z,Trans);
  #local D=vtransform(0*x,Trans);
  array[4]{A,B,C,D}
#end

:-)

ABX
--
#declare _=function(a,b,x){((a^2)+(b^2))^.5-x}#default {pigment{color rgb 1}}
union{plane{y,-3}plane{-x,-3}finish{reflection 1 ambient 0}}isosurface{ //ABX
function{_(x-2,y,1)|_((x+y)*.7,z,.1)|_((x+y+2)*.7,z,.1)|_(x/2+y*.8+1.5,z,.1)}
contained_by{box{<0,-3,-.1>,<3,0,.1>}}translate z*15finish{ambient 1}}//POV35


Post a reply to this message

From: Anders K 
Subject: Re: matrix extraction from transformation
Date: 9 Nov 2001 12:06:47
Message: <3bec0d27$1@news.povray.org>
> #macro Transform_To_Array(Trans)
>   #local A=vtransform(x,Trans);
>   #local B=vtransform(y,Trans);
>   #local C=vtransform(z,Trans);
>   #local D=vtransform(0*x,Trans);
>   array[4]{A,B,C,D}
> #end

Shouldn't that be array[4]{A-D, B-D, C-D, D}?


Post a reply to this message

From:
Subject: Re: matrix extraction from transformation
Date: 9 Nov 2001 12:10:07
Message: <cd3outglhk60i0mk3scelr52p9cu5nv8uo@4ax.com>
On Fri, 9 Nov 2001 12:06:53 -0500, "Anders K." <and### [at] f2scom> wrote:

> > #macro Transform_To_Array(Trans)
> >   #local A=vtransform(x,Trans);
> >   #local B=vtransform(y,Trans);
> >   #local C=vtransform(z,Trans);
> >   #local D=vtransform(0*x,Trans);
> >   array[4]{A,B,C,D}
> > #end
>
> Shouldn't that be array[4]{A-D, B-D, C-D, D}?

right, I missed this bug probably becouse I tested it with D=<0,0,0>
thanks

ABX
--
#declare _=function(a,b,x){((a^2)+(b^2))^.5-x}#default {pigment{color rgb 1}}
union{plane{y,-3}plane{-x,-3}finish{reflection 1 ambient 0}}isosurface{ //ABX
function{_(x-2,y,1)|_((x+y)*.7,z,.1)|_((x+y+2)*.7,z,.1)|_(x/2+y*.8+1.5,z,.1)}
contained_by{box{<0,-3,-.1>,<3,0,.1>}}translate z*15finish{ambient 1}}//POV35


Post a reply to this message

From: Tor Olav Kristensen
Subject: Re: matrix extraction from transformation
Date: 9 Nov 2001 17:18:43
Message: <3BEC5618.2AAB757@online.no>

> 
> On Fri, 9 Nov 2001 12:06:53 -0500, "Anders K." <and### [at] f2scom> wrote:
> 
> > > #macro Transform_To_Array(Trans)
> > >   #local A=vtransform(x,Trans);
> > >   #local B=vtransform(y,Trans);
> > >   #local C=vtransform(z,Trans);
> > >   #local D=vtransform(0*x,Trans);
> > >   array[4]{A,B,C,D}
> > > #end
> >
> > Shouldn't that be array[4]{A-D, B-D, C-D, D}?
> 
> right, I missed this bug probably becouse I tested it with D=<0,0,0>
> thanks

During my v3.5 pre-beta testing period I made a
similar macro to this one.

- And I thought it made it to either:
transforms.inc or functions.inc.

But right now I'm not able to find it in any of those.


Tor Olav


Post a reply to this message

From: s1631001
Subject: Re: matrix extraction from transformation
Date: 10 Dec 2001 06:47:06
Message: <3C14A046.C747369D@namtar.qub.ac.uk>
I just came in here to ask if anyone had a macro like this. Isn't
prescience wonderful?

"Anders K." wrote:
> 
> > #macro Transform_To_Array(Trans)
> >   #local A=vtransform(x,Trans);
> >   #local B=vtransform(y,Trans);
> >   #local C=vtransform(z,Trans);
> >   #local D=vtransform(0*x,Trans);
> >   array[4]{A,B,C,D}
> > #end
> 
> Shouldn't that be array[4]{A-D, B-D, C-D, D}?

-- 
signature{
  "Grey Knight"
  contact{ email "gre### [at] yahoocom" }
  site_of_week{ url "http://enphilistor.users4.50megs.com/" }
}


Post a reply to this message

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