Exemple #1
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;
        }
Exemple #2
0
        // Token: 0x0600006C RID: 108 RVA: 0x0000342C File Offset: 0x0000162C
        public DistanceVector2Triangle2(Vector2 vector, Triangle2 triangle)
        {
            this = default(DistanceVector2Triangle2);
            DistanceVector3Triangle3 distanceVector3Triangle = new DistanceVector3Triangle3(new Vector3(vector.X, vector.Y, 0.0), new Triangle3(new Vector3(triangle.V0.X, triangle.V0.Y, 0.0), new Vector3(triangle.V1.X, triangle.V1.Y, 0.0), new Vector3(triangle.V2.X, triangle.V2.Y, 0.0)));

            this.SquaredDistance        = distanceVector3Triangle.SquaredDistance;
            this.ClosestPointOnVector   = vector;
            this.ClosestPointOnTriangle = new Vector2(distanceVector3Triangle.ClosestPointOnTriangle.X, distanceVector3Triangle.ClosestPointOnTriangle.Y);
        }
Exemple #3
0
        // Token: 0x060001CA RID: 458 RVA: 0x00008918 File Offset: 0x00006B18
        public DistanceSegment3Triangle3(Segment3 segment, Triangle3 triangle)
        {
            this = default(DistanceSegment3Triangle3);
            Line3 line = new Line3(segment.Origin, segment.Direction);
            DistanceLine3Triangle3 distanceLine3Triangle = new DistanceLine3Triangle3(line, triangle);

            if (distanceLine3Triangle.LineParameter < -segment.Extent)
            {
                DistanceVector3Triangle3 distanceVector3Triangle = new DistanceVector3Triangle3(segment.NegativeEnd, triangle);
                this.SquaredDistance        = distanceVector3Triangle.SquaredDistance;
                this.ClosestPointOnSegment  = segment.NegativeEnd;
                this.ClosestPointOnTriangle = distanceVector3Triangle.ClosestPointOnTriangle;
                this.SegmentParameter       = -segment.Extent;
                this.TriangleBary0          = distanceVector3Triangle.TriangleBary0;
                this.TriangleBary1          = distanceVector3Triangle.TriangleBary1;
                this.TriangleBary2          = distanceVector3Triangle.TriangleBary2;
                return;
            }
            if (distanceLine3Triangle.LineParameter <= segment.Extent)
            {
                this.SquaredDistance        = distanceLine3Triangle.SquaredDistance;
                this.ClosestPointOnSegment  = distanceLine3Triangle.ClosestPointOnLine;
                this.ClosestPointOnTriangle = distanceLine3Triangle.ClosestPointOnTriangle;
                this.SegmentParameter       = distanceLine3Triangle.LineParameter;
                this.TriangleBary0          = distanceLine3Triangle.TriangleBary0;
                this.TriangleBary1          = distanceLine3Triangle.TriangleBary1;
                this.TriangleBary2          = distanceLine3Triangle.TriangleBary2;
                return;
            }
            DistanceVector3Triangle3 distanceVector3Triangle2 = new DistanceVector3Triangle3(segment.PositiveEnd, triangle);

            this.SquaredDistance        = distanceVector3Triangle2.SquaredDistance;
            this.ClosestPointOnSegment  = segment.PositiveEnd;
            this.ClosestPointOnTriangle = distanceVector3Triangle2.ClosestPointOnTriangle;
            this.SegmentParameter       = segment.Extent;
            this.TriangleBary0          = distanceVector3Triangle2.TriangleBary0;
            this.TriangleBary1          = distanceVector3Triangle2.TriangleBary1;
            this.TriangleBary2          = distanceVector3Triangle2.TriangleBary2;
        }
Exemple #4
0
        // Token: 0x06000207 RID: 519 RVA: 0x00009264 File Offset: 0x00007464
        public static Segment3 ShortestSegmentTo(this Vector3 vector3, Triangle3 triangle3)
        {
            DistanceVector3Triangle3 distanceVector3Triangle = new DistanceVector3Triangle3(vector3, triangle3);

            return(new Segment3(distanceVector3Triangle.ClosestPointOnVector, distanceVector3Triangle.ClosestPointOnTriangle));
        }
Exemple #5
0
        // Token: 0x06000206 RID: 518 RVA: 0x00009244 File Offset: 0x00007444
        public static double DistanceTo(this Vector3 vector3, Triangle3 triangle3)
        {
            DistanceVector3Triangle3 distanceVector3Triangle = new DistanceVector3Triangle3(vector3, triangle3);

            return(distanceVector3Triangle.Distance);
        }
        // Token: 0x060001DB RID: 475 RVA: 0x00008B30 File Offset: 0x00006D30
        public static Vector3 ClosestPointTo(this Triangle3 triangle3, Vector3 vector3)
        {
            DistanceVector3Triangle3 distanceVector3Triangle = new DistanceVector3Triangle3(vector3, triangle3);

            return(distanceVector3Triangle.ClosestPointOnTriangle);
        }