POV-Ray : Newsgroups : povray.general : stare_at? : Re: stare_at? Server Time
12 Aug 2024 19:35:54 EDT (-0400)
  Re: stare_at?  
From: Karsten Senz
Date: 22 Jan 1999 05:14:50
Message: <36A84FB6.DB5E8E37@wi-bw.tfh-wildau.de>
Phil Clute wrote:

> My sky vector is y.
> 
> My only problem now is that if my stare_at x and z vectors are both 0.0
> POV barks at me about a "domain error in atan2".
> Other than that, it works very nicely.
> Thank you

Having the x and z vectors 0 mean you are looking straight up or down.
You just have to find out by comparing the eye_y with the stare_at_y.

indicator = (eye_y - stare_at_y)/abs(eye_y-stare_at_y);

this way you will get a -1 for looking down and a +1 for looking
straight up. Now rotate around x or z.

rotation x*indicator*180



Again there is a big danger having eye_y == stare_at_y. So you should
check before rotating at all, that the eye's position and the stare_at
point aren't equal.


Post a reply to this message

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