Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] Sphere-Line Intersection

Subject: CGAL users discussion list

List archive

[cgal-discuss] Sphere-Line Intersection


Chronological Thread 
  • From: "Thomas Zangl - Home" <>
  • To: <>
  • Subject: [cgal-discuss] Sphere-Line Intersection
  • Date: Thu, 3 Jul 2008 20:48:15 +0200


Dear List,

I need to implement a Sphere-Line intersection which returns the
intersection points.

Is there anything exact already in CGAL hidden, which I am not able to
find? :-)

If no, does somebody have such a construction which does not use any
sqrt or at least computes the sqrt using exact arithmetic?

I already have an implementation. However, look at this fragment:

if (i>0)
{
// first intersection
mu = (-b + sqrt(to_double(b*b - 4*a*c ))) / (2*a);
x = x1 + mu*(x2-x1);
y = y1 + mu*(y2-y1);
z = z1 + mu*(z2-z1);
vIntersections.push_back(Point(x,y,z));

// second intersection
mu = (-b - sqrt(to_double(b*b - 4*a*c ))) / (2*a);
x = x1 + mu*(x2-x1);
y = y1 + mu*(y2-y1);
z = z1 + mu*(z2-z1);
vIntersections.push_back(Point(x,y,z));
return;
}

As you can see, it requires the sqrt of the term "(b*b - 4*a*c )"
which introduces some inaccuracy. Can I get rid of it? The intersection
routine is based on
http://ozviz.wasp.uwa.edu.au/~pbourke/geometry/sphereline/.

Has anybody something better? TIA!

Best regards,
--
,yours Thomas Zangl, Bakk.rer.soc.oec. -

-
- Freelancer - IT Consulting & Software Development -
- Student of Software Development-Economy (Master) -
- http://blog.tzis.net -



Archive powered by MHonArc 2.6.16.

Top of Page