Class LatWall

java.lang.Object
  extended by LatWall
All Implemented Interfaces:
Surface

public class LatWall
extends java.lang.Object
implements Surface

Represents an wall running east-west (following a latitude on the earth's surface).


Constructor Summary
LatWall(double y, double x0, double x1, Texture txt)
           
 
Method Summary
 void draw(java.awt.Graphics g, double dx, double dy, double sx, double sy)
          Draws an overhead view of this surface.
 Bounds getBounds()
          Returns a bounding box describing the range of x- and y-coordinates occupied by the surface.
 double getDistanceFrom(Ray ray)
          Returns the ``distance'' at which the surface is located along the given ray, or Double.POSITIVE_INFINITY if in fact the ray doesn't intersect the surface at all.
 Ray getNormal(double px, double py)
          Returns the ray normal to the surface at the given coordinates.
 TextureColumn getTextureColumn(double x, double y)
          Returns the column of texture that appears on this surface at the given point.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LatWall

public LatWall(double y,
               double x0,
               double x1,
               Texture txt)
Method Detail

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getDistanceFrom

public double getDistanceFrom(Ray ray)
Description copied from interface: Surface
Returns the ``distance'' at which the surface is located along the given ray, or Double.POSITIVE_INFINITY if in fact the ray doesn't intersect the surface at all. The ray will start from some point (x,y) and have some direction (dx,dy). If the returned value d is finite, it should be a positive value for which (x + d * dx, y + d * dy) lies on this surface.

Specified by:
getDistanceFrom in interface Surface
Parameters:
ray - the ray to look along in determining the distance.
Returns:
a positive number if the ray intersects with this surface, or Double.POSITIVE_INFINITY if it does not.

getNormal

public Ray getNormal(double px,
                     double py)
Description copied from interface: Surface
Returns the ray normal to the surface at the given coordinates. The parameter coordinates are assumed to represent a point on the surface. The returned ray should be based on the given coordinates, and its direction should be perpendicular to the tangent of the surface at this point. The returned direction can be either of the possible perpendicular unit directions (which are negations of each other).

Specified by:
getNormal in interface Surface
Parameters:
px - the x-coordinate of the point in question.
py - the y-coordinate of the point in question.
Returns:
the ray normal to the surface at the requested point.

getTextureColumn

public TextureColumn getTextureColumn(double x,
                                      double y)
Description copied from interface: Surface
Returns the column of texture that appears on this surface at the given point. At the given coordinates is a vertical strip of this vertical surface, and the returned TextureColumn contains information about how to draw that vertical strip. The given coordinates are assumed to lie on this surface.

Specified by:
getTextureColumn in interface Surface
Parameters:
x - the x-coordinate of the point on the surface.
y - the y-coordinate of the point on the surface.
Returns:
a TextureColumn containing information about how to draw the vertical strip of the surface at this location.

getBounds

public Bounds getBounds()
Description copied from interface: Surface
Returns a bounding box describing the range of x- and y-coordinates occupied by the surface.

Specified by:
getBounds in interface Surface
Returns:
the bounding box

draw

public void draw(java.awt.Graphics g,
                 double dx,
                 double dy,
                 double sx,
                 double sy)
Description copied from interface: Surface
Draws an overhead view of this surface. This will involve mapping the surface's actual coordinates to the drawing space's coordinates. The mapping is described by the sx and sy scaling factors and the dx and dy offsets. For example, an x-coordinate of x will map to the pixel at dx + sx * x.

Specified by:
draw in interface Surface
Parameters:
g - the Graphics object with which to draw.
dx - the x-coordinate offset for drawing space.
dy - the y-coordinate offset for drawing space.
sx - the x-coordinate scaling factor for mapping from world space to drawing space.
sy - the y-coordinate scaling factor from mapping from world space to drawing space.