Struct RayStep
Represent a Ray segment.
Inherited Members
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 ray step final point. |
Properties
Direction
Gets the ray 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
Getsa the ray ending point.
Declaration
public readonly Vector3 Terminus { get; }
Property Value
Type | Description |
---|---|
Vector3 |
Methods
Contains(Vector3)
Indicates if the specified point belong 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 propertyes.
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 diretion of the selected ray step. |
GetPoint(float)
Gets a point in this ray using the distance.
Declaration
public Vector3 GetPoint(float distance)
Parameters
Type | Name | Description |
---|---|---|
float | distance | The distance to the origin. |
Returns
Type | Description |
---|---|
Vector3 | The final 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 distnace. |
Returns
Type | Description |
---|---|
RayStep | The selected ray step. |
UpdateRayStep(ref Vector3, ref Vector3)
Update current raystep with new origin and terminus points. Pass by ref to avoid unnecessary struct copy into function since values will be copied anyways locally.
Declaration
public void UpdateRayStep(ref Vector3 origin, ref Vector3 terminus)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | origin | beginning of raystep origin. |
Vector3 | terminus | end of raystep. |
Operators
implicit operator Ray(RayStep)
Declaration
public static implicit operator Ray(RayStep r)
Parameters
Type | Name | Description |
---|---|---|
RayStep | r |
Returns
Type | Description |
---|---|
Ray |