Struct RayStep
Represents a Ray segment.
Namespace: Evergine.Mathematics
Assembly: Evergine.Mathematics.dll
Syntax
public struct RayStep
Constructors
RayStep(Vector3, Vector3)
Initializes a new instance of the RayStep struct.
Declaration
public RayStep(Vector3 origin, Vector3 terminus)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | origin | The ray origin. |
Vector3 | terminus | The final point of the ray step. |
Properties
Direction
Gets the ray's direction.
Declaration
public readonly Vector3 Direction { get; }
Property Value
Type | Description |
---|---|
Vector3 |
Length
Gets the ray step length.
Declaration
public readonly float Length { get; }
Property Value
Type | Description |
---|---|
float |
Origin
Gets the ray origin.
Declaration
public readonly Vector3 Origin { get; }
Property Value
Type | Description |
---|---|
Vector3 |
Terminus
Gets the ray ending point.
Declaration
public readonly Vector3 Terminus { get; }
Property Value
Type | Description |
---|---|
Vector3 |
Methods
Contains(Vector3)
Indicates if the specified point belongs to this ray.
Declaration
public bool Contains(Vector3 point)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | point | The point. |
Returns
Type | Description |
---|---|
bool | True if this point is part of this ray. |
CopyRay(Ray, float)
Copy the specified ray properties.
Declaration
public void CopyRay(Ray ray, float rayLength)
Parameters
Type | Name | Description |
---|---|---|
Ray | ray | The ray. |
float | rayLength | The length. |
GetDirectionByDistance(RayStep[], float)
Returns a direction along an array of RaySteps by distance.
Declaration
public static Vector3 GetDirectionByDistance(RayStep[] steps, float distance)
Parameters
Type | Name | Description |
---|---|---|
RayStep[] | steps | The ray steps array. |
float | distance | The distance. |
Returns
Type | Description |
---|---|
Vector3 | The direction of the selected ray step. |
GetPoint(float)
Gets a point on this ray using the distance.
Declaration
public Vector3 GetPoint(float distance)
Parameters
Type | Name | Description |
---|---|---|
float | distance | The distance from the origin. |
Returns
Type | Description |
---|---|
Vector3 | The resulting point. |
GetPointByDistance(RayStep[], float)
Returns a point along an array of RaySteps by distance.
Declaration
public static Vector3 GetPointByDistance(RayStep[] steps, float distance)
Parameters
Type | Name | Description |
---|---|---|
RayStep[] | steps | The ray steps array. |
float | distance | The distance. |
Returns
Type | Description |
---|---|
Vector3 | The final point. |
GetStepByDistance(RayStep[], float, ref float)
Returns a RayStep along an array of RaySteps by distance.
Declaration
public static RayStep GetStepByDistance(RayStep[] steps, float distance, ref float remainingDistance)
Parameters
Type | Name | Description |
---|---|---|
RayStep[] | steps | The ray steps array. |
float | distance | The distance. |
float | remainingDistance | The remaining distance. |
Returns
Type | Description |
---|---|
RayStep | The selected ray step. |
UpdateRayStep(ref Vector3, ref Vector3)
Update the current RayStep with new origin and terminus points. Pass by ref to avoid unnecessary struct copies into the function since the values will be copied locally anyway.
Declaration
public void UpdateRayStep(ref Vector3 origin, ref Vector3 terminus)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | origin | Beginning of the RayStep origin. |
Vector3 | terminus | End of the RayStep. |
Operators
implicit operator Ray(RayStep)
Declaration
public static implicit operator Ray(RayStep r)
Parameters
Type | Name | Description |
---|---|---|
RayStep | r |
Returns
Type | Description |
---|---|
Ray |