Control Surface  1.1.1
MIDI Control Surface library for Arduino
Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Attributes | Static Private Attributes | List of all members
BresenhamLine Class Reference

Line rasterization algorithm for drawing lines to the display. More...

#include <Display/Helpers/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 (double angle)
 
static int sin (double 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

const static int errorScalingFactor = INT_MAX / 2
 

Detailed Description

Line rasterization algorithm for drawing lines to the display.

Definition at line 16 of file Bresenham.hpp.

Member Typedef Documentation

◆ pint

using pint = int16_t

Definition at line 18 of file Bresenham.hpp.

Constructor & Destructor Documentation

◆ BresenhamLine() [1/2]

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

Definition at line 34 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()

static int cos ( double  angle)
inlinestatic

Definition at line 77 of file Bresenham.hpp.

◆ sin()

static int sin ( double  angle)
inlinestatic

Definition at line 81 of file Bresenham.hpp.

Member Data Documentation

◆ errorScalingFactor

const static int errorScalingFactor = INT_MAX / 2
staticprivate

Definition at line 86 of file Bresenham.hpp.

◆ px

Pixel px
private

Definition at line 87 of file Bresenham.hpp.

◆ dx

int dx
private

Definition at line 88 of file Bresenham.hpp.

◆ dy

int dy
private

Definition at line 88 of file Bresenham.hpp.

◆ adx

int adx
private

Definition at line 89 of file Bresenham.hpp.

◆ ady

int ady
private

Definition at line 89 of file Bresenham.hpp.

◆ xinc

int xinc
private

Definition at line 90 of file Bresenham.hpp.

◆ yinc

int yinc
private

Definition at line 90 of file Bresenham.hpp.

◆ steep

bool steep
private

Definition at line 91 of file Bresenham.hpp.

◆ error

int error
private

Definition at line 92 of file Bresenham.hpp.

◆ length

pint length = 0
private

Definition at line 93 of file Bresenham.hpp.


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