Ejemplo n.º 1
0
        // Token: 0x06000074 RID: 116 RVA: 0x0000356C File Offset: 0x0000176C
        public DistanceVector3Arc3(Vector3 vector, Arc3 arc)
        {
            this = default(DistanceVector3Arc3);
            DistanceVector3Circle3 distanceVector3Circle = new DistanceVector3Circle3(vector, arc.Circle);

            this.ClosestPointOnArc = distanceVector3Circle.ClosestPointOnCircle;
            if (!arc.Contains(arc.Circle.GetPointDirectionAngle(this.ClosestPointOnArc)))
            {
                double squaredLength  = (vector - arc.StartPoint).SquaredLength;
                double squaredLength2 = (vector - arc.EndPoint).SquaredLength;
                this.ClosestPointOnArc = ((squaredLength2 < squaredLength) ? arc.EndPoint : arc.StartPoint);
            }
            this.SquaredDistance      = (vector - this.ClosestPointOnArc).SquaredLength;
            this.ClosestPointOnVector = vector;
        }
Ejemplo n.º 2
0
        // Token: 0x06000044 RID: 68 RVA: 0x00002C9C File Offset: 0x00000E9C
        public DistancePlane3Arc3(Plane3 plane, Arc3 arc)
        {
            this = default(DistancePlane3Arc3);
            double num  = arc.StartPoint.SignedDistanceTo(plane);
            double num2 = arc.EndPoint.SignedDistanceTo(plane);

            if (Math.Sign(num) != Math.Sign(num2))
            {
                this.SignedDistance = 0.0;
                return;
            }
            DistancePlane3Circle3 distancePlane3Circle = new DistancePlane3Circle3(plane, arc.Circle);
            double  signedDistance       = distancePlane3Circle.SignedDistance;
            Vector3 closestPointOnCircle = distancePlane3Circle.ClosestPointOnCircle;
            bool    flag = arc.Contains(arc.Circle.GetPointDirectionAngle(closestPointOnCircle));

            if (signedDistance != 0.0)
            {
                if (flag)
                {
                    this.SignedDistance = signedDistance;
                    return;
                }
                this.SignedDistance = ((num > 0.0) ? Math.Min(num, num2) : Math.Max(num, num2));
                return;
            }
            else
            {
                if (Math.Sign(arc.Circle.Center.SignedDistanceTo(plane)) != Math.Sign(num))
                {
                    this.SignedDistance = ((num > 0.0) ? Math.Min(num, num2) : Math.Max(num, num2));
                    return;
                }
                if (flag)
                {
                    this.SignedDistance = 0.0;
                    return;
                }
                this.SignedDistance = ((num > 0.0) ? Math.Min(num, num2) : Math.Max(num, num2));
                return;
            }
        }
Ejemplo n.º 3
0
        // Token: 0x06000483 RID: 1155 RVA: 0x00016320 File Offset: 0x00014520
        public static AxisAlignedBox3 ComputeAxisAlignedBoundingBox(this Arc3 arc)
        {
            AxisAlignedBox3 axisAlignedBox = arc.Circle.ComputeAxisAlignedBoundingBox();
            double          minX           = axisAlignedBox.MinX;
            double          maxX           = axisAlignedBox.MaxX;
            double          minY           = axisAlignedBox.MinY;
            double          maxY           = axisAlignedBox.MaxY;
            double          minZ           = axisAlignedBox.MinZ;
            double          maxZ           = axisAlignedBox.MaxZ;
            Vector3         startPoint     = arc.StartPoint;
            Vector3         endPoint       = arc.EndPoint;
            UnitVector3     unitVector;

            if (arc.Circle.Normal.TryGetUnitCross(UnitVector3.UnitX, out unitVector))
            {
                UnitVector3 vector = unitVector.UnitCross(arc.Circle.Normal);
                double      num    = Math.Acos(arc.Circle.UnitU.Dot(vector));
                if (arc.Circle.UnitV.Dot(UnitVector3.UnitX) < 0.0)
                {
                    num = 6.2831853071795862 - num;
                }
                if (!arc.Contains(Angle.FromRadians(num)))
                {
                    maxX = Math.Max(startPoint.X, endPoint.X);
                }
                if (!arc.Contains(Angle.FromRadians((num + 3.1415926535897931) % 6.2831853071795862)))
                {
                    minX = Math.Min(startPoint.X, endPoint.X);
                }
            }
            UnitVector3 unitVector2;

            if (arc.Circle.Normal.TryGetUnitCross(UnitVector3.UnitY, out unitVector2))
            {
                UnitVector3 vector2 = unitVector2.UnitCross(arc.Circle.Normal);
                double      num2    = Math.Acos(arc.Circle.UnitU.Dot(vector2));
                if (arc.Circle.UnitV.Dot(UnitVector3.UnitY) < 0.0)
                {
                    num2 = 6.2831853071795862 - num2;
                }
                if (!arc.Contains(Angle.FromRadians(num2)))
                {
                    maxY = Math.Max(startPoint.Y, endPoint.Y);
                }
                if (!arc.Contains(Angle.FromRadians((num2 + 3.1415926535897931) % 6.2831853071795862)))
                {
                    minY = Math.Min(startPoint.Y, endPoint.Y);
                }
            }
            UnitVector3 unitVector3;

            if (arc.Circle.Normal.TryGetUnitCross(UnitVector3.UnitZ, out unitVector3))
            {
                UnitVector3 vector3 = unitVector3.UnitCross(arc.Circle.Normal);
                double      num3    = Math.Acos(arc.Circle.UnitU.Dot(vector3));
                if (arc.Circle.UnitV.Dot(UnitVector3.UnitZ) < 0.0)
                {
                    num3 = 6.2831853071795862 - num3;
                }
                if (!arc.Contains(Angle.FromRadians(num3)))
                {
                    maxZ = Math.Max(startPoint.Z, endPoint.Z);
                }
                if (!arc.Contains(Angle.FromRadians((num3 + 3.1415926535897931) % 6.2831853071795862)))
                {
                    minZ = Math.Min(startPoint.Z, endPoint.Z);
                }
            }
            return(new AxisAlignedBox3(minX, maxX, minY, maxY, minZ, maxZ));
        }