// Token: 0x060004C8 RID: 1224 RVA: 0x00018A40 File Offset: 0x00016C40
        public static Ray3 Transform(this AffineTransform3 transformer, Ray3 ray)
        {
            Vector3     origin    = transformer.Transform(ray.Origin);
            UnitVector3 direction = transformer.Transform(ray.Direction);

            return(new Ray3(origin, direction));
        }
Esempio n. 2
0
        // Token: 0x06000145 RID: 325 RVA: 0x00006AC4 File Offset: 0x00004CC4
        public DistanceRay3Rectangle3(Ray3 ray, Rectangle3 rectangle)
        {
            this = default(DistanceRay3Rectangle3);
            Line3 line = new Line3(ray.Origin, ray.Direction);
            DistanceLine3Rectangle3 distanceLine3Rectangle = new DistanceLine3Rectangle3(line, rectangle);

            if (distanceLine3Rectangle.LineParameter >= 0.0)
            {
                this.SquaredDistance         = distanceLine3Rectangle.SquaredDistance;
                this.ClosestPointOnRay       = distanceLine3Rectangle.ClosestPointOnLine;
                this.ClosestPointOnRectangle = distanceLine3Rectangle.ClosestPointOnRectangle;
                this.RayParameter            = distanceLine3Rectangle.LineParameter;
                this.RectCoord0 = distanceLine3Rectangle.RectCoord0;
                this.RectCoord1 = distanceLine3Rectangle.RectCoord1;
                return;
            }
            DistanceVector3Rectangle3 distanceVector3Rectangle = new DistanceVector3Rectangle3(ray.Origin, rectangle);

            this.SquaredDistance         = distanceVector3Rectangle.SquaredDistance;
            this.ClosestPointOnRay       = ray.Origin;
            this.ClosestPointOnRectangle = distanceVector3Rectangle.ClosestPointOnRectangle;
            this.RayParameter            = 0.0;
            this.RectCoord0 = distanceVector3Rectangle.RectCoord0;
            this.RectCoord1 = distanceVector3Rectangle.RectCoord1;
        }
Esempio n. 3
0
        // Token: 0x0600011E RID: 286 RVA: 0x000061E0 File Offset: 0x000043E0
        public static double DistanceTo(this Ray3 ray3, AxisAlignedBox3 axisAlignedBox3)
        {
            Box3             box             = new Box3(axisAlignedBox3.Center, UnitVector3.UnitX, UnitVector3.UnitY, UnitVector3.UnitZ, axisAlignedBox3.ExtentX, axisAlignedBox3.ExtentY, axisAlignedBox3.ExtentZ);
            DistanceRay3Box3 distanceRay3Box = new DistanceRay3Box3(ray3, box);

            return(distanceRay3Box.Distance);
        }
Esempio n. 4
0
        // Token: 0x06000120 RID: 288 RVA: 0x00006280 File Offset: 0x00004480
        public static Segment3 ShortestSegmentTo(this Ray3 ray3, AxisAlignedBox3 axisAlignedBox3)
        {
            Box3             box             = new Box3(axisAlignedBox3.Center, UnitVector3.UnitX, UnitVector3.UnitY, UnitVector3.UnitZ, axisAlignedBox3.ExtentX, axisAlignedBox3.ExtentY, axisAlignedBox3.ExtentZ);
            DistanceRay3Box3 distanceRay3Box = new DistanceRay3Box3(ray3, box);

            return(new Segment3(distanceRay3Box.ClosestPointOnRay, distanceRay3Box.ClosestPointOnBox));
        }
Esempio n. 5
0
        // Token: 0x06000011 RID: 17 RVA: 0x000023EC File Offset: 0x000005EC
        public static Vector3 ClosestPointTo(this AxisAlignedBox3 axisAlignedBox3, Ray3 ray3)
        {
            Box3             box             = new Box3(axisAlignedBox3.Center, UnitVector3.UnitX, UnitVector3.UnitY, UnitVector3.UnitZ, axisAlignedBox3.ExtentX, axisAlignedBox3.ExtentY, axisAlignedBox3.ExtentZ);
            DistanceRay3Box3 distanceRay3Box = new DistanceRay3Box3(ray3, box);

            return(distanceRay3Box.ClosestPointOnBox);
        }
Esempio n. 6
0
        // Token: 0x0600015F RID: 351 RVA: 0x000070DC File Offset: 0x000052DC
        public DistanceRay3Triangle3(Ray3 ray, Triangle3 triangle)
        {
            this = default(DistanceRay3Triangle3);
            Line3 line = new Line3(ray.Origin, ray.Direction);
            DistanceLine3Triangle3 distanceLine3Triangle = new DistanceLine3Triangle3(line, triangle);

            if (distanceLine3Triangle.LineParameter >= 0.0)
            {
                this.SquaredDistance        = distanceLine3Triangle.SquaredDistance;
                this.ClosestPointOnRay      = distanceLine3Triangle.ClosestPointOnLine;
                this.ClosestPointOnTriangle = distanceLine3Triangle.ClosestPointOnTriangle;
                this.RayParameter           = distanceLine3Triangle.LineParameter;
                this.TriangleBary0          = distanceLine3Triangle.TriangleBary0;
                this.TriangleBary1          = distanceLine3Triangle.TriangleBary1;
                this.TriangleBary2          = distanceLine3Triangle.TriangleBary2;
                return;
            }
            DistanceVector3Triangle3 distanceVector3Triangle = new DistanceVector3Triangle3(ray.Origin, triangle);

            this.SquaredDistance        = distanceVector3Triangle.SquaredDistance;
            this.ClosestPointOnRay      = ray.Origin;
            this.ClosestPointOnTriangle = distanceVector3Triangle.ClosestPointOnTriangle;
            this.RayParameter           = 0.0;
            this.TriangleBary0          = distanceVector3Triangle.TriangleBary0;
            this.TriangleBary1          = distanceVector3Triangle.TriangleBary1;
            this.TriangleBary2          = distanceVector3Triangle.TriangleBary2;
        }
Esempio n. 7
0
        // Token: 0x060003C6 RID: 966 RVA: 0x00010DF8 File Offset: 0x0000EFF8
        public static Vector3?IntersectionWith(this Ray3 ray, Triangle3 triangle)
        {
            IntersectionRay3Triangle3 intersectionRay3Triangle = new IntersectionRay3Triangle3(ray, triangle);

            if (intersectionRay3Triangle.Find() && intersectionRay3Triangle.IntersectionType != Intersection.Type.IT_EMPTY)
            {
                return(new Vector3?(ray.Origin + intersectionRay3Triangle.RayParameter * ray.Direction));
            }
            return(null);
        }
Esempio n. 8
0
        // Token: 0x06000023 RID: 35 RVA: 0x0000265C File Offset: 0x0000085C
        public static Vector3 ClosestPointTo(this Arc3 arc3, Ray3 ray3)
        {
            Line3             line             = new Line3(ray3.Origin, ray3.Direction);
            DistanceLine3Arc3 distanceLine3Arc = new DistanceLine3Arc3(line, arc3);

            if (distanceLine3Arc.LineParameter < 0.0)
            {
                return(arc3.ClosestPointTo(ray3.Origin));
            }
            return(distanceLine3Arc.ClosestPointOnArc);
        }
Esempio n. 9
0
        // Token: 0x0600003E RID: 62 RVA: 0x00002B90 File Offset: 0x00000D90
        public static Segment3 ShortestSegmentTo(this Circle3 circle3, Ray3 ray3)
        {
            Line3 line = new Line3(ray3.Origin, ray3.Direction);
            DistanceLine3Circle3 distanceLine3Circle = new DistanceLine3Circle3(line, circle3);

            if (distanceLine3Circle.LineParameter < 0.0)
            {
                return(circle3.ShortestSegmentTo(ray3.Origin));
            }
            return(new Segment3(distanceLine3Circle.ClosestPointOnCircle, distanceLine3Circle.ClosestPointOnLine));
        }
Esempio n. 10
0
        // Token: 0x0600003D RID: 61 RVA: 0x00002B3C File Offset: 0x00000D3C
        public static Vector3 ClosestPointTo(this Circle3 circle3, Ray3 ray3)
        {
            Line3 line = new Line3(ray3.Origin, ray3.Direction);
            DistanceLine3Circle3 distanceLine3Circle = new DistanceLine3Circle3(line, circle3);

            if (distanceLine3Circle.LineParameter < 0.0)
            {
                return(circle3.ClosestPointTo(ray3.Origin));
            }
            return(distanceLine3Circle.ClosestPointOnCircle);
        }
Esempio n. 11
0
        // Token: 0x06000024 RID: 36 RVA: 0x000026B0 File Offset: 0x000008B0
        public static Segment3 ShortestSegmentTo(this Arc3 arc3, Ray3 ray3)
        {
            Line3             line             = new Line3(ray3.Origin, ray3.Direction);
            DistanceLine3Arc3 distanceLine3Arc = new DistanceLine3Arc3(line, arc3);

            if (distanceLine3Arc.LineParameter < 0.0)
            {
                return(arc3.ShortestSegmentTo(ray3.Origin));
            }
            return(new Segment3(distanceLine3Arc.ClosestPointOnArc, distanceLine3Arc.ClosestPointOnLine));
        }
Esempio n. 12
0
        // Token: 0x06000115 RID: 277 RVA: 0x00005FE4 File Offset: 0x000041E4
        public static double DistanceTo(this Ray3 ray3, Vector3 vector3)
        {
            Vector3 vector4 = vector3 - ray3.Origin;
            double  num     = ray3.Direction.Dot(vector4);

            if (num > 0.0)
            {
                return((ray3.Origin + num * ray3.Direction - vector3).Length);
            }
            return((ray3.Origin - vector3).Length);
        }
Esempio n. 13
0
        // Token: 0x06000117 RID: 279 RVA: 0x000060B8 File Offset: 0x000042B8
        public static Segment3 ShortestSegmentTo(this Ray3 ray3, Vector3 vector3)
        {
            Vector3 vector4 = vector3 - ray3.Origin;
            double  num     = ray3.Direction.Dot(vector4);

            if (num > 0.0)
            {
                return(new Segment3(ray3.Origin + num * ray3.Direction, vector3));
            }
            return(new Segment3(ray3.Origin, vector3));
        }
Esempio n. 14
0
        // Token: 0x06000130 RID: 304 RVA: 0x0000658C File Offset: 0x0000478C
        public static double DistanceTo(this Ray3 ray3, Arc3 arc3)
        {
            Line3             line             = new Line3(ray3.Origin, ray3.Direction);
            DistanceLine3Arc3 distanceLine3Arc = new DistanceLine3Arc3(line, arc3);

            if (distanceLine3Arc.LineParameter < 0.0)
            {
                return(ray3.Origin.DistanceTo(arc3));
            }
            return(distanceLine3Arc.Distance);
        }
Esempio n. 15
0
        // Token: 0x0600012D RID: 301 RVA: 0x0000648C File Offset: 0x0000468C
        public static double DistanceTo(this Ray3 ray3, Circle3 circle3)
        {
            Line3 line = new Line3(ray3.Origin, ray3.Direction);
            DistanceLine3Circle3 distanceLine3Circle = new DistanceLine3Circle3(line, circle3);

            if (distanceLine3Circle.LineParameter < 0.0)
            {
                return(ray3.Origin.DistanceTo(circle3));
            }
            return(distanceLine3Circle.Distance);
        }
Esempio n. 16
0
        // Token: 0x06000116 RID: 278 RVA: 0x0000605C File Offset: 0x0000425C
        public static Vector3 ClosestPointTo(this Ray3 ray3, Vector3 vector3)
        {
            Vector3 vector4 = vector3 - ray3.Origin;
            double  num     = ray3.Direction.Dot(vector4);

            if (num > 0.0)
            {
                return(ray3.Origin + num * ray3.Direction);
            }
            return(ray3.Origin);
        }
Esempio n. 17
0
        // Token: 0x0600020E RID: 526 RVA: 0x00009350 File Offset: 0x00007550
        public static Segment3 ShortestSegmentTo(this Vector3 vector3, Ray3 ray3)
        {
            Vector3 vector4 = vector3 - ray3.Origin;
            double  num     = ray3.Direction.Dot(vector4);

            if (num > 0.0)
            {
                Vector3 positiveEnd = ray3.Origin + num * ray3.Direction;
                return(new Segment3(vector3, positiveEnd));
            }
            return(new Segment3(vector3, ray3.Origin));
        }
Esempio n. 18
0
        // Token: 0x06000052 RID: 82 RVA: 0x00002FBC File Offset: 0x000011BC
        public DistancePlane3Ray3(Plane3 plane, Ray3 ray)
        {
            this = default(DistancePlane3Ray3);
            DistanceVector3Plane3 distanceVector3Plane = new DistanceVector3Plane3(ray.Origin, plane);
            double signedDistance = distanceVector3Plane.SignedDistance;
            double num            = ray.Direction.Dot(plane.Normal);

            if ((signedDistance > 0.0 && num > -1E-08) || (signedDistance < 0.0 && num < 1E-08))
            {
                this.SignedDistance = signedDistance;
                return;
            }
            this.SignedDistance = 0.0;
        }
Esempio n. 19
0
        // Token: 0x060003BC RID: 956 RVA: 0x00010B24 File Offset: 0x0000ED24
        public static Segment3?IntersectionWith(this Ray3 ray, Cylinder3 cylinder)
        {
            IntersectionRay3Cylinder3 intersectionRay3Cylinder = new IntersectionRay3Cylinder3(ray, cylinder);

            intersectionRay3Cylinder.Find();
            if (intersectionRay3Cylinder.IntersectionType == Intersection.Type.IT_SEGMENT)
            {
                return(new Segment3?(new Segment3(intersectionRay3Cylinder.Point0, intersectionRay3Cylinder.Point1)));
            }
            if (intersectionRay3Cylinder.IntersectionType == Intersection.Type.IT_POINT)
            {
                return(new Segment3?(new Segment3(intersectionRay3Cylinder.Point0, intersectionRay3Cylinder.Point0)));
            }
            return(null);
        }
Esempio n. 20
0
        // Token: 0x060000CD RID: 205 RVA: 0x000050D0 File Offset: 0x000032D0
        public DistanceLine3Ray3(Line3 line, Ray3 ray)
        {
            this = default(DistanceLine3Ray3);
            Vector3 vector        = line.Origin - ray.Origin;
            double  num           = -line.Direction.Dot(ray.Direction);
            double  num2          = vector.Dot(line.Direction);
            double  squaredLength = vector.SquaredLength;
            double  num3          = 1.0;
            double  num4          = num;
            double  num5          = Math.Abs(num3 - num4 * num4);
            double  num7;
            double  num9;
            double  value;

            if (num5 >= 1E-08)
            {
                double num6 = -vector.Dot(ray.Direction);
                num7 = num * num2 - num6;
                if (num7 >= 0.0)
                {
                    double num8 = 1.0 / num5;
                    num9  = (num * num6 - num2) * num8;
                    num7 *= num8;
                    double num10 = num9;
                    value = num10 * (num10 + num * num7 + 2.0 * num2) + num7 * (num * num9 + num7 + 2.0 * num6) + squaredLength;
                }
                else
                {
                    num9  = -num2;
                    num7  = 0.0;
                    value = num2 * num9 + squaredLength;
                }
            }
            else
            {
                num9  = -num2;
                num7  = 0.0;
                value = num2 * num9 + squaredLength;
            }
            this.ClosestPointOnLine = line.Origin + num9 * line.Direction;
            this.ClosestPointOnRay  = ray.Origin + num7 * ray.Direction;
            this.LineParameter      = num9;
            this.RayParameter       = num7;
            this.SquaredDistance    = Math.Abs(value);
        }
Esempio n. 21
0
        // Token: 0x06000135 RID: 309 RVA: 0x000066CC File Offset: 0x000048CC
        public DistanceRay3Box3(Ray3 ray, Box3 box)
        {
            this = default(DistanceRay3Box3);
            Line3             line             = new Line3(ray.Origin, ray.Direction);
            DistanceLine3Box3 distanceLine3Box = new DistanceLine3Box3(line, box);

            if (distanceLine3Box.LineParameter >= 0.0)
            {
                this.SquaredDistance   = distanceLine3Box.SquaredDistance;
                this.ClosestPointOnRay = distanceLine3Box.ClosestPointOnLine;
                this.ClosestPointOnBox = distanceLine3Box.ClosestPointOnBox;
                return;
            }
            DistanceVector3Box3 distanceVector3Box = new DistanceVector3Box3(ray.Origin, box);

            this.SquaredDistance   = distanceVector3Box.SquaredDistance;
            this.ClosestPointOnRay = distanceVector3Box.ClosestPointOnVector;
            this.ClosestPointOnBox = distanceVector3Box.ClosestPointOnBox;
        }
Esempio n. 22
0
        // Token: 0x060003CA RID: 970 RVA: 0x00010F64 File Offset: 0x0000F164
        internal static bool Test(Ray3 ray, AxisAlignedBox3 axisAlignedBox)
        {
            Vector3 vector = ray.Origin - axisAlignedBox.Center;

            if (Math.Abs(vector.X) > axisAlignedBox.Extents.X && vector.X * ray.Direction.X >= 0.0)
            {
                return(false);
            }
            if (Math.Abs(vector.Y) > axisAlignedBox.Extents.Y && vector.Y * ray.Direction.Y >= 0.0)
            {
                return(false);
            }
            if (Math.Abs(vector.Z) > axisAlignedBox.Extents.Z && vector.Z * ray.Direction.Z >= 0.0)
            {
                return(false);
            }
            Vector3 vector2 = ray.Direction.Cross(vector);
            Vector3 vector3 = new Vector3(Math.Abs(ray.Direction.X), Math.Abs(ray.Direction.Y), Math.Abs(ray.Direction.Z));

            return(Math.Abs(vector2.X) <= axisAlignedBox.Extents.Y * vector3.Z + axisAlignedBox.Extents.Z * vector3.Y + 1E-08 && Math.Abs(vector2.Y) <= axisAlignedBox.Extents.Z * vector3.X + axisAlignedBox.Extents.X * vector3.Z + 1E-08 && Math.Abs(vector2.Z) <= axisAlignedBox.Extents.X * vector3.Y + axisAlignedBox.Extents.Y * vector3.X + 1E-08);
        }
Esempio n. 23
0
        // Token: 0x060003BF RID: 959 RVA: 0x00010C24 File Offset: 0x0000EE24
        public static ICollection <Vector3> IntersectionPointsWith(this Ray3 ray, Torus3 torus)
        {
            List <Vector3>         list = new List <Vector3>();
            IntersectionRay3Torus3 intersectionRay3Torus = new IntersectionRay3Torus3(ray, torus);

            if (intersectionRay3Torus.Find())
            {
                Vector3[] array = new Vector3[]
                {
                    intersectionRay3Torus.Point0,
                    intersectionRay3Torus.Point1,
                    intersectionRay3Torus.Point2,
                    intersectionRay3Torus.Point3
                };
                for (int i = 0; i < intersectionRay3Torus.Quantity; i++)
                {
                    list.Add(array[i]);
                }
            }
            return(list);
        }
Esempio n. 24
0
        // Token: 0x060003BD RID: 957 RVA: 0x00010B94 File Offset: 0x0000ED94
        public static ICollection <Vector3> IntersectionPointsWith(this Ray3 ray, Cylinder3 cylinder)
        {
            Segment3?segment = ray.IntersectionWith(cylinder);

            if (segment == null)
            {
                return(new List <Vector3>());
            }
            Segment3 value = segment.Value;

            if (value.Extent < 1E-08)
            {
                return(new List <Vector3>
                {
                    value.Origin
                });
            }
            return(new List <Vector3>
            {
                value.NegativeEnd,
                value.PositiveEnd
            });
        }
Esempio n. 25
0
        // Token: 0x060003C9 RID: 969 RVA: 0x00010EC0 File Offset: 0x0000F0C0
        public static ICollection <Vector3> IntersectionPointsWith(this Ray3 ray, AxisAlignedBox3 axisAlignedBox)
        {
            Box3     box     = new Box3(axisAlignedBox.Center, UnitVector3.UnitX, UnitVector3.UnitY, UnitVector3.UnitZ, axisAlignedBox.ExtentX, axisAlignedBox.ExtentY, axisAlignedBox.ExtentZ);
            Segment3?segment = ray.IntersectionWith(box);

            if (segment == null)
            {
                return(new List <Vector3>());
            }
            Segment3 value = segment.Value;

            if (value.Extent < 1E-08)
            {
                return(new List <Vector3>
                {
                    value.Origin
                });
            }
            return(new List <Vector3>
            {
                value.NegativeEnd,
                value.PositiveEnd
            });
        }
Esempio n. 26
0
 // Token: 0x0600020D RID: 525 RVA: 0x00009345 File Offset: 0x00007545
 public static double DistanceTo(this Vector3 vector3, Ray3 ray3)
 {
     return(ray3.DistanceTo(vector3));
 }
Esempio n. 27
0
 // Token: 0x06000022 RID: 34 RVA: 0x00002651 File Offset: 0x00000851
 public static double DistanceTo(this Arc3 arc3, Ray3 ray3)
 {
     return(ray3.DistanceTo(arc3));
 }
Esempio n. 28
0
        // Token: 0x06000094 RID: 148 RVA: 0x00003A24 File Offset: 0x00001C24
        public static Segment3 ShortestSegmentTo(this Line3 line3, Ray3 ray3)
        {
            DistanceLine3Ray3 distanceLine3Ray = new DistanceLine3Ray3(line3, ray3);

            return(new Segment3(distanceLine3Ray.ClosestPointOnLine, distanceLine3Ray.ClosestPointOnRay));
        }
Esempio n. 29
0
        // Token: 0x06000093 RID: 147 RVA: 0x00003A04 File Offset: 0x00001C04
        public static Vector3 ClosestPointTo(this Line3 line3, Ray3 ray3)
        {
            DistanceLine3Ray3 distanceLine3Ray = new DistanceLine3Ray3(line3, ray3);

            return(distanceLine3Ray.ClosestPointOnLine);
        }
Esempio n. 30
0
        // Token: 0x06000092 RID: 146 RVA: 0x000039E4 File Offset: 0x00001BE4
        public static double DistanceTo(this Line3 line3, Ray3 ray3)
        {
            DistanceLine3Ray3 distanceLine3Ray = new DistanceLine3Ray3(line3, ray3);

            return(distanceLine3Ray.Distance);
        }