Example Implementation

First we define a few useful objects

public class Vertex2D {
    public float x, y;              // coordinate of vertex
    public int argb;                // color of vertex

    public Vertex2D() {
    }
	
    public Vertex2D(float xval, float yval, int cval) {
        x = xval;
        y = yval;
        argb = cval;
    }
}

A Drawable interface
import Raster;

public abstract interface Drawable {
    public abstract void Draw(Raster r);
}
The edge equations use integer coefficients for speed. This implementation uses 12 fractional bits. (Not my first version)
Lecture 6   Slide 11   6.837 Fall '00