|
libtcod
|
Encapsulates a Bresenham line drawing algorithm. More...
#include <bresenham.hpp>
Public Member Functions | |
| BresenhamLine (Point2 begin, Point2 end) noexcept | |
| Construct a new Bresenham line from begin to end. | |
| BresenhamLine (Point2 begin, Point2 end, int error) noexcept | |
| Construct a new Bresenham line with a manually given error value. | |
| BresenhamLine & | operator++ () noexcept |
| BresenhamLine | operator++ (int) noexcept |
| BresenhamLine & | operator-- () noexcept |
| BresenhamLine | operator-- (int) noexcept |
| value_type | operator[] (int index) noexcept |
| Return the world position of the Bresenham at the index relative to the current index. | |
| value_type | operator* () noexcept |
| Return the world position of the Bresenham at the current index. | |
| constexpr bool | operator== (const BresenhamLine &rhs) const noexcept |
| constexpr bool | operator!= (const BresenhamLine &rhs) const noexcept |
| constexpr difference_type | operator- (const BresenhamLine &rhs) const noexcept |
| BresenhamLine | adjust_range (int shift_begin, int shift_end) const noexcept |
| BresenhamLine | without_start () const noexcept |
| BresenhamLine | without_end () const noexcept |
| BresenhamLine | without_endpoints () const noexcept |
| BresenhamLine | begin () const noexcept |
| Return the beginning iterator, which is a copy of the current object. | |
| BresenhamLine | end () const noexcept |
| Return the past-the-end iterator. | |
Encapsulates a Bresenham line drawing algorithm.
embed:rst:leading-asterisk .. versionadded:: 1.17
|
inlineexplicitnoexcept |
|
inlinenoexcept |
Return a new version of this BresenhamLine with an adjusted range. `shift_begin` and `shift_end` change the beginning and ending of the line when iterators over. Example::
Remove the endpoints of a bresenham line. auto line = tcod::BresenhamLine(from, to).adjust_range(1, -1);
|
inlinenoexcept |
Return the world position of the Bresenham at the index relative to the current index.
BresenhamLine is not restricted by any bounds so you can freely give a index past the end or before zero.
The internal state must always seek to the position being indexed, this will affect performance depending on if successive indexes are close together or far apart.
|
inlinenoexcept |
Remove the final endpoint of a line.
Example::
for (auto&& [x, y] : tcod::BresenhamLine(from, to).without_end()) {
All positions excluding to. }
|
inlinenoexcept |
Remove both endpoints of a line.
Example::
for (auto&& [x, y] : tcod::BresenhamLine(from, to).without_endpoints()) {
All positions between and excluding from and to. }
|
inlinenoexcept |
Remove the staring endpoint of a line.
Example::
for (auto&& [x, y] : tcod::BresenhamLine(from, to).without_start()) {
All positions excluding from. }