Table of Contents

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 Vector3

The position in three dimensional space of the origin of the ray.

direction Vector3

The normalized direction of the ray.

Fields

Direction

The normalized direction in which the ray points.

public Vector3 Direction

Field Value

Vector3

Position

The position in three dimensional space where the ray starts.

public Vector3 Position

Field Value

Vector3

Methods

Equals(Ray)

Determines whether the specified Vector4 is equal to this instance.

public bool Equals(Ray value)

Parameters

value Ray

The Vector4 to compare with this instance.

Returns

bool

true if the specified Vector4 is equal to this instance; otherwise, false.

Equals(object)

Determines whether the specified object is equal to this instance.

public override bool Equals(object value)

Parameters

value object

The object to compare with this instance.

Returns

bool

true if the specified object is equal to this instance; otherwise, false.

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 BoundingBox

The 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 BoundingBox

The box to test.

point Vector3

When 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 BoundingBox

The box to test.

distance float

When 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 BoundingSphere

The 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 BoundingSphere

The sphere to test.

point Vector3

When 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 BoundingSphere

The sphere to test.

distance float

When 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 Plane

The 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 Plane

The plane to test.

point Vector3

When 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 Plane

The plane to test.

distance float

When 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 Ray

The 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 Ray

The ray to test.

point Vector3

When 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 Vector3

The 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 Vector3

The first vertex of the triangle to test.

vertex2 Vector3

The second vertex of the triangle to test.

vertex3 Vector3

The 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 Vector3

The first vertex of the triangle to test.

vertex2 Vector3

The second vertex of the triangle to test.

vertex3 Vector3

The third vertex of the triangle to test.

point Vector3

When 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 Vector3

The first vertex of the triangle to test.

vertex2 Vector3

The second vertex of the triangle to test.

vertex3 Vector3

The third vertex of the triangle to test.

distance float

When 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

string

A string that represents this instance.

ToString(IFormatProvider)

Returns a string that represents this instance.

public string ToString(IFormatProvider formatProvider)

Parameters

formatProvider IFormatProvider

The format provider.

Returns

string

A string that represents this instance.

ToString(string)

Returns a string that represents this instance.

public string ToString(string format)

Parameters

format string

The format.

Returns

string

A string that represents this instance.

ToString(string, IFormatProvider)

Returns a string that represents this instance.

public string ToString(string format, IFormatProvider formatProvider)

Parameters

format string

The format.

formatProvider IFormatProvider

The format provider.

Returns

string

A string that represents this instance.

Operators

operator ==(Ray, Ray)

Tests for equality between two objects.

public static bool operator ==(Ray left, Ray right)

Parameters

left Ray

The first value to compare.

right Ray

The second value to compare.

Returns

bool

true if left has the same value as right; otherwise, false.

operator !=(Ray, Ray)

Tests for inequality between two objects.

public static bool operator !=(Ray left, Ray right)

Parameters

left Ray

The first value to compare.

right Ray

The second value to compare.

Returns

bool

true if left has a different value than right; otherwise, false.