예제 #1
0
        // Token: 0x0600021E RID: 542 RVA: 0x000095DC File Offset: 0x000077DC
        public DistanceVector3Circle3(Vector3 vector, Circle3 circle)
        {
            this = default(DistanceVector3Circle3);
            Vector3 left          = vector - circle.Center;
            double  num           = left.Dot(circle.Normal);
            Vector3 vector2       = left - num * circle.Normal;
            double  squaredLength = vector2.SquaredLength;

            if (squaredLength >= 1E-08)
            {
                this.ClosestPointOnCircle = circle.Center + circle.Radius / Math.Sqrt(squaredLength) * vector2;
                this.SquaredDistance      = (vector - this.ClosestPointOnCircle).SquaredLength;
            }
            else
            {
                this.ClosestPointOnCircle = circle.GetEdgePoint(Angle.FromRadians(0.0));
                double num2 = circle.Radius * circle.Radius;
                double num3 = num;
                this.SquaredDistance = num2 + num3 * num3;
            }
            this.ClosestPointOnVector = vector;
        }
예제 #2
0
 public static AffineTransform3 CreateFromAxisAngle(UnitVector3 axis, double angle, Vector3 origin)
 {
     return(Transform3Factory.CreateFromAxisAngle(axis, Angle.FromRadians(angle), origin, 1.0));
 }
예제 #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));
        }
예제 #4
0
 // Token: 0x06000022 RID: 34 RVA: 0x000024AC File Offset: 0x000006AC
 public static Angle operator /(Angle angle, double scalar)
 {
     return(Angle.FromRadians(angle.Radians / scalar));
 }
예제 #5
0
 // Token: 0x06000024 RID: 36 RVA: 0x000024CD File Offset: 0x000006CD
 public static Angle operator %(Angle angle, Angle divisor)
 {
     return(Angle.FromRadians(angle.Radians % divisor.Radians));
 }
예제 #6
0
 // Token: 0x06000021 RID: 33 RVA: 0x0000249C File Offset: 0x0000069C
 public static Angle operator *(double scalar, Angle angle)
 {
     return(Angle.FromRadians(angle.Radians * scalar));
 }
예제 #7
0
 // Token: 0x0600001F RID: 31 RVA: 0x0000247D File Offset: 0x0000067D
 public static Angle operator -(Angle angle)
 {
     return(Angle.FromRadians(-angle.Radians));
 }
예제 #8
0
 // Token: 0x0600001E RID: 30 RVA: 0x00002467 File Offset: 0x00000667
 public static Angle operator -(Angle left, Angle right)
 {
     return(Angle.FromRadians(left.Radians - right.Radians));
 }
예제 #9
0
 // Token: 0x0600001C RID: 28 RVA: 0x0000243E File Offset: 0x0000063E
 public static Angle Abs(Angle angle)
 {
     return(Angle.FromRadians(Math.Abs(angle.Radians)));
 }
예제 #10
0
 // Token: 0x0600001B RID: 27 RVA: 0x00002422 File Offset: 0x00000622
 public static Angle FromDegrees(double degrees)
 {
     return(Angle.FromRadians(degrees / 180.0 * 3.1415926535897931));
 }