Path: utzoo!attcan!uunet!mcvax!ukc!warwick!jfid From: jfid@warwick.UUCP (James Fidell) Newsgroups: comp.graphics Subject: Ray Tracing :-) Keywords: Ray tracing, Message-ID: <639@ubu.warwick.UUCP> Date: 13 May 88 12:44:19 GMT Sender: news@warwick.UUCP Reply-To: jfid@warwick.UUCP (James Fidell) Organization: Computer Science, Warwick University, UK Lines: 35 For my third year project, I have implemented a ray tracer in C on a Sun 3/60. It does constructive solid geometry on a few simple primitive solids (spheres, cubes, pyramids, cones etc. ), objects in the scene being specified as combinations of rotations, enlargements and translations of these. All arithmetic is done using doubles. When I wrote the cone primitive I had problems because the code which found the intersection points between a ray (specified in vector form r = x + lambda d) and the curved surface of the cone, would sometimes fail, or generate erroneous intersections, because it gave solution values which were only very close to zero ( ie 10^-15 ) when, in fact, they should be exactly zero (I am sure my code is correct :-) I know that this might happen because of rounding or some other inherent representational error, but my knowledge of what could happen in this area is somewhat thin. Does anybody know of a solution to this ? My only work-around was to fudge the code so that values close to zero would be assumed zero. Another related problem - how does one guarantee that a given intersection point is really *on* a surface, and not just a little way above or below it - as might happen with the above case ? Finally, does anyone know of a standard/commonly used notation for defining scenes ? I am thinking of a format which could perhaps be passed through a filter to produce a suitable input format for a polygon modeller, or a different filter to produce input for a CSG ray tracer etc. Thanx, James -- "I walk down the street, | uk: jfid@uk.ac.warwick.uu there's no-one there, | usa: ...seismo!mcvax... though the pavement is one huge crowd" | eur: ..mcvax!ukc!warwick!jfid Eric Clapton / Cream | James Fidell