mirror of https://github.com/CGAL/cgal
fix the test for the dimension of the affine hull of the dual points
This commit is contained in:
parent
8bd72701a1
commit
6554279e9a
|
|
@ -211,31 +211,26 @@ namespace CGAL
|
||||||
if (size < 4)
|
if (size < 4)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Collinear
|
// Look for two non-parallel planes
|
||||||
PlaneIterator plane1_it = planes.begin();
|
PlaneIterator plane1_it = planes.begin();
|
||||||
PlaneIterator plane2_it = planes.begin();
|
PlaneIterator plane2_it = cpp11::next(planes.begin());
|
||||||
++plane2_it;
|
|
||||||
|
|
||||||
PlaneIterator plane3_it = planes.end();
|
|
||||||
--plane3_it;
|
|
||||||
while (plane2_it != planes.end() &&
|
while (plane2_it != planes.end() &&
|
||||||
collinear_plane(*plane1_it, *plane2_it)) {
|
collinear_plane(*plane1_it, *plane2_it)) {
|
||||||
++plane2_it;
|
++plane2_it;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (plane2_it == planes.end()) {
|
if (plane2_it == planes.end()) return false;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Coplanar
|
PlaneIterator plane3_it = cpp11::next(plane2_it);
|
||||||
while (plane2_it != planes.end() &&
|
|
||||||
|
// Look for a triple of planes intersecting in a point
|
||||||
|
while (plane3_it != planes.end() &&
|
||||||
coplanar_plane(*plane1_it, *plane2_it, *plane3_it)) {
|
coplanar_plane(*plane1_it, *plane2_it, *plane3_it)) {
|
||||||
plane2_it++;
|
++plane3_it;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (plane2_it == planes.end()) {
|
if (plane3_it == planes.end()) return false;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -249,7 +244,7 @@ namespace CGAL
|
||||||
void halfspace_intersection_3 (PlaneIterator begin, PlaneIterator end,
|
void halfspace_intersection_3 (PlaneIterator begin, PlaneIterator end,
|
||||||
Polyhedron &P,
|
Polyhedron &P,
|
||||||
boost::optional<typename Polyhedron::Vertex::Point_3> const& origin = boost::none) {
|
boost::optional<typename Polyhedron::Vertex::Point_3> const& origin = boost::none) {
|
||||||
// Checks whether the intersection if a polyhedron
|
// Checks whether the intersection is a polyhedron
|
||||||
CGAL_assertion_msg(Convex_hull_3::internal::is_intersection_dim_3(begin, end), "halfspace_intersection_3: intersection not a polyhedron");
|
CGAL_assertion_msg(Convex_hull_3::internal::is_intersection_dim_3(begin, end), "halfspace_intersection_3: intersection not a polyhedron");
|
||||||
|
|
||||||
// Types
|
// Types
|
||||||
|
|
|
||||||
|
|
@ -16,12 +16,13 @@ int main (void) {
|
||||||
|
|
||||||
// generates supporting planes of the facets of a cube
|
// generates supporting planes of the facets of a cube
|
||||||
std::vector<Plane> planes;
|
std::vector<Plane> planes;
|
||||||
|
|
||||||
planes.push_back( Plane( 1, 0, 0,-1) ); // x= 1
|
planes.push_back( Plane( 1, 0, 0,-1) ); // x= 1
|
||||||
planes.push_back( Plane(-1, 0, 0,-1) ); // x=-1
|
|
||||||
planes.push_back( Plane( 0, 1, 0,-1) ); // y= 1
|
planes.push_back( Plane( 0, 1, 0,-1) ); // y= 1
|
||||||
planes.push_back( Plane( 0,-1, 0,-1) ); // y=-1
|
planes.push_back( Plane( 0,-1, 0,-1) ); // y=-1
|
||||||
planes.push_back( Plane( 0, 0, 1,-1) ); // z= 1
|
planes.push_back( Plane( 0, 0, 1,-1) ); // z= 1
|
||||||
planes.push_back( Plane( 0, 0,-1,-1) ); // z=-1
|
planes.push_back( Plane( 0, 0,-1,-1) ); // z=-1
|
||||||
|
planes.push_back( Plane(-1, 0, 0,-1) ); // x=-1
|
||||||
|
|
||||||
// define polyhedron to hold the intersection
|
// define polyhedron to hold the intersection
|
||||||
Polyhedron_3 P1, P2, P3, P4, P5;
|
Polyhedron_3 P1, P2, P3, P4, P5;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue