Re: [Algorithms] Sphere to Triangle overlap check
Brought to you by:
vexxed72
From: Jon W. <jw...@gm...> - 2010-07-29 08:21:01
|
If memory serves, you don't need to do all those square roots and normalizes if you use the barycentric coordinate method. Also, the radius of the projected circle is sqrt(sphereRadius - abs(distanceToPlane)) -- you have a sign error in the case the sphere is above the plane (and the distance is positive). Sincerely, jw -- Americans might object: there is no way we would sacrifice our living standards for the benefit of people in the rest of the world. Nevertheless, whether we get there willingly or not, we shall soon have lower consumption rates, because our present rates are unsustainable. On Wed, Jul 28, 2010 at 7:41 AM, Mark Wayland <wa...@in...>wrote: > Zaf, > > First find the distance of the sphere center from the plane. If the abs > distance is greater than the radius then there is no overlap. > You then need to find the radius of the circle of intersection with the > plane which is much easier than you think. The radius of intersection is > simply sqrt(sphereRadiusSqr + centerDistFromPlane). Then find the distance > from the sphere center projected onto the plane to each edge. If the > distance is less than the radius of intersection then there's an overlap. > To find the distance to the edge, calc edgeNormal via > normalize(cross(faceNormal, edge)) then calc (projectedCenter - > edgeStartVertex) dot edgeNormal. > This was all from memory and a quick scribble so hopefully it's correct :-) > > Cheers, > Mark > > > On 28/07/2010, at 9:34 PM, Zafar Qamar <zaf...@co...> > wrote: > > > Hi, > > This is a very old question but I can't seem to find a good answer for it > and I've searched the net for quite a while. > > > > I need a precise way of checking if a sphere and a given triangle have > _any_ overlap. > > Specifically, the case I'm struggling with is when the sphere just > overlaps one of the edges. > > Also, I need to cater for when the sphere is completely inside the > triangle, and vice-versa > > > > Help please? Or a decent internet link would be much appreciated > > > > Cheers > > Zaf > > > > > ********************************************************************************** > > Disclaimer > > > > The information and attached documentation in this e-mail is intended for > the use of the addressee only and is confidential. If you are not the > intended recipient please delete it and notify us immediately by telephoning > or e-mailing the sender. Please note that without Codemasters’ prior written > consent any form of distribution, copying or use of this communication or > the information in it is strictly prohibited and may be unlawful. > > > > Attachments to this e-mail may contain software viruses. You are advised > to take all reasonable precautions to minimise this risk and to carry out a > virus check on any documents before they are opened. > > > > Any offer contained in this communication is subject to Codemasters’ > standard terms & conditions and must be signed by both parties. Except as > expressly provided otherwise all information and attached documentation in > this e-mail is subject to contract and Codemasters’ board approval. > > Any views or opinions expressed are solely those of the author and do not > necessarily represent those of Codemasters. > > > > This footnote also confirms that this email message has been swept by > > SurfControl for the presence of computer viruses. > > > ********************************************************************************** > > > > > > > ------------------------------------------------------------------------------ > > The Palm PDK Hot Apps Program offers developers who use the > > Plug-In Development Kit to bring their C/C++ apps to Palm for a share > > of $1 Million in cash or HP Products. Visit us here for more details: > > http://ad.doubleclick.net/clk;226879339;13503038;l? > > http://clk.atdmt.com/CRS/go/247765532/direct/01/ > > _______________________________________________ > > GDAlgorithms-list mailing list > > GDA...@li... > > https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list > > Archives: > > > http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list > > > ------------------------------------------------------------------------------ > The Palm PDK Hot Apps Program offers developers who use the > Plug-In Development Kit to bring their C/C++ apps to Palm for a share > of $1 Million in cash or HP Products. Visit us here for more details: > http://p.sf.net/sfu/dev2dev-palm > _______________________________________________ > GDAlgorithms-list mailing list > GDA...@li... > https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list > |