Template Class Bresenham2i::Line
Defined in File bresenham.hpp
Nested Relationships
This class is a nested type of Class Bresenham2i.
Nested Types
Inheritance Relationships
Base Type
public ranges::view_interface< Line< Vector2, typename Vector2::Scalar > >
Class Documentation
-
template<class Vector2, typename Integer = typename Vector2::Scalar>
class Line : public ranges::view_interface<Line<Vector2, typename Vector2::Scalar>> Bresenham’s 2D line drawing as a range.
- Template Parameters:
Vector2 – 2D vector type. Must be default constructible, copy constructible, and implement
Vector2d::x()
andVector2::y()
methods returning both lvalues (for mutation) and rvalues.Integer – Integer scalar type.
Public Functions
-
Line() = default
Constructs point line.
-
inline explicit Line(Vector2 p0, Vector2 p1, Variant variant)
Constructs a Bresenham’s 2D line drawing.
-
inline auto begin() const
Returns an iterator pointing to the first point in the line.
-
inline auto end() const
Returns a sentinel as past-of-end iterator.
-
class iterator
Bresenham’s 2D line drawing iterator, one cell at a time.
Public Types
-
using iterator_category = std::forward_iterator_tag
Iterator category tag.
-
using difference_type = std::ptrdiff_t
Iterator difference type (as required by ranges::view_).
-
using value_type = Vector2
Iterated value type.
-
using pointer = Vector2*
Pointer to iterated value type.
-
using reference = Vector2&
Reference to iterated value type.
Public Functions
-
iterator() = default
Default constructor.
-
inline explicit iterator(const Line *line)
Constructs a Bresenham’s 2D
line
iterator.
-
inline iterator operator++(int)
Post-fix operator overload.
-
inline iterator &operator++()
Prefix operator overload.
-
inline const Vector2 &operator*() const
Dereference operator overload (only const).
-
inline const Vector2 *operator->() const
Arrow operator overload (only const).
-
inline bool operator==(const iterator &other) const
Equality operator overload (as required by std::forward_iterator).
-
inline bool operator!=(const iterator &other) const
Inequality operator overload (as required by std::forward_iterator).
-
inline bool operator==(const sentinel&) const
Sentinel equality operator overload.
-
inline bool operator!=(const sentinel &other) const
Sentinel inequality operator overload.
-
struct sentinel
Past-of-end iterator sentinel.
-
using iterator_category = std::forward_iterator_tag