com.brackeen.javagamebook.math3D
Class ViewWindow

java.lang.Object
  extended bycom.brackeen.javagamebook.math3D.ViewWindow

public class ViewWindow
extends java.lang.Object

The ViewWindow class represents the geometry of a view window for 3D viewing.


Constructor Summary
ViewWindow(int left, int top, int width, int height, float angle)
          Creates a new ViewWindow with the specified bounds on the screen and horizontal view angle.
 
Method Summary
 float convertFromScreenXToViewX(float x)
          Converts an x coordinate on the screen to the corresponding x coordinate on this view window.
 float convertFromScreenYToViewY(float y)
          Converts an y coordinate on the screen to the corresponding y coordinate on this view window.
 float convertFromViewXToScreenX(float x)
          Converts an x coordinate on this view window to the corresponding x coordinate on the screen.
 float convertFromViewYToScreenY(float y)
          Converts a y coordinate on this view window to the corresponding y coordinate on the screen.
 float getAngle()
          Gets the horizontal view angle of this view window.
 float getDistance()
          Gets the distance from the camera to to this view window.
 int getHeight()
          Gets the height of this view window.
 int getLeftOffset()
          Gets the x offset of this view window on the screen.
 int getTopOffset()
          Gets the y offset of this view window on the screen.
 int getWidth()
          Gets the width of this view window.
 void project(Vector3D v)
          Projects the specified vector to the screen.
 void setAngle(float angle)
          Sets the horizontal view angle for this ViewWindow.
 void setBounds(int left, int top, int width, int height)
          Sets the bounds for this ViewWindow on the screen.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ViewWindow

public ViewWindow(int left,
                  int top,
                  int width,
                  int height,
                  float angle)
Creates a new ViewWindow with the specified bounds on the screen and horizontal view angle.

Method Detail

setBounds

public void setBounds(int left,
                      int top,
                      int width,
                      int height)
Sets the bounds for this ViewWindow on the screen.


setAngle

public void setAngle(float angle)
Sets the horizontal view angle for this ViewWindow.


getAngle

public float getAngle()
Gets the horizontal view angle of this view window.


getWidth

public int getWidth()
Gets the width of this view window.


getHeight

public int getHeight()
Gets the height of this view window.


getTopOffset

public int getTopOffset()
Gets the y offset of this view window on the screen.


getLeftOffset

public int getLeftOffset()
Gets the x offset of this view window on the screen.


getDistance

public float getDistance()
Gets the distance from the camera to to this view window.


convertFromViewXToScreenX

public float convertFromViewXToScreenX(float x)
Converts an x coordinate on this view window to the corresponding x coordinate on the screen.


convertFromViewYToScreenY

public float convertFromViewYToScreenY(float y)
Converts a y coordinate on this view window to the corresponding y coordinate on the screen.


convertFromScreenXToViewX

public float convertFromScreenXToViewX(float x)
Converts an x coordinate on the screen to the corresponding x coordinate on this view window.


convertFromScreenYToViewY

public float convertFromScreenYToViewY(float y)
Converts an y coordinate on the screen to the corresponding y coordinate on this view window.


project

public void project(Vector3D v)
Projects the specified vector to the screen.