[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

*To*: linuxgames@sunsite.dk*Subject*: Re: Intersection of two cylinders*From*: Henningsen <alg@glinx.com>*Date*: Fri, 15 Mar 2002 09:28:22 -0400*Delivered-To*: archiver@seul.org*Delivered-To*: mailing list linuxgames@sunsite.dk*Delivery-Date*: Fri, 15 Mar 2002 08:22:34 -0500*Mailing-List*: contact linuxgames-help@sunsite.dk; run by ezmlm*Reply-To*: linuxgames@sunsite.dk

> Does anyone know a fast algorithm to calculate the volume of the >intersection of two cylinders, or wher eI might find one? All the examples I >have so far been able to dig up through google requires some pretty >heavy-duty number crunching just to get an approximation :( If you've made a solid search, I would assume that there simply is no simple formula. The volume is given by a double integral, and if it cannot be solved by a formula you will have to numerically approximate that integral, which will require substantial computation irrespective of what type of numerical integration method you choose. > I need to me able to detect when, and by how much, two cylinders defined >by a fixed point, a vector and a radius intersect as part of one of the >calculations my game needs to do for a high energy vortex simulation.. It's easy to find when they intersect: Just compute the distance between the two central axes and compare with the sum of the radii. The difference between the sum of the radii and the distance also gives you a measure of how much they intersect, although a very different one from the volume you want: Two parallel cylinders will intersect with an infinite volume when they intersect at all, whereas the volume will be smallest when the axes are at right angles. If it is important for your application to use the actual volume of the intersection, you will need to do a numeriacl approximation to the integral describing the volume. You could speed up that process substantially by using a large steplength in your numerical integration method. The steplengths you see in mathematical texts will usually go for a *very* close approximation to the actual integral, whereas you could probably get by with a very crude one, and use steplengths in the order of a tenth of your cylinder radii, maybe. However, it would be easiest if you could just get by with a measure of how close the central axes of the cylinders come to each other. I'd suggest you examine your game design closely to see whether you can evolve it in this manner. Peter Henningsen alifegames.com

**Follow-Ups**:**Re: Intersection of two cylinders***From:*Chris <chris@starforge.co.uk>

- Prev by Date:
**Intersection of two cylinders** - Next by Date:
**Re: Intersection of two cylinders** - Prev by thread:
**Intersection of two cylinders** - Next by thread:
**Re: Intersection of two cylinders** - Index(es):