Exemplo n.º 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;
        }
Exemplo n.º 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;
        }
Exemplo n.º 3
0
        // Token: 0x06000210 RID: 528 RVA: 0x000093D8 File Offset: 0x000075D8
        public static Segment3 ShortestSegmentTo(this Vector3 vector3, Rectangle3 rectangle3)
        {
            DistanceVector3Rectangle3 distanceVector3Rectangle = new DistanceVector3Rectangle3(vector3, rectangle3);

            return(new Segment3(distanceVector3Rectangle.ClosestPointOnVector, distanceVector3Rectangle.ClosestPointOnRectangle));
        }
Exemplo n.º 4
0
        // Token: 0x0600020F RID: 527 RVA: 0x000093B8 File Offset: 0x000075B8
        public static double DistanceTo(this Vector3 vector3, Rectangle3 rectangle3)
        {
            DistanceVector3Rectangle3 distanceVector3Rectangle = new DistanceVector3Rectangle3(vector3, rectangle3);

            return(distanceVector3Rectangle.Distance);
        }
Exemplo n.º 5
0
        // Token: 0x06000170 RID: 368 RVA: 0x00007278 File Offset: 0x00005478
        public static Vector3 ClosestPointTo(this Rectangle3 rectangle, Vector3 vector)
        {
            DistanceVector3Rectangle3 distanceVector3Rectangle = new DistanceVector3Rectangle3(vector, rectangle);

            return(distanceVector3Rectangle.ClosestPointOnRectangle);
        }