Struct RaySegment
- Namespace
- Stride.CommunityToolkit.Scripts
- Assembly
- Stride.CommunityToolkit.dll
Represents a three dimensional line based on a 2 points in space.
[DataContract]
public struct RaySegment : IEquatable<RaySegment>, IFormattable
- Implements
Constructors
RaySegment(Vector3, Vector3)
Initializes a new instance of the RaySegment struct.
public RaySegment(Vector3 start, Vector3 end)
Parameters
start
Vector3The position in three dimensional space where the ray starts.
end
Vector3The position in three dimensional space where the ray ends.
Properties
End
The position in three dimensional space where the ray ends.
public Vector3 End { readonly get; init; }
Property Value
Length
Length of RaySegment
public float Length { get; }
Property Value
Start
The position in three dimensional space where the ray starts.
public Vector3 Start { readonly get; init; }
Property Value
Methods
Equals(RaySegment)
Determines whether the specified Vector4 is equal to this instance.
public bool Equals(RaySegment value)
Parameters
value
RaySegmentThe Vector4 to compare with this instance.
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.
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 ==(RaySegment, RaySegment)
Tests for equality between two objects.
public static bool operator ==(RaySegment left, RaySegment right)
Parameters
left
RaySegmentThe first value to compare.
right
RaySegmentThe second value to compare.
Returns
- bool
true
ifleft
has the same value asright
; otherwise,false
.
explicit operator Ray(RaySegment)
Performs an explicit conversion from RaySegment to Ray.
public static explicit operator Ray(RaySegment raySegment)
Parameters
raySegment
RaySegmentThe RaySegment to convert
Returns
- Ray
The result of the conversion.
operator !=(RaySegment, RaySegment)
Tests for inequality between two objects.
public static bool operator !=(RaySegment left, RaySegment right)
Parameters
left
RaySegmentThe first value to compare.
right
RaySegmentThe second value to compare.
Returns
- bool
true
ifleft
has a different value thanright
; otherwise,false
.