Purpose: An encapsulation of a z-buffer (used for hidden line/surface removal).
A ZBuffer
object contains 501x501 pixels, with the lower left
corner at -250,-250 and the upper left corner at 250,250.
Details
Attributes:
public static final int HEIGHT = 501; public static final int WIDTH = 501;
The Default Constructor:
/** * Default Constructor */ public ZBuffer()
The clear() Method:
/** * Clear this ZBuffer */ public void clear()
The getPixel() Method:
/** * Get the z-value of the pixel at (x,y) * * @param x The horizontal coordinate * @param y The vertical coordinate * @return The z-value or POSITIVE_INFINITY if (x,y) is not valid */ public double getPixel(int x, int y)
The setPixel() Method:
/** * Set the z-value of the pixel at (x,y) * * @param x The horizontal coordinate * @param y The vertical coordinate * @param z The z-value */ public void setPixel(int x, int y, double z)
Copyright 2007