Control Surface main
MIDI Control Surface library for Arduino
Loading...
Searching...
No Matches
BresenhamLine Class Reference

#include <Display/Helpers/Bresenham.hpp>

Detailed Description

Line rasterization algorithm for drawing lines to the display.

Definition at line 18 of file Bresenham.hpp.

Collaboration diagram for BresenhamLine:

Classes

struct  Pixel

Public Types

using pint = int16_t

Public Member Functions

 BresenhamLine (Pixel start, int cos, int sin)
 BresenhamLine (Pixel start, float angle)
pint getCurrentLength () const
Pixel next ()

Static Public Member Functions

static int cos (float angle)
static int sin (float angle)

Private Attributes

Pixel px
int dx
int dy
int adx
int ady
int xinc
int yinc
bool steep
int error
pint length = 0

Static Private Attributes

static const int errorScalingFactor = std::numeric_limits<int>::max() / 2

Member Typedef Documentation

◆ pint

using pint = int16_t

Definition at line 20 of file Bresenham.hpp.

Constructor & Destructor Documentation

◆ BresenhamLine() [1/2]

BresenhamLine ( Pixel start,
int cos,
int sin )
inline

Definition at line 33 of file Bresenham.hpp.

◆ BresenhamLine() [2/2]

BresenhamLine ( Pixel start,
float angle )
inline

Definition at line 47 of file Bresenham.hpp.

Member Function Documentation

◆ getCurrentLength()

pint getCurrentLength ( ) const
inline

Definition at line 54 of file Bresenham.hpp.

◆ next()

Pixel next ( )
inline

Definition at line 56 of file Bresenham.hpp.

◆ cos()

int cos ( float angle)
inlinestatic

Definition at line 77 of file Bresenham.hpp.

◆ sin()

int sin ( float angle)
inlinestatic

Definition at line 82 of file Bresenham.hpp.

Member Data Documentation

◆ errorScalingFactor

const int errorScalingFactor = std::numeric_limits<int>::max() / 2
staticprivate

Definition at line 88 of file Bresenham.hpp.

◆ px

Pixel px
private

Definition at line 89 of file Bresenham.hpp.

◆ dx

int dx
private

Definition at line 90 of file Bresenham.hpp.

◆ dy

int dy
private

Definition at line 90 of file Bresenham.hpp.

◆ adx

int adx
private

Definition at line 91 of file Bresenham.hpp.

◆ ady

int ady
private

Definition at line 91 of file Bresenham.hpp.

◆ xinc

int xinc
private

Definition at line 92 of file Bresenham.hpp.

◆ yinc

int yinc
private

Definition at line 92 of file Bresenham.hpp.

◆ steep

bool steep
private

Definition at line 93 of file Bresenham.hpp.

◆ error

int error
private

Definition at line 94 of file Bresenham.hpp.

◆ length

pint length = 0
private

Definition at line 95 of file Bresenham.hpp.


The documentation for this class was generated from the following file: