CGAL 5.1 - Geometric Object Generators
CGAL::Points_on_segment_2< Point_2 > Class Template Reference

#include <CGAL/point_generators_2.h>

Definition

template<typename Point_2>
class CGAL::Points_on_segment_2< Point_2 >

The class Points_on_segment_2 is a generator for points on a segment whose endpoints are specified upon construction.

The points are equally spaced.

Is Model Of:
PointGenerator
See also
CGAL::points_on_segment<Point_2>
CGAL::Random_points_in_disc_2<Point_2, Creator>
CGAL::Random_points_in_square_2<Point_2, Creator>
CGAL::Random_points_in_triangle_2<Point_2, Creator>
CGAL::Random_points_on_circle_2<Point_2, Creator>
CGAL::Random_points_on_segment_2<Point_2, Creator>
CGAL::Random_points_on_square_2<Point_2, Creator>
CGAL::random_selection()
Examples
Generator/random_segments2.cpp.

Types

typedef std::input_iterator_tag iterator_category
 
typedef Point_2 value_type
 
typedef std::ptrdiff_t difference_type
 
const typedef Point_2pointer
 
const typedef Point_2reference
 
 Points_on_segment_2 (const Point_2 &p, const Point_2 &q, std::size_t n, std::size_t i=0)
 creates an input iterator g generating points of type P equally spaced on the segment from \( p\) to \( q\). More...
 

Operations

double range ()
 returns the range in which the point coordinates lie, i.e. \( \forall x: |x| \leq\) range() and \( \forall y: |y| \leq\)range() More...
 
const Point_2source ()
 returns the source point of the segment. More...
 
const Point_2target ()
 returns the target point of the segment. More...
 

Member Typedef Documentation

◆ difference_type

template<typename Point_2 >
typedef std::ptrdiff_t CGAL::Points_on_segment_2< Point_2 >::difference_type

◆ iterator_category

template<typename Point_2 >
typedef std::input_iterator_tag CGAL::Points_on_segment_2< Point_2 >::iterator_category

◆ value_type

template<typename Point_2 >
typedef Point_2 CGAL::Points_on_segment_2< Point_2 >::value_type

Constructor & Destructor Documentation

◆ Points_on_segment_2()

template<typename Point_2 >
CGAL::Points_on_segment_2< Point_2 >::Points_on_segment_2 ( const Point_2 p,
const Point_2 q,
std::size_t  n,
std::size_t  i = 0 
)

creates an input iterator g generating points of type P equally spaced on the segment from \( p\) to \( q\).

\( n-i\) points are placed on the segment defined by \( p\) and \( q\). Values of the index parameter \( i\) larger than 0 indicate starting points for the sequence further from \( p\). Point \( p\) has index value 0 and \( q\) has index value \( n-1\).

The expressions to_double(p.x()) and to_double(p.y()) must result in the respective double representation of the coordinates of \( p\), and similarly for \( q\).

Member Function Documentation

◆ range()

template<typename Point_2 >
double CGAL::Points_on_segment_2< Point_2 >::range ( )

returns the range in which the point coordinates lie, i.e. \( \forall x: |x| \leq\) range() and \( \forall y: |y| \leq\)range()

◆ source()

template<typename Point_2 >
const Point_2& CGAL::Points_on_segment_2< Point_2 >::source ( )

returns the source point of the segment.

◆ target()

template<typename Point_2 >
const Point_2& CGAL::Points_on_segment_2< Point_2 >::target ( )

returns the target point of the segment.

Member Data Documentation

◆ pointer

template<typename Point_2 >
const typedef Point_2* CGAL::Points_on_segment_2< Point_2 >::pointer

◆ reference

template<typename Point_2 >
const typedef Point_2& CGAL::Points_on_segment_2< Point_2 >::reference