POV-Ray : Newsgroups : povray.general : Balls! : Re: Balls! Server Time
6 Aug 2024 12:22:08 EDT (-0400)
  Re: Balls!  
From: Christopher James Huff
Date: 23 Mar 2002 15:25:27
Message: <chrishuff-2B2019.15255023032002@netplex.aussie.org>
In article <3c9cbc3b@news.povray.org>,
 "jimbobjim" <jim### [at] blueyondercouk> wrote:

> I have a feeling that the answer lies in the trace() function but after
> reading and re-reading the docs I still don't understand the concept. Is
> there any tutorials anywhere for this sort of thing?

Trace just finds the intersection point of a ray (a line originating 
from a single point and going infinitely in one direction) and an 
object. What are you having trouble with?

For collision checking between a sphere and a box, you could trace a 
bunch of rays fairly evenly over the surface of the sphere and check for 
any intersection points inside the sphere. That would mean the sphere is 
partially going through the box...use enough points and small enough 
time intervals for your simulation and the amount of overlap shouldn't 
be a problem. This would also work for any other object...but it will be 
slow parsing.
If it is always in an axis-aligned box, you can speed it up a lot by 
only shooting 6 rays (one at each face of the box) or by using the 
min_extent() and max_extent() functions. You could do this once at the 
very beginning of the simulation to get the dimensions of the box, and 
use that in your calculations. What I'm wondering is how you can specify 
a box and not know its dimensions...what are you doing?

-- 
Christopher James Huff <chr### [at] maccom>
POV-Ray TAG e-mail: chr### [at] tagpovrayorg
TAG web site: http://tag.povray.org/


Post a reply to this message

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