#include <iostream>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/point_generators_3.h>
#include <CGAL/Random.h>
typedef K::Point_3 Point_3;
typedef K::Triangle_3 Triangle_3;
typedef K::Tetrahedron_3 Tetrahedron_3;
int main() {
std::cout << "This example does two things:" << std::endl;
std::cout << " (i) it creates 100 random points in a triangle in 3D; and" << std::endl;
std::cout << " (ii) it creates 100 random points in a tetrahedron in 3D." << std::endl;
Triangle_3 tri(Point_3(0,0,0),Point_3(1,0,0),Point_3(0,1,0));
Tetrahedron_3 tet(Point_3(0,0,0),Point_3(1,0,0),Point_3(0,1,0),Point_3(0,0,1));
std::vector<Point_3> points_in_tri, points_in_tet;
Point_generator_i g_i(tri);
Point_generator_ii g_ii(tet);
std::copy_n(g_i, 100, std::back_inserter(points_in_tri));
std::copy_n(g_ii, 100, std::back_inserter(points_in_tet));
assert( points_in_tri.size() == 100);
assert( points_in_tet.size() == 100);
std::cout << "In triangle: " << points_in_tri[0] << std::endl;
std::cout << "In tetrahedron: " << points_in_tet[0] << std::endl;
return 0;
}
The class Random_points_in_tetrahedron_3 is an input iterator creating points uniformly distributed i...
Definition: point_generators_3.h:323
The class Random_points_in_triangle_3 is an input iterator creating points uniformly distributed insi...
Definition: point_generators_3.h:183