Add doc for the new classes.

This commit is contained in:
Maxime Gimeno 2016-07-20 11:14:04 +02:00 committed by Sébastien Loriot
parent 472f9beffb
commit b352ec6cad
8 changed files with 108 additions and 23 deletions

View File

@ -371,6 +371,8 @@ typedef const Point_2& reference;
\sa`CGAL::Random_points_on_triangle_mesh_3<Point_3, TriangleMesh>` \sa`CGAL::Random_points_on_triangle_mesh_3<Point_3, TriangleMesh>`
\sa`CGAL::Random_points_on_tetrahedral_mesh_boundary<C3T3>` \sa`CGAL::Random_points_on_tetrahedral_mesh_boundary<C3T3>`
\sa`CGAL::Random_points_in_tetrahedral_mesh_3<C3T3>` \sa`CGAL::Random_points_in_tetrahedral_mesh_3<C3T3>`
\sa `CGAL::Random_points_in_triangles_3<Point_3>`
\sa `CGAL::Random_points_in_triangles_2<Point_2>`
\sa `std::random_shuffle` \sa `std::random_shuffle`
*/ */
@ -418,6 +420,75 @@ default_random);
}; /* end Random_points_in_triangle_mesh_2 */ }; /* end Random_points_in_triangle_mesh_2 */
/*!
The class `Random_points_in_triangles_2` is an input iterator creating points uniformly distributed inside a range of `Triangle_2`. The range must remain valid.
\cgalModels `InputIterator`
\cgalModels `PointGenerator`
\sa `CGAL::cpp11::copy_n()`
\sa `CGAL::Counting_iterator`
\sa `CGAL::Points_on_segment_2<Point_2>`
\sa `CGAL::Random_points_in_disc_2<Point_2, Creator>`
\sa `CGAL::Random_points_on_segment_2<Point_2, Creator>`
\sa `CGAL::Random_points_on_square_2<Point_2, Creator>`
\sa `CGAL::Random_points_in_cube_3<Point_3, Creator>`
\sa `CGAL::Random_points_in_triangle_3<Point_2, Creator>`
\sa `CGAL::Random_points_in_tetrahedron_3<Point_2, Creator>`
\sa `CGAL::Random_points_on_triangle_mesh_3<Point_3, TriangleMesh>`
\sa `CGAL::Random_points_on_tetrahedral_mesh_boundary<C3T3>`
\sa `CGAL::Random_points_in_tetrahedral_mesh_3<C3T3>`
\sa `CGAL::Random_points_in_triangles_3<Point_3>`
\sa `std::random_shuffle`
*/
template< typename Point_2 >
class Random_points_in_triangles_2 {
public:
/// \name Types
/// @{
/*!
*/
typedef std::input_iterator_tag iterator_category;
/*!
*/
typedef Point_2 value_type;
/*!
*/
typedef std::ptrdiff_t difference_type;
/*!
*/
typedef const Point_2* pointer;
/*!
*/
typedef const Point_2& reference;
/*!
Creates an input iterator `g` generating points of type `Point_2` uniformly
distributed between the triangles of the range. Each triangle has a probability to be chosen to hold the point depending on its area.
*/
template<typename TriangleRange>
Random_points_in_triangles_2(TriangleRange triangles, Random& rnd =
default_random);
/// @}
}; /* end Random_points_in_triangles_2 */
/*! /*!
The class `Random_points_on_circle_2` is an input iterator creating points uniformly The class `Random_points_on_circle_2` is an input iterator creating points uniformly

View File

@ -331,31 +331,34 @@ get_default_random());
} /* end namespace CGAL */ } /* end namespace CGAL */
namespace CGAL { namespace CGAL {
/*! /*!
The class `Random_points_on_triangles_3` is an input iterator creating points uniformly The class `Random_points_in_triangles_3` is an input iterator creating points uniformly distributed inside a range of `Triangle_3`. The range must remain valid.
distributed inside the triangles of a range.
\cgalModels `InputIterator` \cgalModels `InputIterator`
\cgalModels `PointGenerator` \cgalModels `PointGenerator`
\sa `CGAL::cpp11::copy_n()` \sa `CGAL::cpp11::copy_n()`
\sa `CGAL::Counting_iterator` \sa `CGAL::Counting_iterator`
\sa `CGAL::Points_on_segment_2<Point_2>`
\sa `CGAL::Random_points_in_disc_2<Point_2, Creator>` \sa `CGAL::Random_points_in_disc_2<Point_2, Creator>`
\sa `CGAL::Random_points_on_segment_2<Point_2, Creator>`
\sa `CGAL::Random_points_on_square_2<Point_2, Creator>`
\sa `CGAL::Random_points_in_cube_3<Point_3, Creator>` \sa `CGAL::Random_points_in_cube_3<Point_3, Creator>`
\sa `CGAL::Random_points_in_triangle_3<Point_3, Creator>` \sa `CGAL::Random_points_in_triangle_3<Point_2, Creator>`
\sa `CGAL::Random_points_on_sphere_3<Point_3, Creator>` \sa `CGAL::Random_points_in_tetrahedron_3<Point_2, Creator>`
\sa `CGAL::Random_points_in_triangle_mesh_2<Point_2, Triangulation>` \sa `CGAL::Random_points_on_triangle_mesh_3<Point_3, TriangleMesh>`
\sa `CGAL::Random_points_on_tetrahedral_mesh_boundary<C3T3>` \sa `CGAL::Random_points_on_tetrahedral_mesh_boundary<C3T3>`
\sa `CGAL::Random_points_in_tetrahedral_mesh_3<C3T3>` \sa `CGAL::Random_points_in_tetrahedral_mesh_3<C3T3>`
\sa `CGAL::Random_points_in_triangles_2<Point_2>`
\sa `std::random_shuffle` \sa `std::random_shuffle`
*/ */
template < class Point_3> template< typename Point_3>
class Random_points_on_triangles_3 { class Random_points_in_triangles_3 {
public: public:
/// \name Types /// \name Types
@ -386,20 +389,18 @@ typedef const Point_3* pointer;
*/ */
typedef const Point_3& reference; typedef const Point_3& reference;
/*! /*!
Creates an input iterator `g` generating points of type `Point_3` uniformly Creates an input iterator `g` generating points of type `Point_3` uniformly
distributed in the triangles of `TriangleRange`. Each triangle has a probability to be chosen to hold the point depending on its area. distributed between the triangles of the range. Each triangle has a probability to be chosen to hold the point depending on its area.
TriangleRange must stay valid during the whole operation.
*/ */
typedef<typename TriangleRange> template<typename TriangleRange>
Random_points_on_triangles_3(TriangleRange& triangles, Random& rnd = default_random); Random_points_in_triangles_3(TriangleRange triangulation, Random& rnd =
default_random);
/// @} /// @}
}; /* end Random_points_on_triangles_3 */ }; /* end Random_points_in_triangles_3 */
} /* end namespace CGAL */ } /* end namespace CGAL */
namespace CGAL { namespace CGAL {
@ -421,6 +422,8 @@ distributed inside the faces of a triangle mesh model of `FaceListGraph`.
\sa `CGAL::Random_points_in_triangle_mesh_2<Point_2, Triangulation>` \sa `CGAL::Random_points_in_triangle_mesh_2<Point_2, Triangulation>`
\sa `CGAL::Random_points_on_tetrahedral_mesh_boundary<C3T3>` \sa `CGAL::Random_points_on_tetrahedral_mesh_boundary<C3T3>`
\sa `CGAL::Random_points_in_tetrahedral_mesh_3<C3T3>` \sa `CGAL::Random_points_in_tetrahedral_mesh_3<C3T3>`
\sa `CGAL::Random_points_in_triangles_2<Point_2>`
\sa `CGAL::Random_points_in_triangles_3<Point_3>`
\sa `std::random_shuffle` \sa `std::random_shuffle`
*/ */
@ -493,6 +496,8 @@ C3T3 is a model of `Mesh_complex_3_in_triangulation_3`
\sa `CGAL::Random_points_on_triangle_mesh_3<Point_3, TriangleMesh>` \sa `CGAL::Random_points_on_triangle_mesh_3<Point_3, TriangleMesh>`
\sa `CGAL::Random_points_in_triangle_mesh_2<Point_2, Triangulation>` \sa `CGAL::Random_points_in_triangle_mesh_2<Point_2, Triangulation>`
\sa `CGAL::Random_points_in_tetrahedral_mesh_3<C3T3>` \sa `CGAL::Random_points_in_tetrahedral_mesh_3<C3T3>`
\sa `CGAL::Random_points_in_triangles_2<Point_2>`
\sa `CGAL::Random_points_in_triangles_3<Point_3>`
\sa `std::random_shuffle` \sa `std::random_shuffle`
*/ */
@ -564,6 +569,8 @@ C3T3 is a model of `Mesh_complex_3_in_triangulation_3`
\sa `CGAL::Random_points_on_triangle_mesh_3<Point_3, TriangleMesh>` \sa `CGAL::Random_points_on_triangle_mesh_3<Point_3, TriangleMesh>`
\sa `CGAL::Random_points_in_triangle_mesh_2<Point_2, Triangulation>` \sa `CGAL::Random_points_in_triangle_mesh_2<Point_2, Triangulation>`
\sa `CGAL::Random_points_on_tetrahedral_mesh_boundary<C3T3>` \sa `CGAL::Random_points_on_tetrahedral_mesh_boundary<C3T3>`
\sa `CGAL::Random_points_in_triangles_2<Point_2>`
\sa `CGAL::Random_points_in_triangles_3<Point_3>`
\sa `std::random_shuffle` \sa `std::random_shuffle`
*/ */

View File

@ -32,6 +32,7 @@ on a circle (`Random_points_on_circle_2`),
on a segment (`Random_points_on_segment`), on a segment (`Random_points_on_segment`),
in a square (`Random_points_on_square_2`), in a square (`Random_points_on_square_2`),
in a triangle (`Random_points_in_triangle_2`), in a triangle (`Random_points_in_triangle_2`),
in a range of triangles (`Random_points_in_triangles_2`),
and in a triangle mesh (`Random_points_in_triangle_mesh_2`). and in a triangle mesh (`Random_points_in_triangle_mesh_2`).
For generating grid points we provide three functions, For generating grid points we provide three functions,
`points_on_segment_2()`, `points_on_segment_2()`,
@ -40,6 +41,7 @@ an input iterator `Points_on_segment_2`.
For 3D points, input iterators are provided for random points uniformly For 3D points, input iterators are provided for random points uniformly
distributed in a sphere (`Random_points_in_sphere_3`), in a triangle (`Random_points_in_triangle_3`), distributed in a sphere (`Random_points_in_sphere_3`), in a triangle (`Random_points_in_triangle_3`),
in a range of triangles (`Random_points_in_triangles_3`),
in a tetrahedron (`Random_points_in_tetrahedron_3`), in a cube (`Random_points_in_cube_3`), on the boundary of a sphere in a tetrahedron (`Random_points_in_tetrahedron_3`), in a cube (`Random_points_in_cube_3`), on the boundary of a sphere
(`Random_points_on_sphere_3`), in a triangle mesh (`Random_points_on_triangle_mesh_3`), (`Random_points_on_sphere_3`), in a triangle mesh (`Random_points_on_triangle_mesh_3`),
in a tetrahedron mesh (`Random_points_in_tetrahedral_mesh_3`), and on the boundary in a tetrahedron mesh (`Random_points_in_tetrahedral_mesh_3`), and on the boundary

View File

@ -19,4 +19,7 @@
\example Generator/random_points_on_triangle_mesh_3.cpp \example Generator/random_points_on_triangle_mesh_3.cpp
\example Generator/random_points_on_tetrahedral_mesh_3.cpp \example Generator/random_points_on_tetrahedral_mesh_3.cpp
\example Generator/random_points_in_tetrahedral_mesh_3.cpp \example Generator/random_points_in_tetrahedral_mesh_3.cpp
\example Generator/random_points_in_triangles_2.cpp
\example Generator/random_points_in_triangles_3.cpp
*/ */

View File

@ -20,7 +20,7 @@ int main()
} }
// Create the generator, input is the vector of Triangle_3 // Create the generator, input is the vector of Triangle_3
Random_points_on_triangles_3<Point> g(triangles); Random_points_in_triangles_3<Point> g(triangles);
// Get 100 random points in cdt // Get 100 random points in cdt
CGAL::cpp11::copy_n(g, 1000, std::back_inserter(points)); CGAL::cpp11::copy_n(g, 1000, std::back_inserter(points));

View File

@ -471,7 +471,7 @@ public:
template <class Point_3> template <class Point_3>
class Random_points_on_triangles_3 : public Generic_random_point_generator< class Random_points_in_triangles_3 : public Generic_random_point_generator<
const typename Kernel_traits<Point_3>::Kernel::Triangle_3*, const typename Kernel_traits<Point_3>::Kernel::Triangle_3*,
internal::Deref<const typename Kernel_traits<Point_3>::Kernel::Triangle_3*>, internal::Deref<const typename Kernel_traits<Point_3>::Kernel::Triangle_3*>,
Random_points_in_triangle_3<Point_3> ,Point_3> { Random_points_in_triangle_3<Point_3> ,Point_3> {
@ -483,10 +483,10 @@ public:
Random_points_in_triangle_3<Point_3> ,Point_3> Base; Random_points_in_triangle_3<Point_3> ,Point_3> Base;
typedef const Triangle_3* Id; typedef const Triangle_3* Id;
typedef Point_3 result_type; typedef Point_3 result_type;
typedef Random_points_on_triangles_3<Point_3> This; typedef Random_points_in_triangles_3<Point_3> This;
template<typename TriangleRange> template<typename TriangleRange>
Random_points_on_triangles_3( const TriangleRange& triangles, Random& rnd = default_random) Random_points_in_triangles_3( const TriangleRange& triangles, Random& rnd = default_random)
: Base(make_range( boost::make_transform_iterator(triangles.begin(), internal::Address_of<Triangle_3>()), : Base(make_range( boost::make_transform_iterator(triangles.begin(), internal::Address_of<Triangle_3>()),
boost::make_transform_iterator(triangles.end(), internal::Address_of<Triangle_3>()) ), boost::make_transform_iterator(triangles.end(), internal::Address_of<Triangle_3>()) ),
internal::Deref<const Triangle_3*>(), internal::Deref<const Triangle_3*>(),

View File

@ -78,7 +78,7 @@ int test_triangles_3()
triangles.push_back(K::Triangle_3(Point(0.5,0.5,0), Point(0.5,0.5,0.5), Point(0.5,0.,0.5))); triangles.push_back(K::Triangle_3(Point(0.5,0.5,0), Point(0.5,0.5,0.5), Point(0.5,0.,0.5)));
// Create the generator, input is the vector of Triangle_3 // Create the generator, input is the vector of Triangle_3
Random_points_on_triangles_3<Point> g(triangles); Random_points_in_triangles_3<Point> g(triangles);
// Get 100 random points in triangle range // Get 100 random points in triangle range
CGAL::cpp11::copy_n(g, 100, std::back_inserter(points)); CGAL::cpp11::copy_n(g, 100, std::back_inserter(points));

View File

@ -159,8 +159,10 @@ and <code>src/</code> directories).
<ul> <ul>
<li> <li>
There is now convenience classes to uniformly generate random points on a <code>FaceListGraph</code> and a <code>Triangulation_2</code>, There is now convenience classes to uniformly generate random points on a <code>FaceListGraph</code> and a <code>Triangulation_2</code>,
and there is also classes to do so in and on a <code> Mesh_complex_3_in_triangulation_3</code>, respectively <code>CGAL::Random_points_on_triangle_mesh_3()</code>, <code>CGAL::Random_points_in_triangle_mesh_2()</code>, and there is also classes to do so in and on a <code> Mesh_complex_3_in_triangulation_3</code>, along with classes for a range of
<code>CGAL::Random_points_in_tetrahedral_mesh_3()</code>, and <code>CGAL::Random_points_on_tetrahedral_mesh_boundary()</code>. <code>Triangle_3</code> and a range of <code>Triangle_2</code>: respectively <code>CGAL::Random_points_on_triangle_mesh_3()</code>, <code>CGAL::Random_points_in_triangle_mesh_2()</code>,
<code>CGAL::Random_points_in_tetrahedral_mesh_3()</code>, <code>CGAL::Random_points_on_tetrahedral_mesh_boundary()</code>,
<code>CGAL::Random_points_in_triangles_3</code> and <code>Random_points_in_triangles_2</code>.
</li> </li>
</ul> </ul>
<!-- Spatial Searching and Sorting --> <!-- Spatial Searching and Sorting -->