Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] precondition violation when intersecting a line with a sphere

Subject: CGAL users discussion list

List archive

[cgal-discuss] precondition violation when intersecting a line with a sphere


Chronological Thread 
  • From: yanyajie <>
  • To: "cgal-discuss-list" <>
  • Subject: [cgal-discuss] precondition violation when intersecting a line with a sphere
  • Date: Fri, 13 May 2011 00:30:05 +0800
  • Importance: Normal

Hi,
 
I encounterd a precondition violation error when I was trying to find the intersection between a line and a sphere.
-----------------------------------------------------------------------------------
CGAL error: precondition violation!
_expression_ : !p.degenerated()
File       : d:\codes\lib\cgal-3.7\include\cgal\algebraic_kernel_for_spheres\int
ernal_functions_on_roots_and_polynomial_1_3_and_2_3.h
Line       : 212
Explanation:
Refer to the bug-reporting instructions at http://www.cgal.org/bug_report.html
-------------------------------------------------------------------------------------
 
I provide necessary info in the following to help reproduce the error:
 
------------------------------------------------------------------------------------------------------------------------------------------------------
typedef CGAL::Cartesian<double> K;
typedef CGAL::Spherical_kernel_3<K, CGAL::Algebraic_kernel_for_spheres_2_3<int> > SphericalK;
typedef SphericalK::Point_3 Point_3_SK;
 
// to compute the intersection, I construct a line and a sphere using the spherical kernel as follows:
CGAL::Line_3<SphericalK> line(Point_3_SK(-0.1,-0.1,-0.1), Point_3_SK(-0.1,-0.1,0.0));
CGAL::Sphere_3<SphericalK> s(Point_3_SK(0, 0, 0), 0.1); // c is a Point_3
vector<CGAL::Object> isecs;
CGAL::intersection(line, s, std::back_inserter(isecs));
------------------------------------------------------------------------------------------------------------------------------------------------------
 
The assertion error is issued from within CGAL::intersection, when it tries to do the confirmation,
actually, from this function:
 
template < class AK, class OutputIterator >
inline
OutputIterator
    solve(const typename AK::Polynomials_for_line_3 &p,
          const typename AK::Polynomial_for_spheres_2_3& s,
     OutputIterator res )
{
...
// we must have a line
CGAL_kernel_precondition(!p.degenerated());
...
}
 
 
Does this failure of assertion indicates I constructed a degenerate line? But from the code you can see the line should be non-degenerate.
 
Thanks if anyone can point out the problem!
 
 
Yan.



Archive powered by MHonArc 2.6.16.

Top of Page