|
![](/i/fill.gif) |
In article <3d9b7fe7@news.povray.org>,
"Corey Woodworth" <cdw### [at] mpinet net> wrote:
> I've seen lots of cool stuff done with trace but I've never dabbled with it
> myself. I read the docs on it and I'm a bit confused. I have a heightfield
> named canyon, and this is a nested loop to test for an intersection. It
> should always intersect so it should always generate a sphere (I havn't the
> slightest how to test for the slope yet), but it loops infinetly and I dunno
> why. I'm not too good at Macros yet. =)
> Here is my code, can someone point me in the right direction?
Well, your first problem is that you are testing for equality in your
loop conditions...almost always a Bad Thing. Scalar variables in POV-Ray
are double-precision floating point numbers, and numeric errors could
cause them to go right past 0 without ever being exactly equal to it.
Normally, you loop while the counter variable is higher or lower to a
value instead of while it is not equal to a certain value.
You are also looping down, this is just odd, since usually people loop
up unless they have a good reason, but it works, there isn't any reason
not to.
Finally, and probably the real reason you have a problem, the trace()
function takes a ray direction, not an end point. All your trace() calls
are going off in a plane perpendicular to the y axis and passing through
< 0, 2, 0>. Use "trace(Canyon, Start, -y, Norm)" instead.
Oh, and you are missing an #end...I assume this just got lost in editing
for the post, because the code doesn't do anything without it.
--
Christopher James Huff <cja### [at] earthlink net>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tag povray org
http://tag.povray.org/
Post a reply to this message
|
![](/i/fill.gif) |