Smooth Triangle Object
import Raster;
import Drawable;
import Vertex2D;
import FlatTri;
public class SmoothTri extends FlatTri implements Drawable {
boolean isFlat;
double scale;
public SmoothTri(Vertex2D v0, Vertex2D v1, Vertex2D v2) {
v = new Vertex2D[3];
v[0] = v0;
v[1] = v1;
v[2] = v2;
/*
check if all vertices are the same color
*/
isFlat = (v0.argb == v1.argb) && (v0.argb == v2.argb);
if (isFlat) {
color = v0.argb;
} else {
color = 0;
}
/*
Scale is always non zero and positive. This zero
value indicates that it has not been computed yet
*/
scale = -1;
}
|