POV-Ray : Newsgroups : povray.general : A problem with height field intersection algorithm : A problem with height field intersection algorithm Server Time
5 Aug 2024 08:24:19 EDT (-0400)
  A problem with height field intersection algorithm  
From: Johannes Dahlstrom
Date: 15 Oct 2002 13:55:41
Message: <3dac569c@news.povray.org>
Hi,

I'm implementing the height field object to my ray tracer and reasoned that 
I should use a line drawing algorithm to check the ray against exactly 
those triangles which lie along its path. I chose the Bresenham's algorithm 
because of its speed. It didn't quite work: there were holes in the height 
field. After some thinking I realized that it is because the fractional 
parts of the entry and exit coordinates (in "pixel" units) matter, and the 
standard algorithm didn't take them into account. I'd like some hints on 
how to do that. Perhaps calculating somehow an initial value for the 
Bresenham's "error" variable? Or should I take an entirely different 
approach?

I'll post an illustration of the problem to p.b.i shortly. It'll probably 
be more descriptive than my text above ;).      

-Johannes


Post a reply to this message

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