Class FlatRenderer.EdgeEntry

java.lang.Object
  |
  +--FlatRenderer.EdgeEntry
Direct Known Subclasses:
GouraudRenderer.EdgeEntryEx, PhongRenderer.EdgeEntryEx
Enclosing class:
FlatRenderer

protected static class FlatRenderer.EdgeEntry
extends Object

The entry for an edge in an EdgeBucket.

See Also:
FlatRenderer.EdgeBucket

Field Summary
protected  int denominator
          The denominator of 1/m (dy).
protected  float dxPerScan
          The x increment, set to numerator/denominator.
protected  int increment
          The numerator increment
protected  int numerator
          The numerator of 1/m (dx).
protected  Mesh.Polygon owner
          The polygon which this edge belongs.
protected  float x
          The x intersection value;
protected  int xmin
          The minimum x value of the edge.
protected  int ymax
          The maximum y value of the edge.
protected  int ymin
          The minimum y value of the edge.
 
Constructor Summary
FlatRenderer.EdgeEntry(Mesh.Polygon poly, int xmin, int ymin, int xmax, int ymax)
          Constructs the entry for an edge.
 
Method Summary
protected  int getDenominator()
          Returns the denominator of 1/m (dy).
protected  int getNumerator()
          Returns the numerator of 1/m (dx).
 Mesh.Polygon getOwner()
          Returns the owning polygon of this edge.
 int getX()
          Gets the X intersection value.
 int getXMin()
          Returns the minimum x value of the edge.
 int getYMax()
          Returns the maximum y value of the edge.
 int getYMin()
          Returns the minimum y value of the edge.
 boolean isHorizontal()
          Returns true if the edge is horizontal (dy == 0)
 boolean isVertical()
          Returns true if the edge is vertical (dx == 0)
 void nextX()
          Calculates the next x intersection value when y is incremented, based on the current x.
 String toString()
          Creates a human-readable String that displays the contents of this object, for debugging purposes.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

increment

protected int increment
The numerator increment

numerator

protected int numerator
The numerator of 1/m (dx).

denominator

protected int denominator
The denominator of 1/m (dy).

xmin

protected int xmin
The minimum x value of the edge.

ymin

protected int ymin
The minimum y value of the edge.

ymax

protected int ymax
The maximum y value of the edge.

owner

protected Mesh.Polygon owner
The polygon which this edge belongs.

x

protected float x
The x intersection value;

dxPerScan

protected float dxPerScan
The x increment, set to numerator/denominator.
Constructor Detail

FlatRenderer.EdgeEntry

public FlatRenderer.EdgeEntry(Mesh.Polygon poly,
                              int xmin,
                              int ymin,
                              int xmax,
                              int ymax)
Constructs the entry for an edge.
Parameters:
poly - the owner of this edge.
xmin - the x coordinate of the lower point in the edge.
ymin - the y coordinate of the lower point in the edge.
xmax - the x coordinate of the upper point in the edge.
ymax - the y coordinate of the upper point in the edge.
Method Detail

nextX

public void nextX()
Calculates the next x intersection value when y is incremented, based on the current x.
Returns:
the next x value;

toString

public String toString()
Creates a human-readable String that displays the contents of this object, for debugging purposes. It returns a string in the following format:
{ (ymin~ymax), xmin,x-intersect, numerator/denominator }
Overrides:
toString in class Object

isVertical

public boolean isVertical()
Returns true if the edge is vertical (dx == 0)

isHorizontal

public boolean isHorizontal()
Returns true if the edge is horizontal (dy == 0)

getX

public int getX()
Gets the X intersection value.

getXMin

public int getXMin()
Returns the minimum x value of the edge.

getYMax

public int getYMax()
Returns the maximum y value of the edge.

getYMin

public int getYMin()
Returns the minimum y value of the edge.

getNumerator

protected int getNumerator()
Returns the numerator of 1/m (dx).

getDenominator

protected int getDenominator()
Returns the denominator of 1/m (dy).

getOwner

public Mesh.Polygon getOwner()
Returns the owning polygon of this edge.