POV-Ray : Newsgroups : povray.advanced-users : Pointing at an object : Re: Pointing at an object Server Time
26 Jun 2024 09:06:22 EDT (-0400)
  Re: Pointing at an object  
From: Thomas de Groot
Date: 15 Feb 2012 04:15:06
Message: <4f3b779a$1@news.povray.org>
On 15-2-2012 5:01, Tail Kinker wrote:
> Being dissatisfied with Point_At_Trans and Reorient_Trans, for use in my
> inverse kinesics skeleton, I decided to break out the math and try to
> write a replacement. And I ended up with this macro:
>
> #macro Point_To(tvector)
> #declare rho = sqrt (
> abs (tvector.x * tvector.x) +
> abs (tvector.y * tvector.y) +
> abs (tvector.z * tvector.z)
> );
> #declare sigma = sqrt (
> abs (tvector.x * tvector.x) +
> abs (tvector.y * tvector.y)
> );
> #declare phi = degrees(acos (tvector.z / rho));
> #if (tvector.x < 0)
> #declare theta = 180 - degrees(asin (tvector.y / sigma));
> #else
> #declare theta = degrees(asin (tvector.y / sigma));
> #end
> #if
> <90 - phi, 0, theta - 90>
> #end
>
> No doubt someone could make use of this. :)

That last #if is not correct. (...) and #end are missing...

Thomas


Post a reply to this message

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