Struct Ray
- Namespace
- Stride.Core.Mathematics
- Assembly
- Stride.Core.Mathematics.dll
Represents a three dimensional line based on a point in space and a direction.
[DataContract]
public struct Ray : IEquatable<Ray>, IFormattable
- Implements
Constructors
Ray(Vector3, Vector3)
Initializes a new instance of the Ray struct.
public Ray(Vector3 position, Vector3 direction)
Parameters
position
Vector3The position in three dimensional space of the origin of the ray.
direction
Vector3The normalized direction of the ray.
Fields
Direction
The normalized direction in which the ray points.
public Vector3 Direction
Field Value
Position
The position in three dimensional space where the ray starts.
public Vector3 Position
Field Value
Methods
Equals(Ray)
Determines whether the specified Vector4 is equal to this instance.
public bool Equals(Ray value)
Parameters
Returns
Equals(object)
Determines whether the specified object is equal to this instance.
public override bool Equals(object value)
Parameters
Returns
GetHashCode()
Returns a hash code for this instance.
public override int GetHashCode()
Returns
- int
A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
Intersects(ref readonly BoundingBox)
Determines if there is an intersection between the current object and a BoundingBox.
public bool Intersects(ref readonly BoundingBox box)
Parameters
box
BoundingBoxThe box to test.
Returns
- bool
Whether the two objects intersected.
Intersects(ref readonly BoundingBox, out Vector3)
Determines if there is an intersection between the current object and a BoundingBox.
public bool Intersects(ref readonly BoundingBox box, out Vector3 point)
Parameters
box
BoundingBoxThe box to test.
point
Vector3When the method completes, contains the point of intersection, or Zero if there was no intersection.
Returns
- bool
Whether the two objects intersected.
Intersects(ref readonly BoundingBox, out float)
Determines if there is an intersection between the current object and a BoundingBox.
public bool Intersects(ref readonly BoundingBox box, out float distance)
Parameters
box
BoundingBoxThe box to test.
distance
floatWhen the method completes, contains the distance of the intersection, or 0 if there was no intersection.
Returns
- bool
Whether the two objects intersected.
Intersects(ref readonly BoundingSphere)
Determines if there is an intersection between the current object and a BoundingSphere.
public bool Intersects(ref readonly BoundingSphere sphere)
Parameters
sphere
BoundingSphereThe sphere to test.
Returns
- bool
Whether the two objects intersected.
Intersects(ref readonly BoundingSphere, out Vector3)
Determines if there is an intersection between the current object and a BoundingSphere.
public bool Intersects(ref readonly BoundingSphere sphere, out Vector3 point)
Parameters
sphere
BoundingSphereThe sphere to test.
point
Vector3When the method completes, contains the point of intersection, or Zero if there was no intersection.
Returns
- bool
Whether the two objects intersected.
Intersects(ref readonly BoundingSphere, out float)
Determines if there is an intersection between the current object and a BoundingSphere.
public bool Intersects(ref readonly BoundingSphere sphere, out float distance)
Parameters
sphere
BoundingSphereThe sphere to test.
distance
floatWhen the method completes, contains the distance of the intersection, or 0 if there was no intersection.
Returns
- bool
Whether the two objects intersected.
Intersects(ref readonly Plane)
Determines if there is an intersection between the current object and a Plane.
public bool Intersects(ref readonly Plane plane)
Parameters
plane
PlaneThe plane to test
Returns
- bool
Whether the two objects intersected.
Intersects(ref readonly Plane, out Vector3)
Determines if there is an intersection between the current object and a Plane.
public bool Intersects(ref readonly Plane plane, out Vector3 point)
Parameters
plane
PlaneThe plane to test.
point
Vector3When the method completes, contains the point of intersection, or Zero if there was no intersection.
Returns
- bool
Whether the two objects intersected.
Intersects(ref readonly Plane, out float)
Determines if there is an intersection between the current object and a Plane.
public bool Intersects(ref readonly Plane plane, out float distance)
Parameters
plane
PlaneThe plane to test.
distance
floatWhen the method completes, contains the distance of the intersection, or 0 if there was no intersection.
Returns
- bool
Whether the two objects intersected.
Intersects(ref readonly Ray)
Determines if there is an intersection between the current object and a Ray.
public bool Intersects(ref readonly Ray ray)
Parameters
ray
RayThe ray to test.
Returns
- bool
Whether the two objects intersected.
Intersects(ref readonly Ray, out Vector3)
Determines if there is an intersection between the current object and a Ray.
public bool Intersects(ref readonly Ray ray, out Vector3 point)
Parameters
ray
RayThe ray to test.
point
Vector3When the method completes, contains the point of intersection, or Zero if there was no intersection.
Returns
- bool
Whether the two objects intersected.
Intersects(ref readonly Vector3)
Determines if there is an intersection between the current object and a point.
public bool Intersects(ref readonly Vector3 point)
Parameters
point
Vector3The point to test.
Returns
- bool
Whether the two objects intersected.
Intersects(ref readonly Vector3, ref readonly Vector3, ref readonly Vector3)
Determines if there is an intersection between the current object and a triangle.
public bool Intersects(ref readonly Vector3 vertex1, ref readonly Vector3 vertex2, ref readonly Vector3 vertex3)
Parameters
vertex1
Vector3The first vertex of the triangle to test.
vertex2
Vector3The second vertex of the triangle to test.
vertex3
Vector3The third vertex of the triangle to test.
Returns
- bool
Whether the two objects intersected.
Intersects(ref readonly Vector3, ref readonly Vector3, ref readonly Vector3, out Vector3)
Determines if there is an intersection between the current object and a triangle.
public bool Intersects(ref readonly Vector3 vertex1, ref readonly Vector3 vertex2, ref readonly Vector3 vertex3, out Vector3 point)
Parameters
vertex1
Vector3The first vertex of the triangle to test.
vertex2
Vector3The second vertex of the triangle to test.
vertex3
Vector3The third vertex of the triangle to test.
point
Vector3When the method completes, contains the point of intersection, or Zero if there was no intersection.
Returns
- bool
Whether the two objects intersected.
Intersects(ref readonly Vector3, ref readonly Vector3, ref readonly Vector3, out float)
Determines if there is an intersection between the current object and a triangle.
public bool Intersects(ref readonly Vector3 vertex1, ref readonly Vector3 vertex2, ref readonly Vector3 vertex3, out float distance)
Parameters
vertex1
Vector3The first vertex of the triangle to test.
vertex2
Vector3The second vertex of the triangle to test.
vertex3
Vector3The third vertex of the triangle to test.
distance
floatWhen the method completes, contains the distance of the intersection, or 0 if there was no intersection.
Returns
- bool
Whether the two objects intersected.
ToString()
Returns a string that represents this instance.
public override string ToString()
Returns
ToString(IFormatProvider)
Returns a string that represents this instance.
public string ToString(IFormatProvider formatProvider)
Parameters
formatProvider
IFormatProviderThe format provider.
Returns
ToString(string)
Returns a string that represents this instance.
public string ToString(string format)
Parameters
format
stringThe format.
Returns
ToString(string, IFormatProvider)
Returns a string that represents this instance.
public string ToString(string format, IFormatProvider formatProvider)
Parameters
format
stringThe format.
formatProvider
IFormatProviderThe format provider.
Returns
Operators
operator ==(Ray, Ray)
Tests for equality between two objects.
public static bool operator ==(Ray left, Ray right)
Parameters
Returns
- bool
true
ifleft
has the same value asright
; otherwise,false
.
operator !=(Ray, Ray)
Tests for inequality between two objects.
public static bool operator !=(Ray left, Ray right)
Parameters
Returns
- bool
true
ifleft
has a different value thanright
; otherwise,false
.