Struct Ray
Represents a ray with an origin and a direction in 3D space.
[DataContract]
public struct Ray : IEquatable<Ray>
- Implements
- Inherited Members
Constructors
Ray(Vector3, Vector3)
Create a Ray.
public Ray(Vector3 position, Vector3 direction)
Parameters
Fields
Direction
The direction of this Ray.
[DataMember]
public Vector3 Direction
Field Value
Position
The origin of this Ray.
[DataMember]
public Vector3 Position
Field Value
Methods
Deconstruct(out Vector3, out Vector3)
Deconstruction method for Ray.
public void Deconstruct(out Vector3 position, out Vector3 direction)
Parameters
position
Vector3Receives the start position of the ray.
direction
Vector3Receives the direction of the ray.
Equals(Ray)
public bool Equals(Ray other)
Parameters
Returns
Equals(object)
public override bool Equals(object obj)
Parameters
Returns
GetHashCode()
Get a hash code for this Ray.
public override int GetHashCode()
Returns
Intersects(BoundingBox)
Check if this Ray intersects the specified BoundingBox.
public float? Intersects(BoundingBox box)
Parameters
box
BoundingBoxThe BoundingBox to test for intersection.
Returns
- float?
The distance along the ray of the intersection or
if this Ray does not intersect the BoundingBox.null
Intersects(ref BoundingBox, out float?)
Check if this Ray intersects the specified BoundingBox.
public void Intersects(ref BoundingBox box, out float? result)
Parameters
box
BoundingBoxThe BoundingBox to test for intersection.
result
float?The distance along the ray of the intersection or
if this Ray does not intersect the BoundingBox.null
Intersects(BoundingSphere)
Check if this Ray intersects the specified BoundingSphere.
public float? Intersects(BoundingSphere sphere)
Parameters
sphere
BoundingSphereThe BoundingBox to test for intersection.
Returns
- float?
The distance along the ray of the intersection or
if this Ray does not intersect the BoundingSphere.null
Intersects(ref BoundingSphere, out float?)
Check if this Ray intersects the specified BoundingSphere.
public void Intersects(ref BoundingSphere sphere, out float? result)
Parameters
sphere
BoundingSphereThe BoundingBox to test for intersection.
result
float?The distance along the ray of the intersection or
if this Ray does not intersect the BoundingSphere.null
Intersects(Plane)
public float? Intersects(Plane plane)
Parameters
Returns
- float?
The distance along the ray of the intersection or
if this Ray does not intersect the Plane.null
Intersects(ref Plane, out float?)
public void Intersects(ref Plane plane, out float? result)
Parameters
plane
PlaneThe Plane to test for intersection.
result
float?The distance along the ray of the intersection or
if this Ray does not intersect the Plane.null
ToString()
public override string ToString()
Returns
Operators
operator ==(Ray, Ray)
Check if two rays are equal.
public static bool operator ==(Ray a, Ray b)
Parameters
Returns
- bool
if the two rays are equals,true
if they are not.false
operator !=(Ray, Ray)
Check if two rays are not equal.
public static bool operator !=(Ray a, Ray b)
Parameters
Returns
- bool
if the two rays are not equal,true
if they are.false