mirror of https://github.com/CGAL/cgal
restore the optional as it is used by Polyhedral_envelope
This commit is contained in:
parent
d9d2dfc876
commit
2574a13557
|
|
@ -27,7 +27,7 @@ namespace internal {
|
|||
|
||||
// triple plane intersection
|
||||
template <class K>
|
||||
typename K::Point_3
|
||||
boost::optional<typename K::Point_3>
|
||||
intersection_point(const typename K::Plane_3& plane1,
|
||||
const typename K::Plane_3& plane2,
|
||||
const typename K::Plane_3& plane3,
|
||||
|
|
@ -55,6 +55,10 @@ intersection_point(const typename K::Plane_3& plane1,
|
|||
|
||||
const FT den = minor_0*m22 - minor_1*m12 + minor_2*m02; // determinant of M
|
||||
|
||||
if(is_zero(den)){
|
||||
return boost::none;
|
||||
}
|
||||
|
||||
const FT num3 = minor_0*b2 - minor_1*b1 + minor_2*b0; // determinant of M with M[x:2] swapped with [b0,b1,b2]
|
||||
|
||||
// Minors common to two determinants
|
||||
|
|
@ -66,7 +70,7 @@ intersection_point(const typename K::Plane_3& plane1,
|
|||
const FT num1 = - minor_3*m21 + minor_4*m11 - minor_5*m01; // determinant of M with M[x:0] swapped with [b0,b1,b2]
|
||||
const FT num2 = minor_3*m20 - minor_4*m10 + minor_5*m00; // determinant of M with M[x:1] swapped with [b0,b1,b2]
|
||||
|
||||
return typename K::Point_3(num1/den, num2/den, num3/den);
|
||||
return boost::make_optional(typename K::Point_3(num1/den, num2/den, num3/den));
|
||||
}
|
||||
|
||||
template <class K>
|
||||
|
|
@ -83,12 +87,9 @@ intersection(const typename K::Plane_3& plane1,
|
|||
typedef typename K::Line_3 Line_3;
|
||||
typedef typename K::Plane_3 Plane_3;
|
||||
|
||||
if(!is_zero(determinant(plane1.a(), plane1.b(), plane1.c(),
|
||||
plane2.a(), plane2.b(), plane2.c(),
|
||||
plane3.a(), plane3.b(), plane3.c())))
|
||||
{
|
||||
return result_type(intersection_point(plane1,plane2,plane3, k));
|
||||
}
|
||||
auto res = intersection_point(plane1,plane2,plane3, k);
|
||||
if (res != boost::none)
|
||||
return result_type(*res);
|
||||
|
||||
// Intersection between plane1 and plane2 can either be
|
||||
// a line, a plane, or empty.
|
||||
|
|
|
|||
Loading…
Reference in New Issue