POV-Ray : Newsgroups : povray.advanced-users : Object's rotation matrix : Re: Object's rotation matrix Server Time
15 May 2024 20:30:38 EDT (-0400)
  Re: Object's rotation matrix  
From: bublible
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

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