Microsoft.Xna.Framework
Class Ray

java.lang.Object
  extended by System.ValueType
      extended by Microsoft.Xna.Framework.Ray
All Implemented Interfaces:
IEquatable<Ray>

public final class Ray
extends ValueType
implements IEquatable<Ray>

Defines a ray.

Author:
Halofreak1990

Field Summary
 Vector3 Direction
          Unit vector specifying the direction the Ray is pointing.
 Vector3 Position
          Specifies the starting point of the Ray.
 
Constructor Summary
Ray()
          Creates a new instance of Ray.
Ray(Vector3 position, Vector3 direction)
          Creates a new instance of Ray.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Determines whether two instances of Ray are equal.
 boolean Equals(Ray other)
          Determines whether the specified Ray is equal to the current Ray.
 int hashCode()
          Gets the hash code for this instance.
 java.lang.Float Intersects(BoundingBox box)
          Checks whether the Ray intersects a specified BoundingBox.
 void Intersects(BoundingBox box, java.lang.Float result)
          Checks whether the current Ray intersects a BoundingBox.
 java.lang.Float Intersects(BoundingSphere sphere)
          Checks whether the Ray intersects a specified BoundingSphere.
 void Intersects(BoundingSphere sphere, java.lang.Float result)
          Checks whether the current Ray intersects a BoundingSphere.
 java.lang.Float Intersects(Plane plane)
          Determines whether this Ray intersects a specified Plane.
 void Intersects(Plane plane, java.lang.Float result)
          Determines whether this Ray intersects a specified Plane.
 java.lang.String toString()
          Returns a String that represents the current Ray.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

Position

public Vector3 Position
Specifies the starting point of the Ray.


Direction

public Vector3 Direction
Unit vector specifying the direction the Ray is pointing.

Constructor Detail

Ray

public Ray(Vector3 position,
           Vector3 direction)
Creates a new instance of Ray.

Parameters:
position - The starting point of the Ray.
direction - Unit vector describing the direction of the Ray.

Ray

public Ray()
Creates a new instance of Ray.

Method Detail

equals

public boolean equals(java.lang.Object obj)
Determines whether two instances of Ray are equal.

Overrides:
equals in class java.lang.Object
Parameters:
obj - The Object to compare with the current Ray.
Returns:
true if the specified System.Object is equal to the current Ray; false otherwise.

Equals

public boolean Equals(Ray other)
Determines whether the specified Ray is equal to the current Ray.

Specified by:
Equals in interface IEquatable<Ray>
Parameters:
other - The Ray to compare with the current Ray.
Returns:
true if the specified Ray is equal to the current Ray; false otherwise.

hashCode

public int hashCode()
Gets the hash code for this instance.

Overrides:
hashCode in class java.lang.Object
Returns:
A hash code for the current Ray.

Intersects

public java.lang.Float Intersects(BoundingBox box)
Checks whether the Ray intersects a specified BoundingBox.

Parameters:
box - The BoundingBox to check for intersection with the Ray.
Returns:
Distance at which the ray intersects the BoundingBox or null if there is no intersection.

Intersects

public java.lang.Float Intersects(BoundingSphere sphere)
Checks whether the Ray intersects a specified BoundingSphere.

Parameters:
sphere - The BoundingSphere to check for intersection with the Ray.
Returns:
Distance at which the ray intersects the BoundingSphere or null if there is no intersection.

Intersects

public java.lang.Float Intersects(Plane plane)
Determines whether this Ray intersects a specified Plane.

Parameters:
plane - The Plane with which to calculate this Ray's intersection.
Returns:
The distance at which this Ray intersects the specified Plane, or null if there is no intersection.

Intersects

public void Intersects(BoundingBox box,
                       java.lang.Float result)
Checks whether the current Ray intersects a BoundingBox.

Parameters:
box - The BoundingBox to check for intersection with.
result - [OutAttribute] Distance at which the ray intersects the BoundingBox or null if there is no intersection.

Intersects

public void Intersects(BoundingSphere sphere,
                       java.lang.Float result)
Checks whether the current Ray intersects a BoundingSphere.

Parameters:
sphere - The BoundingSphere to check for intersection with.
result - [OutAttribute] Distance at which the ray intersects the BoundingSphere or null if there is no intersection.

Intersects

public void Intersects(Plane plane,
                       java.lang.Float result)
Determines whether this Ray intersects a specified Plane.

Parameters:
plane - The Plane with which to calculate this Ray's intersection.
result - [OutAttribute] The distance at which this Ray intersects the specified Plane, or null if there is no intersection.

toString

public java.lang.String toString()
Returns a String that represents the current Ray.

Overrides:
toString in class java.lang.Object
Returns:
String representation of the current Ray.