Ray Struct
Namespace: Stride.Core.MathematicsAssembly: 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
Name | Description | |
---|---|---|
Constructors | ||
Ray(Vector3, Vector3) | Initializes a new instance of the Ray struct. |
|
Fields | ||
Direction | The normalized direction in which the ray points. |
|
Position | The position in three dimensional space where the ray starts. |
|
Methods | ||
Equals(Ray) | Determines whether the specified Vector4 is equal to this instance. |
|
Equals(Object) | Determines whether the specified System.Object is equal to this instance. |
|
GetHashCode() | Returns a hash code for this instance. |
|
Intersects(ref BoundingBox) | Determines if there is an intersection between the current object and a BoundingBox. |
|
Intersects(ref BoundingBox, out Vector3) | Determines if there is an intersection between the current object and a BoundingBox. |
|
Intersects(ref BoundingBox, out Single) | Determines if there is an intersection between the current object and a BoundingBox. |
|
Intersects(ref BoundingSphere) | Determines if there is an intersection between the current object and a BoundingSphere. |
|
Intersects(ref BoundingSphere, out Vector3) | Determines if there is an intersection between the current object and a BoundingSphere. |
|
Intersects(ref BoundingSphere, out Single) | Determines if there is an intersection between the current object and a BoundingSphere. |
|
Intersects(ref Plane) | Determines if there is an intersection between the current object and a Plane. |
|
Intersects(ref Plane, out Vector3) | Determines if there is an intersection between the current object and a Plane. |
|
Intersects(ref Plane, out Single) | Determines if there is an intersection between the current object and a Plane. |
|
Intersects(ref Ray) | Determines if there is an intersection between the current object and a Ray. |
|
Intersects(ref Ray, out Vector3) | Determines if there is an intersection between the current object and a Ray. |
|
Intersects(ref Vector3) | Determines if there is an intersection between the current object and a point. |
|
Intersects(ref Vector3, ref Vector3, ref Vector3) | Determines if there is an intersection between the current object and a triangle. |
|
Intersects(ref Vector3, ref Vector3, ref Vector3, out Vector3) | Determines if there is an intersection between the current object and a triangle. |
|
Intersects(ref Vector3, ref Vector3, ref Vector3, out Single) | Determines if there is an intersection between the current object and a triangle. |
|
ToString() | Returns a System.String that represents this instance. |
|
ToString(IFormatProvider) | Returns a System.String that represents this instance. |
|
ToString(String) | Returns a System.String that represents this instance. |
|
ToString(String, IFormatProvider) | Returns a System.String that represents this instance. |
|
Operators | ||
Equality(Ray, Ray) | Tests for equality between two objects. |
|
Inequality(Ray, Ray) | Tests for inequality between two objects. |
Constructors
Ray(Vector3, Vector3)
Initializes a new instance of the Ray struct.
public Ray(Vector3 position, Vector3 direction)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | position | The position in three dimensional space of the origin of the ray. |
Vector3 | direction | The normalized direction of the ray. |
Fields
Direction
The normalized direction in which the ray points.
public Vector3 Direction
Field Value
Type | Description |
---|---|
Vector3 |
Position
The position in three dimensional space where the ray starts.
public Vector3 Position
Field Value
Type | Description |
---|---|
Vector3 |
Methods
Equals(Ray)
Determines whether the specified Vector4 is equal to this instance.
public bool Equals(Ray value)
Parameters
Type | Name | Description |
---|---|---|
Ray | value | The Vector4 to compare with this instance. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Equals(Object)
Determines whether the specified System.Object is equal to this instance.
public override bool Equals(object value)
Parameters
Type | Name | Description |
---|---|---|
System.Object | value | The System.Object to compare with this instance. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Overrides
GetHashCode()
Returns a hash code for this instance.
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 | A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. |
Overrides
Intersects(ref BoundingBox)
Determines if there is an intersection between the current object and a BoundingBox.
public bool Intersects(ref BoundingBox box)
Parameters
Type | Name | Description |
---|---|---|
BoundingBox | box | The box to test. |
Returns
Type | Description |
---|---|
System.Boolean | Whether the two objects intersected. |
Intersects(ref BoundingBox, out Vector3)
Determines if there is an intersection between the current object and a BoundingBox.
public bool Intersects(ref BoundingBox box, out Vector3 point)
Parameters
Type | Name | Description |
---|---|---|
BoundingBox | box | The box to test. |
Vector3 | point | When the method completes, contains the point of intersection, or Zero if there was no intersection. |
Returns
Type | Description |
---|---|
System.Boolean | Whether the two objects intersected. |
Intersects(ref BoundingBox, out Single)
Determines if there is an intersection between the current object and a BoundingBox.
public bool Intersects(ref BoundingBox box, out float distance)
Parameters
Type | Name | Description |
---|---|---|
BoundingBox | box | The box to test. |
System.Single | distance | When the method completes, contains the distance of the intersection, or 0 if there was no intersection. |
Returns
Type | Description |
---|---|
System.Boolean | Whether the two objects intersected. |
Intersects(ref BoundingSphere)
Determines if there is an intersection between the current object and a BoundingSphere.
public bool Intersects(ref BoundingSphere sphere)
Parameters
Type | Name | Description |
---|---|---|
BoundingSphere | sphere | The sphere to test. |
Returns
Type | Description |
---|---|
System.Boolean | Whether the two objects intersected. |
Intersects(ref BoundingSphere, out Vector3)
Determines if there is an intersection between the current object and a BoundingSphere.
public bool Intersects(ref BoundingSphere sphere, out Vector3 point)
Parameters
Type | Name | Description |
---|---|---|
BoundingSphere | sphere | The sphere to test. |
Vector3 | point | When the method completes, contains the point of intersection, or Zero if there was no intersection. |
Returns
Type | Description |
---|---|
System.Boolean | Whether the two objects intersected. |
Intersects(ref BoundingSphere, out Single)
Determines if there is an intersection between the current object and a BoundingSphere.
public bool Intersects(ref BoundingSphere sphere, out float distance)
Parameters
Type | Name | Description |
---|---|---|
BoundingSphere | sphere | The sphere to test. |
System.Single | distance | When the method completes, contains the distance of the intersection, or 0 if there was no intersection. |
Returns
Type | Description |
---|---|
System.Boolean | Whether the two objects intersected. |
Intersects(ref Plane)
Determines if there is an intersection between the current object and a Plane.
public bool Intersects(ref Plane plane)
Parameters
Type | Name | Description |
---|---|---|
Plane | plane | The plane to test |
Returns
Type | Description |
---|---|
System.Boolean | Whether the two objects intersected. |
Intersects(ref Plane, out Vector3)
Determines if there is an intersection between the current object and a Plane.
public bool Intersects(ref Plane plane, out Vector3 point)
Parameters
Type | Name | Description |
---|---|---|
Plane | plane | The plane to test. |
Vector3 | point | When the method completes, contains the point of intersection, or Zero if there was no intersection. |
Returns
Type | Description |
---|---|
System.Boolean | Whether the two objects intersected. |
Intersects(ref Plane, out Single)
Determines if there is an intersection between the current object and a Plane.
public bool Intersects(ref Plane plane, out float distance)
Parameters
Type | Name | Description |
---|---|---|
Plane | plane | The plane to test. |
System.Single | distance | When the method completes, contains the distance of the intersection, or 0 if there was no intersection. |
Returns
Type | Description |
---|---|
System.Boolean | Whether the two objects intersected. |
Intersects(ref Ray)
Determines if there is an intersection between the current object and a Ray.
public bool Intersects(ref Ray ray)
Parameters
Type | Name | Description |
---|---|---|
Ray | ray | The ray to test. |
Returns
Type | Description |
---|---|
System.Boolean | Whether the two objects intersected. |
Intersects(ref Ray, out Vector3)
Determines if there is an intersection between the current object and a Ray.
public bool Intersects(ref Ray ray, out Vector3 point)
Parameters
Type | Name | Description |
---|---|---|
Ray | ray | The ray to test. |
Vector3 | point | When the method completes, contains the point of intersection, or Zero if there was no intersection. |
Returns
Type | Description |
---|---|
System.Boolean | Whether the two objects intersected. |
Intersects(ref Vector3)
Determines if there is an intersection between the current object and a point.
public bool Intersects(ref Vector3 point)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | point | The point to test. |
Returns
Type | Description |
---|---|
System.Boolean | Whether the two objects intersected. |
Intersects(ref Vector3, ref Vector3, ref Vector3)
Determines if there is an intersection between the current object and a triangle.
public bool Intersects(ref Vector3 vertex1, ref Vector3 vertex2, ref Vector3 vertex3)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | vertex1 | The first vertex of the triangle to test. |
Vector3 | vertex2 | The second vertex of the triangle to test. |
Vector3 | vertex3 | The third vertex of the triangle to test. |
Returns
Type | Description |
---|---|
System.Boolean | Whether the two objects intersected. |
Intersects(ref Vector3, ref Vector3, ref Vector3, out Vector3)
Determines if there is an intersection between the current object and a triangle.
public bool Intersects(ref Vector3 vertex1, ref Vector3 vertex2, ref Vector3 vertex3, out Vector3 point)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | vertex1 | The first vertex of the triangle to test. |
Vector3 | vertex2 | The second vertex of the triangle to test. |
Vector3 | vertex3 | The third vertex of the triangle to test. |
Vector3 | point | When the method completes, contains the point of intersection, or Zero if there was no intersection. |
Returns
Type | Description |
---|---|
System.Boolean | Whether the two objects intersected. |
Intersects(ref Vector3, ref Vector3, ref Vector3, out Single)
Determines if there is an intersection between the current object and a triangle.
public bool Intersects(ref Vector3 vertex1, ref Vector3 vertex2, ref Vector3 vertex3, out float distance)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | vertex1 | The first vertex of the triangle to test. |
Vector3 | vertex2 | The second vertex of the triangle to test. |
Vector3 | vertex3 | The third vertex of the triangle to test. |
System.Single | distance | When the method completes, contains the distance of the intersection, or 0 if there was no intersection. |
Returns
Type | Description |
---|---|
System.Boolean | Whether the two objects intersected. |
ToString()
Returns a System.String that represents this instance.
public override string ToString()
Returns
Type | Description |
---|---|
System.String | A System.String that represents this instance. |
Overrides
ToString(IFormatProvider)
Returns a System.String that represents this instance.
public string ToString(IFormatProvider formatProvider)
Parameters
Type | Name | Description |
---|---|---|
System.IFormatProvider | formatProvider | The format provider. |
Returns
Type | Description |
---|---|
System.String | A System.String that represents this instance. |
ToString(String)
Returns a System.String that represents this instance.
public string ToString(string format)
Parameters
Type | Name | Description |
---|---|---|
System.String | format | The format. |
Returns
Type | Description |
---|---|
System.String | A System.String that represents this instance. |
ToString(String, IFormatProvider)
Returns a System.String that represents this instance.
public string ToString(string format, IFormatProvider formatProvider)
Parameters
Type | Name | Description |
---|---|---|
System.String | format | The format. |
System.IFormatProvider | formatProvider | The format provider. |
Returns
Type | Description |
---|---|
System.String | A System.String that represents this instance. |
Operators
Equality(Ray, Ray)
Tests for equality between two objects.
public static bool operator ==(Ray left, Ray right)
Parameters
Type | Name | Description |
---|---|---|
Ray | left | The first value to compare. |
Ray | right | The second value to compare. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Inequality(Ray, Ray)
Tests for inequality between two objects.
public static bool operator !=(Ray left, Ray right)
Parameters
Type | Name | Description |
---|---|---|
Ray | left | The first value to compare. |
Ray | right | The second value to compare. |
Returns
Type | Description |
---|---|
System.Boolean |
|