POV-Ray : Newsgroups : povray.advanced-users : Object's rotation matrix Server Time
23 Nov 2024 15:44:16 EST (-0500)
  Object's rotation matrix (Message 1 to 8 of 8)  
From: bublible
Subject: Object's rotation matrix
Date: 16 Mar 2015 15:45:01
Message: <web.5507318a24dc4c18b91df8500@news.povray.org>
Is there a way to find out/obtain/get object's "rotation matrix" so it can be
applied to another object?


Post a reply to this message

From: clipka
Subject: Re: Object's rotation matrix
Date: 16 Mar 2015 16:26:26
Message: <55073c72@news.povray.org>
Am 16.03.2015 um 20:39 schrieb bublible:
> Is there a way to find out/obtain/get object's "rotation matrix" so it can be
> applied to another object?

Nope, sorry. You'd need to modify POV-Ray's source code for that stunt. 
(And, knowing that you're wrestling with LDD-to-POVRay, that won't get 
you anywhere either because the tool is designed in such a way that 
scenes won't render with an unofficial version of POV-Ray. Did I mention 
before that the tool sucks big time?)


Post a reply to this message

From: bublible
Subject: Re: Object's rotation matrix
Date: 16 Mar 2015 17:10:00
Message: <web.550745dab66bd306b91df8500@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:
> Am 16.03.2015 um 20:39 schrieb bublible:
> > Is there a way to find out/obtain/get object's "rotation matrix" so it can be
> > applied to another object?
>
> Nope, sorry. You'd need to modify POV-Ray's source code for that stunt.
> (And, knowing that you're wrestling with LDD-to-POVRay, that won't get
> you anywhere either because the tool is designed in such a way that
> scenes won't render with an unofficial version of POV-Ray. Did I mention
> before that the tool sucks big time?)

yea you did mention it but it didn't help me much in solving my problem so I did
not care to reply, sorry :D

anyway, there have to be some way as I have here one script dealing with
automatic rotation of background (ehm, actually a box functioning as background)
that expands and face directly to camera nevermind cameras position which is
basically what I want but I want just one axis to be corresponding to the camera
axis in oposite angle as my polygon is rotate<0,0,0> and I want it turns to
directly to camera but only on its y axis (I got gradient polygon functioning as
a base plane and I need its gradient would always go from camera to the distance
far away independently of LDD/camera rotation)


Post a reply to this message

From: clipka
Subject: Re: Object's rotation matrix
Date: 16 Mar 2015 21:23:03
Message: <550781f7$1@news.povray.org>
Am 16.03.2015 um 22:06 schrieb bublible:
> clipka <ano### [at] anonymousorg> wrote:
>> Am 16.03.2015 um 20:39 schrieb bublible:
>>> Is there a way to find out/obtain/get object's "rotation matrix" so it can be
>>> applied to another object?
>>
>> Nope, sorry. You'd need to modify POV-Ray's source code for that stunt.
>> (And, knowing that you're wrestling with LDD-to-POVRay, that won't get
>> you anywhere either because the tool is designed in such a way that
>> scenes won't render with an unofficial version of POV-Ray. Did I mention
>> before that the tool sucks big time?)
>
> yea you did mention it but it didn't help me much in solving my problem so I did
> not care to reply, sorry :D

Even if you had replied, I'd have happily taken the opportunity to again 
point out what I think of the LDD-to-POVRay tool ;)

> anyway, there have to be some way as I have here one script dealing with
> automatic rotation of background (ehm, actually a box functioning as background)
> that expands and face directly to camera nevermind cameras position which is
> basically what I want but I want just one axis to be corresponding to the camera
> axis in oposite angle as my polygon is rotate<0,0,0> and I want it turns to
> directly to camera but only on its y axis (I got gradient polygon functioning as
> a base plane and I need its gradient would always go from camera to the distance
> far away independently of LDD/camera rotation)

If you can get that far from whatever parameters there are floating 
around in the scene, then here's what I'd do:

(1) Transform a unit vector (x or z, depending on the original 
orientation of the model) according to the rotation matrix, using the 
vtransform() function.

(2) Take the resulting vector, and multiply it by <1,0,1>.

(3) If needed, normalize the resulting vector using vnormalize().

=> Voila, you should now have rotated the original vector around the y axis.

If what you need is a rotation rather than a rotated vector, continue as 
follows:

(4) Compute the cosine of the angle between the (normalized) rotated 
vector and the original vector by computing the dot product, using the 
dot() function.

(5) From the cosine of the angle, compute the angle in radians using the 
acos() function.

(6) If needed, compute the angle in degrees by multiplying with 180/pi.

(7) If you find that the rotation doesn't fit, try inverting the sign.

I hope this helps.


Post a reply to this message

From: bublible
Subject: Re: Object's rotation matrix
Date: 17 Mar 2015 08:05:01
Message: <web.550816b9b66bd306b91df8500@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:
> Am 16.03.2015 um 22:06 schrieb bublible:
> > clipka <ano### [at] anonymousorg> wrote:
> >> Am 16.03.2015 um 20:39 schrieb bublible:
> >>> Is there a way to find out/obtain/get object's "rotation matrix" so it can be
> >>> applied to another object?
> >>
> >> Nope, sorry. You'd need to modify POV-Ray's source code for that stunt.
> >> (And, knowing that you're wrestling with LDD-to-POVRay, that won't get
> >> you anywhere either because the tool is designed in such a way that
> >> scenes won't render with an unofficial version of POV-Ray. Did I mention
> >> before that the tool sucks big time?)
> >
> > yea you did mention it but it didn't help me much in solving my problem so I did
> > not care to reply, sorry :D
>
> Even if you had replied, I'd have happily taken the opportunity to again
> point out what I think of the LDD-to-POVRay tool ;)
>
> > anyway, there have to be some way as I have here one script dealing with
> > automatic rotation of background (ehm, actually a box functioning as background)
> > that expands and face directly to camera nevermind cameras position which is
> > basically what I want but I want just one axis to be corresponding to the camera
> > axis in oposite angle as my polygon is rotate<0,0,0> and I want it turns to
> > directly to camera but only on its y axis (I got gradient polygon functioning as
> > a base plane and I need its gradient would always go from camera to the distance
> > far away independently of LDD/camera rotation)
>
> If you can get that far from whatever parameters there are floating
> around in the scene, then here's what I'd do:
>
> (1) Transform a unit vector (x or z, depending on the original
> orientation of the model) according to the rotation matrix, using the
> vtransform() function.
>
> (2) Take the resulting vector, and multiply it by <1,0,1>.
>
> (3) If needed, normalize the resulting vector using vnormalize().
>
> => Voila, you should now have rotated the original vector around the y axis.
>
> If what you need is a rotation rather than a rotated vector, continue as
> follows:
>
> (4) Compute the cosine of the angle between the (normalized) rotated
> vector and the original vector by computing the dot product, using the
> dot() function.
>
> (5) From the cosine of the angle, compute the angle in radians using the
> acos() function.
>
> (6) If needed, compute the angle in degrees by multiplying with 180/pi.
>
> (7) If you find that the rotation doesn't fit, try inverting the sign.
>
> I hope this helps.


:-D looks like you really know what you are talking about much more than I am
able to understand fully at this point, I'm afraid...

So could you elaborate more on this, or even better if it doesn't bother you
much: could you provide some fictional example here (you know, I would just
replace corresponding values in it in my script)?

BTW aren't you on Eurobricks.com (if so I would include you in credit for the
help woth the script as I will post it there including complete tutorial)? I am
asking cos this povray forum format is so
limiting and I would like to write to you about this in more usable way :(


Post a reply to this message

From: bublible
Subject: Re: Object's rotation matrix
Date: 17 Mar 2015 12:40:01
Message: <web.55085835b66bd306b91df8500@news.povray.org>
"bublible" <nomail@nomail> wrote:
> clipka <ano### [at] anonymousorg> wrote:
> > Am 16.03.2015 um 22:06 schrieb bublible:
> > > clipka <ano### [at] anonymousorg> wrote:
> > >> Am 16.03.2015 um 20:39 schrieb bublible:
> > >>> Is there a way to find out/obtain/get object's "rotation matrix" so it can be
> > >>> applied to another object?
> > >>
> > >> Nope, sorry. You'd need to modify POV-Ray's source code for that stunt.
> > >> (And, knowing that you're wrestling with LDD-to-POVRay, that won't get
> > >> you anywhere either because the tool is designed in such a way that
> > >> scenes won't render with an unofficial version of POV-Ray. Did I mention
> > >> before that the tool sucks big time?)
> > >
> > > yea you did mention it but it didn't help me much in solving my problem so I did
> > > not care to reply, sorry :D
> >
> > Even if you had replied, I'd have happily taken the opportunity to again
> > point out what I think of the LDD-to-POVRay tool ;)
> >
> > > anyway, there have to be some way as I have here one script dealing with
> > > automatic rotation of background (ehm, actually a box functioning as background)
> > > that expands and face directly to camera nevermind cameras position which is
> > > basically what I want but I want just one axis to be corresponding to the camera
> > > axis in oposite angle as my polygon is rotate<0,0,0> and I want it turns to
> > > directly to camera but only on its y axis (I got gradient polygon functioning as
> > > a base plane and I need its gradient would always go from camera to the distance
> > > far away independently of LDD/camera rotation)
> >
> > If you can get that far from whatever parameters there are floating
> > around in the scene, then here's what I'd do:
> >
> > (1) Transform a unit vector (x or z, depending on the original
> > orientation of the model) according to the rotation matrix, using the
> > vtransform() function.
> >
> > (2) Take the resulting vector, and multiply it by <1,0,1>.
> >
> > (3) If needed, normalize the resulting vector using vnormalize().
> >
> > => Voila, you should now have rotated the original vector around the y axis.
> >
> > If what you need is a rotation rather than a rotated vector, continue as
> > follows:
> >
> > (4) Compute the cosine of the angle between the (normalized) rotated
> > vector and the original vector by computing the dot product, using the
> > dot() function.
> >
> > (5) From the cosine of the angle, compute the angle in radians using the
> > acos() function.
> >
> > (6) If needed, compute the angle in degrees by multiplying with 180/pi.
> >
> > (7) If you find that the rotation doesn't fit, try inverting the sign.
> >
> > I hope this helps.
>
>
> :-D looks like you really know what you are talking about much more than I am
> able to understand fully at this point, I'm afraid...
>
> So could you elaborate more on this, or even better if it doesn't bother you
> much: could you provide some fictional example here (you know, I would just
> replace corresponding values in it in my script)?
>
> BTW aren't you on Eurobricks.com (if so I would include you in credit for the
> help woth the script as I will post it there including complete tutorial)? I am
> asking cos this povray forum format is so
> limiting and I would like to write to you about this in more usable way :(

Well, I got it and maybe strangely enough the help came from guy called hrontos
- developer of your hated LDD-to-POVRay :):):):):)


Post a reply to this message

From: clipka
Subject: Re: Object's rotation matrix
Date: 18 Mar 2015 08:00:39
Message: <550968e7$1@news.povray.org>
Am 17.03.2015 um 12:59 schrieb bublible:

> BTW aren't you on Eurobricks.com (if so I would include you in credit for the
> help woth the script as I will post it there including complete tutorial)?

Nope; I'm more a 3D rendering enthusiast who also likes to dabble a bit 
with LEGO, rather than a LEGO enthusiast who also likes to dabble a bit 
with 3D renders.


Post a reply to this message

From: clipka
Subject: Re: Object's rotation matrix
Date: 18 Mar 2015 08:02:54
Message: <5509696e$1@news.povray.org>
Am 17.03.2015 um 17:37 schrieb bublible:

> Well, I got it and maybe strangely enough the help came from guy called hrontos
> - developer of your hated LDD-to-POVRay :):):):):)

Hmm... maybe I should contact that guy and try to help make the tool 
better, rather than just rant about it here.


Post a reply to this message

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