2 public struct Ray3 : IEquatable<Ray3> {
16 public override string ToString() => $
"{Position.ToString()},{Direction.ToString()}";
54 if (vector.
X > vector.
Y
55 && vector.
X > vector.
Z) {
59 float num = Position.Z + vector.X *
Direction.Z;
64 num = Position.Y + vector.X *
Direction.Y;
65 return num < box.Min.Y || num > box.Max.Y ? null : vector.
X;
67 if (vector.
Y > vector.
X
68 && vector.
Y > vector.
Z) {
72 float num2 = Position.Z + vector.Y *
Direction.Z;
74 || num2 > box.
Max.
Z) {
77 num2 = Position.X + vector.Y *
Direction.X;
78 return num2 < box.Min.X || num2 > box.Max.X ? null : vector.
Y;
83 float num3 = Position.X + vector.Z *
Direction.X;
85 || num3 > box.
Max.
X) {
88 num3 = Position.Y + vector.Z *
Direction.Y;
89 return num3 < box.Min.Y || num3 > box.Max.Y ? null : vector.
Z;
95 float num2 = sphere.Radius * sphere.
Radius;
103 float num4 = num2 + num3 * num3 - num;
104 return !(num4 < 0f) ? num3 - MathF.Sqrt(num4) :
null;
static bool operator==(Ray3 a, Ray3 b)
static bool operator!=(Ray3 a, Ray3 b)
static Ray3 Transform(Ray3 r, Matrix m)
Ray3(Vector3 position, Vector3 direction)
float? Intersection(BoundingSphere sphere)
override int GetHashCode()
override bool Equals(object obj)
Vector3 Sample(float distance)
override string ToString()
static void Transform(ref Ray3 r, ref Matrix m, out Ray3 result)
float? Intersection(Plane plane)
float? Intersection(BoundingBox box)
static Vector3 TransformNormal(Vector3 v, Matrix m)
static Vector3 Transform(Vector3 v, Matrix m)
static float Dot(Vector3 v1, Vector3 v2)