Skip to content

Instantly share code, notes, and snippets.

@0xKD
0xKD / gist:4433678
Created January 2, 2013 10:36
DDA in C++
#include <iostream>
#define ROUND(a) ((int)(a + 0.5))
using namespace std;
int drawDDA(int x1,int y1,int x2,int y2)
{
float x = x1, y = y1;
int len = (x2-x1)>(y2-y1)?(x2-x1):(y2-y1);
float dx = (x2-x1)/(float)len;