CGAL 6.2 - 3D Polyhedral Surface: Polyhedron/polyhedron_prog_planes.cpp

CGAL 6.2 - 3D Polyhedral Surface

Loading...
Searching...
No Matches
Polyhedron/polyhedron_prog_planes.cpp
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Polyhedron_3.h>
#include <iostream>
#include <algorithm>
struct Plane_equation {
template <class Facet>
typename Facet::Plane_3 operator()( Facet& f) {
typename Facet::Halfedge_handle h = f.halfedge();
typedef typename Facet::Plane_3 Plane;
return Plane( h->vertex()->point(),
h->next()->vertex()->point(),
h->next()->next()->vertex()->point());
}
};
typedef CGAL::Simple_cartesian<double> Kernel;
typedef Kernel::Point_3 Point_3;
typedef Kernel::Plane_3 Plane_3;
typedef CGAL::Polyhedron_3<Kernel> Polyhedron;
int main() {
Point_3 p( 1, 0, 0);
Point_3 q( 0, 1, 0);
Point_3 r( 0, 0, 1);
Point_3 s( 0, 0, 0);
Polyhedron P;
P.make_tetrahedron( p, q, r, s);
std::transform( P.facets_begin(), P.facets_end(), P.planes_begin(),
Plane_equation());
CGAL::IO::set_pretty_mode( std::cout);
std::copy( P.planes_begin(), P.planes_end(),
std::ostream_iterator<Plane_3>( std::cout, "\n"));
return 0;
}
CGAL::Polyhedron_3
A polyhedral surface Polyhedron_3 consists of vertices V, edges E, facets F and an incidence relation...
Definition: Polyhedron_3.h:113
Kernel::Plane_3
Kernel::Point_3
CGAL::IO::set_pretty_mode
Mode set_pretty_mode(std::ios &s)
Kernel
CGAL::Simple_cartesian