POV-Ray : Newsgroups : povray.advanced-users : Vector to Angle : Re: Vector to Angle Server Time
16 Apr 2024 10:20:02 EDT (-0400)
  Re: Vector to Angle  
From: Bald Eagle
Date: 31 May 2017 09:20:01
Message: <web.592ec2d03905ed8fc437ac910@news.povray.org>
OK, the way I see it is that you need to take the atan2 of your _distance_
between the 2 points and the x or y value of the look_at

The key is that you need to take into account the x AND y variation of your
vector when you calculate the x and y angles.   So use the whole vector length
in your atan2 function.

so, that would be something like

degrees(atan2(Vlength(LA-Cam), LA.x)) and degrees(atan2(Vlength(LA-Cam), LA.y))

or expanded:

degrees(  atan2 ( sqrt( ((LA.x-Cam.x)^2)+((LA.y-Cam.y)^2)+((LA.z-Cam.z)^2) ),
LA.x  ))

degrees(  atan2 ( sqrt( ((LA.x-Cam.x)^2)+((LA.y-Cam.y)^2)+((LA.z-Cam.z)^2) ),
LA.y  ))

(worked out in OpenOffice, so they _may_ some editing need (like the N^2
notation) )

Good luck, YMMV   :D


Post a reply to this message

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