Gamedev Framework (gf)  0.8.0
A C++14 framework for 2D games
Public Member Functions | List of all members
gf::Bresenham Class Reference

State for the Bresenham's line algorithm. More...

#include <gf/Geometry.h>

Public Member Functions

 Bresenham (Vector2i p0, Vector2i p1)
 Constructor. More...
 
bool step (Vector2i &res)
 Generate a new point on the line. More...
 

Detailed Description

State for the Bresenham's line algorithm.

See also
gf::generateLine()
Bresenham's line algorithm - Wikipedia

Constructor & Destructor Documentation

◆ Bresenham()

gf::Bresenham::Bresenham ( Vector2i  p0,
Vector2i  p1 
)

Constructor.

Parameters
p0The first point of the line
p1The last point of the line

Member Function Documentation

◆ step()

bool gf::Bresenham::step ( Vector2i res)

Generate a new point on the line.

Parameters
resThe resulting point if one was generated
Returns
True if the algorithm is finished