ASCII-GFX  2.0
Classes | Functions
polygon.cpp File Reference
#include "polygon.h"
#include "scrollarea.h"

Classes

struct  Edge2D
 

Functions

void calculate_intersection (float y, Edge2D *e)
 
bool less (const Edge2D *e1, const Edge2D *e2)
 
void merge (int n, int m, Edge2D e[], Edge2D t[])
 
void merge_sort (int n, Edge2D e[], Edge2D t[])
 
void render_scanline (float x1, float x2, int y, int ch)
 
void process_scanline (int y, int n, Edge2D edge[], Edge2D temp[], int ch)
 
void render_polygon (int n, const Vec2 vertex[], int ch)
 render a polygon with n vertices More...
 
void render_triangle (const Vec2 &v1, const Vec2 &v2, const Vec2 &v3, int ch)
 render a triangle with 3 vertices More...
 

Function Documentation

◆ calculate_intersection()

void calculate_intersection ( float  y,
Edge2D e 
)

◆ less()

bool less ( const Edge2D e1,
const Edge2D e2 
)

◆ merge()

void merge ( int  n,
int  m,
Edge2D  e[],
Edge2D  t[] 
)

◆ merge_sort()

void merge_sort ( int  n,
Edge2D  e[],
Edge2D  t[] 
)

◆ process_scanline()

void process_scanline ( int  y,
int  n,
Edge2D  edge[],
Edge2D  temp[],
int  ch 
)

◆ render_polygon()

void render_polygon ( int  n,
const Vec2  vertex[],
int  ch = -1 
)

render a polygon with n vertices

  • the polygon can be self-intersecting
  • the polygon is transformed with the actual transformation matrix
  • the transformation matrix can be modified via:
    • translate, rotate & scale
    • push & pop

◆ render_scanline()

void render_scanline ( float  x1,
float  x2,
int  y,
int  ch 
)

◆ render_triangle()

void render_triangle ( const Vec2 v1,
const Vec2 v2,
const Vec2 v3,
int  ch 
)

render a triangle with 3 vertices