Class Bresenham2i
Defined in File bresenham.hpp
Nested Relationships
Nested Types
Class Documentation
-
class Bresenham2i
Bresenham’s 2D line drawing algorithm, optimized for integer arithmetic.
Public Types
-
enum Variant
Bresenham’s 2D line drawing algorithm variants.
Values:
-
enumerator kStandard
Standard Bresenham’s algorithm.
-
enumerator kModified
Modified, aka supercover, Bresenham’s algorithm. See http://eugen.dedu.free.fr/projects/bresenham.
-
enumerator kStandard
Public Functions
-
Bresenham2i() noexcept = default
Constructs standard Bresenham 2D line drawing algorithm.
-
Bresenham2i(const Bresenham2i&) noexcept = default
Default copy constructor.
-
Bresenham2i(Bresenham2i&&) noexcept = default
Default move constructor.
-
Bresenham2i &operator=(const Bresenham2i&) noexcept = default
Default copy assignment operator overload.
-
Bresenham2i &operator=(Bresenham2i&&) noexcept = default
Default move assignment operator overload.
-
inline explicit Bresenham2i(Variant variant) noexcept
Constructs specific Bresenham 2D line drawing algorithm
variant
.
-
template<class Vector2i = Eigen::Vector2i>
inline auto operator()(Vector2i p0, Vector2i p1) const Computes 2D line from
p0
top1
.- Template Parameters:
Vector2i – Point in 2D integer space ie. ℤ × ℤ.
- Parameters:
p0 – Start point in 2D integer space.
p1 – End point in 2D integer space.
- Returns:
subtended bresenham2i::line.
-
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_).
Public Functions
-
iterator() = default
Default constructor.
-
inline bool operator==(const iterator &other) const
Equality operator overload (as required by std::forward_iterator).
-
struct sentinel
Past-of-end iterator sentinel.
-
using iterator_category = std::forward_iterator_tag
-
enum Variant