Subject: CGAL users discussion list
List archive
- From: "J.L.M." <>
- To:
- Subject: [cgal-discuss] Minkowski sum of two Nef_polyhedra_3, one is a boundary
- Date: Sun, 18 Apr 2010 07:58:51 -0400
When I perform the Minkowski sum of two Nef_polyhedra_3 when one of them is a boundary, the result is nothing. Should this work as expected? I expect the resultant shape to be the equivalent of translating the one polyhedra by every coordinate in the boundary of the other polyhedra.
Specifically, I have a tetrahedron, and the boundary of a cube. The tetrahedron is much smaller than the cube, so I expect the Minkowski sum to have a cavity in the center. Instead, I get nothing. Below is a very simple example. When I use N0 I get something, when I use N0_boundary, I get nothing.
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/Nef_polyhedron_3.h>
#include <CGAL/IO/Nef_polyhedron_iostream_3.h>
#include <CGAL/minkowski_sum_3.h>
#include <CGAL/IO/Qt_widget_Nef_3.h>
#include <CGAL/aff_transformation_tags.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/IO/Polyhedron_iostream.h>
#include <fstream>
#include <iostream>
#include <qapplication.h>
typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel;
typedef CGAL::Nef_polyhedron_3<Kernel> Nef_polyhedron_3;
typedef CGAL::Aff_transformation_3<Kernel> Aff_transformation;
typedef CGAL::Polyhedron_3<Kernel> Polyhedron;
typedef Kernel::Point_3 Point_3;
int main(int argc, char* argv[])
{
Nef_polyhedron_3 N0;
std::ifstream in("cube.nef3");
in >> N0;
Aff_transformation scale(10, 0, 0, 0, 10, 0, 0, 0, 10, 2);
N0.transform(scale);
Point_3 p( 1.0, 0.0, 0.0);
Point_3 q( 0.0, 1.0, 0.0);
Point_3 r( 0.0, 0.0, 1.0);
Point_3 s( 0.0, 0.0, 0.0);
Polyhedron P;
P.make_tetrahedron(p, q, r, s);
if(P.is_closed())
{
Nef_polyhedron_3 N1(P);
Nef_polyhedron_3 N0_boundary=N0.boundary();
Nef_polyhedron_3 U10=CGAL::minkowski_sum_3(N1, N0_boundary);
std::cout << U10;
QApplication a(argc, argv);
CGAL::Qt_widget_Nef_3<Nef_polyhedron_3>* w=new CGAL::Qt_widget_Nef_3<Nef_polyhedron_3>(U10);
a.setMainWidget(w);
w->show();
return a.exec();
}
return 0;
}
- [cgal-discuss] Minkowski sum of two Nef_polyhedra_3, one is a boundary, J.L.M., 04/18/2010
Archive powered by MHonArc 2.6.16.