Class Ray2D

java.lang.Object
  extended by Ray2D

public class Ray2D
extends java.lang.Object

This class contains methods to handle Ray2D objects.


Constructor Summary
Ray2D()
          Constructor to create a Ray2D.
Ray2D(Vector2 p, Vector2 d)
          Constructor to create a Ray2D.
 
Method Summary
 Vector2 getDirection()
          Returns the direction of the Ray2D.
 Vector2 getPoint()
          Returns the starting point of the Ray2D.
 Vector2 getPosition(float t)
          Returns a position along a Ray2D
 Vector2 getXForY(float y)
          Returns a position along a Ray2D knowing the y-value
 Vector2 getYForX(float x)
          Returns a position along a Ray2D knowing the x-value
 void setDirection(Vector2 d)
          Sets a new direction to the Ray2D.
 void setPoint(Vector2 p)
          Sets a new starting point to the Ray2D.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Ray2D

public Ray2D(Vector2 p,
             Vector2 d)
Constructor to create a Ray2D.

Parameters:
p - a Vector2 containing the startposition of the ray.
d - a Vector2 containing the direction of the ray.

Ray2D

public Ray2D()
Constructor to create a Ray2D.

Method Detail

setDirection

public void setDirection(Vector2 d)
Sets a new direction to the Ray2D.

Parameters:
d - a Vector2 containing the new direction.

setPoint

public void setPoint(Vector2 p)
Sets a new starting point to the Ray2D.

Parameters:
p - a Vector2 containing the new startpoint.

getDirection

public Vector2 getDirection()
Returns the direction of the Ray2D.

Returns:
a Vector2 containing the direction.

getPoint

public Vector2 getPoint()
Returns the starting point of the Ray2D.

Returns:
a Vector2 containing the point.

getPosition

public Vector2 getPosition(float t)
Returns a position along a Ray2D

Parameters:
t - the parameter
Returns:
a Vector2 containing the position.

getYForX

public Vector2 getYForX(float x)
Returns a position along a Ray2D knowing the x-value

Parameters:
x - the x-value of the position
Returns:
a Vector2 containing the position.

getXForY

public Vector2 getXForY(float y)
Returns a position along a Ray2D knowing the y-value

Parameters:
y - the y-value of the position
Returns:
a Vector2 containing the position.