Exemple #1
0
        // Token: 0x0600008C RID: 140 RVA: 0x0000387C File Offset: 0x00001A7C
        public static double DistanceTo(this Line3 line3, AxisAlignedBox3 axisAlignedBox3)
        {
            Box3 box = new Box3(axisAlignedBox3.Center, UnitVector3.UnitX, UnitVector3.UnitY, UnitVector3.UnitZ, axisAlignedBox3.ExtentX, axisAlignedBox3.ExtentY, axisAlignedBox3.ExtentZ);
            DistanceLine3Box3 distanceLine3Box = new DistanceLine3Box3(line3, box);

            return(distanceLine3Box.Distance);
        }
Exemple #2
0
        // Token: 0x0600008E RID: 142 RVA: 0x0000391C File Offset: 0x00001B1C
        public static Segment3 ShortestSegmentTo(this Line3 line3, AxisAlignedBox3 axisAlignedBox3)
        {
            Box3 box = new Box3(axisAlignedBox3.Center, UnitVector3.UnitX, UnitVector3.UnitY, UnitVector3.UnitZ, axisAlignedBox3.ExtentX, axisAlignedBox3.ExtentY, axisAlignedBox3.ExtentZ);
            DistanceLine3Box3 distanceLine3Box = new DistanceLine3Box3(line3, box);

            return(new Segment3(distanceLine3Box.ClosestPointOnLine, distanceLine3Box.ClosestPointOnBox));
        }
Exemple #3
0
        // Token: 0x060001A8 RID: 424 RVA: 0x00007B9C File Offset: 0x00005D9C
        public DistanceSegment3Box3(Segment3 segment, Box3 box)
        {
            this = default(DistanceSegment3Box3);
            Line3             line             = new Line3(segment.Origin, segment.Direction);
            DistanceLine3Box3 distanceLine3Box = new DistanceLine3Box3(line, box);

            if (distanceLine3Box.LineParameter < -segment.Extent)
            {
                DistanceVector3Box3 distanceVector3Box = new DistanceVector3Box3(segment.NegativeEnd, box);
                this.SquaredDistance       = distanceVector3Box.SquaredDistance;
                this.ClosestPointOnSegment = distanceVector3Box.ClosestPointOnVector;
                this.ClosestPointOnBox     = distanceVector3Box.ClosestPointOnBox;
                return;
            }
            if (distanceLine3Box.LineParameter <= segment.Extent)
            {
                this.SquaredDistance       = distanceLine3Box.SquaredDistance;
                this.ClosestPointOnSegment = distanceLine3Box.ClosestPointOnLine;
                this.ClosestPointOnBox     = distanceLine3Box.ClosestPointOnBox;
                return;
            }
            DistanceVector3Box3 distanceVector3Box2 = new DistanceVector3Box3(segment.PositiveEnd, box);

            this.SquaredDistance       = distanceVector3Box2.SquaredDistance;
            this.ClosestPointOnSegment = distanceVector3Box2.ClosestPointOnVector;
            this.ClosestPointOnBox     = distanceVector3Box2.ClosestPointOnBox;
        }
Exemple #4
0
        // Token: 0x0600000E RID: 14 RVA: 0x000022F8 File Offset: 0x000004F8
        public static Vector3 ClosestPointTo(this AxisAlignedBox3 axisAlignedBox3, Line3 line3)
        {
            Box3 box = new Box3(axisAlignedBox3.Center, UnitVector3.UnitX, UnitVector3.UnitY, UnitVector3.UnitZ, axisAlignedBox3.ExtentX, axisAlignedBox3.ExtentY, axisAlignedBox3.ExtentZ);
            DistanceLine3Box3 distanceLine3Box = new DistanceLine3Box3(line3, box);

            return(distanceLine3Box.ClosestPointOnBox);
        }
Exemple #5
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;
        }
Exemple #6
0
        // Token: 0x0600008B RID: 139 RVA: 0x00003850 File Offset: 0x00001A50
        public static Segment3 ShortestSegmentTo(this Line3 line3, Box3 box3)
        {
            DistanceLine3Box3 distanceLine3Box = new DistanceLine3Box3(line3, box3);

            return(new Segment3(distanceLine3Box.ClosestPointOnLine, distanceLine3Box.ClosestPointOnBox));
        }
Exemple #7
0
        // Token: 0x0600008A RID: 138 RVA: 0x00003830 File Offset: 0x00001A30
        public static Vector3 ClosestPointTo(this Line3 line3, Box3 box3)
        {
            DistanceLine3Box3 distanceLine3Box = new DistanceLine3Box3(line3, box3);

            return(distanceLine3Box.ClosestPointOnLine);
        }
Exemple #8
0
        // Token: 0x06000089 RID: 137 RVA: 0x00003810 File Offset: 0x00001A10
        public static double DistanceTo(this Line3 line3, Box3 box3)
        {
            DistanceLine3Box3 distanceLine3Box = new DistanceLine3Box3(line3, box3);

            return(distanceLine3Box.Distance);
        }
Exemple #9
0
        // Token: 0x060000B1 RID: 177 RVA: 0x00003E34 File Offset: 0x00002034
        private void CalcSquared(ref Line3 line, ref Box3 box)
        {
            Vector3 vector = line.Origin - box.Center;

            double[] array = new double[]
            {
                vector.Dot(box.Axis0),
                vector.Dot(box.Axis1),
                vector.Dot(box.Axis2)
            };
            double[] array2 = new double[]
            {
                line.Direction.Dot(box.Axis0),
                line.Direction.Dot(box.Axis1),
                line.Direction.Dot(box.Axis2)
            };
            bool[] array3 = new bool[3];
            for (int i = 0; i < 3; i++)
            {
                if (array2[i] < 0.0)
                {
                    array[i]  = -array[i];
                    array2[i] = -array2[i];
                    array3[i] = true;
                }
                else
                {
                    array3[i] = false;
                }
            }
            double squaredDistance = 0.0;

            this.LineParameter = 0.0;
            if (array2[0] > 0.0)
            {
                if (array2[1] > 0.0)
                {
                    if (array2[2] > 0.0)
                    {
                        this.CaseNoZeros(ref box, ref array, ref array2, ref squaredDistance);
                    }
                    else
                    {
                        this.Case0(ref box, 0, 1, 2, ref array, ref array2, ref squaredDistance);
                    }
                }
                else if (array2[2] > 0.0)
                {
                    this.Case0(ref box, 0, 2, 1, ref array, ref array2, ref squaredDistance);
                }
                else
                {
                    this.Case00(ref box, 0, 1, 2, ref array, ref array2, ref squaredDistance);
                }
            }
            else if (array2[1] > 0.0)
            {
                if (array2[2] > 0.0)
                {
                    this.Case0(ref box, 1, 2, 0, ref array, ref array2, ref squaredDistance);
                }
                else
                {
                    this.Case00(ref box, 1, 0, 2, ref array, ref array2, ref squaredDistance);
                }
            }
            else if (array2[2] > 0.0)
            {
                this.Case00(ref box, 2, 0, 1, ref array, ref array2, ref squaredDistance);
            }
            else
            {
                DistanceLine3Box3.Case000(ref box, ref array, ref squaredDistance);
            }
            for (int i = 0; i < 3; i++)
            {
                if (array3[i])
                {
                    array[i] = -array[i];
                }
            }
            this.ClosestPointOnLine = line.Origin + this.LineParameter * line.Direction;
            this.ClosestPointOnBox  = box.Center + array[0] * box.Axis0 + array[1] * box.Axis1 + array[2] * box.Axis2;
            this.SquaredDistance    = squaredDistance;
        }