Пример #1
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;
        }
Пример #2
0
        // Token: 0x060001B0 RID: 432 RVA: 0x00007CC4 File Offset: 0x00005EC4
        public DistanceSegment3Rectangle3(Segment3 segment, Rectangle3 rectangle)
        {
            this = default(DistanceSegment3Rectangle3);
            Line3 line = new Line3(segment.Origin, segment.Direction);
            DistanceLine3Rectangle3 distanceLine3Rectangle = new DistanceLine3Rectangle3(line, rectangle);

            if (distanceLine3Rectangle.LineParameter < -segment.Extent)
            {
                DistanceVector3Rectangle3 distanceVector3Rectangle = new DistanceVector3Rectangle3(segment.NegativeEnd, rectangle);
                this.SquaredDistance         = distanceVector3Rectangle.SquaredDistance;
                this.ClosestPointOnSegment   = segment.NegativeEnd;
                this.ClosestPointOnRectangle = distanceVector3Rectangle.ClosestPointOnRectangle;
                this.SegmentParameter        = -segment.Extent;
                this.RectCoord0 = distanceVector3Rectangle.RectCoord0;
                this.RectCoord1 = distanceVector3Rectangle.RectCoord1;
                return;
            }
            if (distanceLine3Rectangle.LineParameter <= segment.Extent)
            {
                this.SquaredDistance         = distanceLine3Rectangle.SquaredDistance;
                this.ClosestPointOnSegment   = distanceLine3Rectangle.ClosestPointOnLine;
                this.ClosestPointOnRectangle = distanceLine3Rectangle.ClosestPointOnRectangle;
                this.SegmentParameter        = distanceLine3Rectangle.LineParameter;
                this.RectCoord0 = distanceLine3Rectangle.RectCoord0;
                this.RectCoord1 = distanceLine3Rectangle.RectCoord1;
                return;
            }
            DistanceVector3Rectangle3 distanceVector3Rectangle2 = new DistanceVector3Rectangle3(segment.PositiveEnd, rectangle);

            this.SquaredDistance         = distanceVector3Rectangle2.SquaredDistance;
            this.ClosestPointOnSegment   = segment.PositiveEnd;
            this.ClosestPointOnRectangle = distanceVector3Rectangle2.ClosestPointOnRectangle;
            this.SegmentParameter        = segment.Extent;
            this.RectCoord0 = distanceVector3Rectangle2.RectCoord0;
            this.RectCoord1 = distanceVector3Rectangle2.RectCoord1;
        }
Пример #3
0
        // Token: 0x06000097 RID: 151 RVA: 0x00003A90 File Offset: 0x00001C90
        public static Segment3 ShortestSegmentTo(this Line3 line3, Rectangle3 rectangle3)
        {
            DistanceLine3Rectangle3 distanceLine3Rectangle = new DistanceLine3Rectangle3(line3, rectangle3);

            return(new Segment3(distanceLine3Rectangle.ClosestPointOnLine, distanceLine3Rectangle.ClosestPointOnRectangle));
        }
Пример #4
0
        // Token: 0x06000096 RID: 150 RVA: 0x00003A70 File Offset: 0x00001C70
        public static Vector3 ClosestPointTo(this Line3 line3, Rectangle3 rectangle3)
        {
            DistanceLine3Rectangle3 distanceLine3Rectangle = new DistanceLine3Rectangle3(line3, rectangle3);

            return(distanceLine3Rectangle.ClosestPointOnLine);
        }
Пример #5
0
        // Token: 0x06000095 RID: 149 RVA: 0x00003A50 File Offset: 0x00001C50
        public static double DistanceTo(this Line3 line3, Rectangle3 rectangle3)
        {
            DistanceLine3Rectangle3 distanceLine3Rectangle = new DistanceLine3Rectangle3(line3, rectangle3);

            return(distanceLine3Rectangle.Distance);
        }