// Token: 0x06000481 RID: 1153 RVA: 0x000160B8 File Offset: 0x000142B8
        internal static Angle GetPointDirectionAngle(this Circle3 circle, Vector3 point)
        {
            UnitVector3 unitVector;

            if (!(new Plane3(circle.Normal, circle.Center).ClosestPointTo(point) - circle.Center).TryGetNormalized(out unitVector))
            {
                return(Angle.Zero);
            }
            double num = unitVector.Dot(circle.UnitU);

            if (num > 1.0)
            {
                num = 1.0;
            }
            else if (num < -1.0)
            {
                num = -1.0;
            }
            double num2 = Math.Acos(num);

            if (unitVector.Dot(circle.UnitV) < 0.0)
            {
                num2 = 6.2831853071795862 - num2;
            }
            return(Angle.FromRadians(num2));
        }
        // Token: 0x06000048 RID: 72 RVA: 0x00002DF8 File Offset: 0x00000FF8
        public DistancePlane3Circle3(Plane3 plane, Circle3 circle)
        {
            this = default(DistancePlane3Circle3);
            double value = circle.Normal.Dot(plane.Normal);

            if (1.0 - Math.Abs(value) < 1E-08)
            {
                this.ClosestPointOnCircle = circle.Center + circle.Radius * circle.UnitU;
                this.SignedDistance       = this.ClosestPointOnCircle.SignedDistanceTo(plane);
                return;
            }
            UnitVector3 vector = circle.Normal.UnitCross(plane.Normal);
            double      num    = circle.Center.SignedDistanceTo(plane);

            if (num < 0.0)
            {
                vector = -vector;
            }
            UnitVector3 vector2 = circle.Normal.UnitCross(vector);

            this.ClosestPointOnCircle = circle.Center + circle.Radius * vector2;
            double num2 = this.ClosestPointOnCircle.SignedDistanceTo(plane);

            if (Math.Sign(num) == Math.Sign(num2))
            {
                this.SignedDistance = num2;
                return;
            }
            this.SignedDistance = 0.0;
        }
        // Token: 0x060004C2 RID: 1218 RVA: 0x000188F8 File Offset: 0x00016AF8
        public static Circle3 Transform(this AffineTransform3 transformer, Circle3 circle)
        {
            AffineTransform3 source          = new AffineTransform3(circle.UnitU, circle.UnitV, circle.Normal, circle.Center);
            AffineTransform3 affineTransform = transformer.Transform(source);

            return(new Circle3(affineTransform.Origin, affineTransform.AxisX, affineTransform.AxisY, affineTransform.AxisZ, circle.Radius * transformer.Scale));
        }
Beispiel #4
0
 // Token: 0x0600003F RID: 63 RVA: 0x000028C7 File Offset: 0x00000AC7
 public Arc3(Circle3 circle, Angle startAngle, Angle deltaAngle)
 {
     this            = default(Arc3);
     this.Circle     = circle;
     this.StartAngle = startAngle;
     this.DeltaAngle = deltaAngle;
 }
Beispiel #5
0
        // Token: 0x06000487 RID: 1159 RVA: 0x000167AC File Offset: 0x000149AC
        public static AxisAlignedBox3 ComputeAxisAlignedBoundingBox(this Cylinder3 cylinder)
        {
            double           scalar          = cylinder.Height / 2.0;
            AffineTransform3 affineTransform = Transform3Factory.CreateOrthonormalBasis(cylinder.Axis.Direction);
            Circle3          circle          = new Circle3(cylinder.Axis.Origin + scalar * cylinder.Axis.Direction, affineTransform.AxisX, affineTransform.AxisY, affineTransform.AxisZ, cylinder.Radius);
            Circle3          circle2         = new Circle3(cylinder.Axis.Origin - scalar * cylinder.Axis.Direction, affineTransform.AxisX, affineTransform.AxisY, affineTransform.AxisZ, cylinder.Radius);
            AxisAlignedBox3  axisAlignedBox  = circle.ComputeAxisAlignedBoundingBox();
            AxisAlignedBox3  other           = circle2.ComputeAxisAlignedBoundingBox();

            return(axisAlignedBox.CreateMergedWith(other));
        }
Beispiel #6
0
        // Token: 0x0600012D RID: 301 RVA: 0x0000648C File Offset: 0x0000468C
        public static double DistanceTo(this Ray3 ray3, Circle3 circle3)
        {
            Line3 line = new Line3(ray3.Origin, ray3.Direction);
            DistanceLine3Circle3 distanceLine3Circle = new DistanceLine3Circle3(line, circle3);

            if (distanceLine3Circle.LineParameter < 0.0)
            {
                return(ray3.Origin.DistanceTo(circle3));
            }
            return(distanceLine3Circle.Distance);
        }
Beispiel #7
0
        // Token: 0x0600003D RID: 61 RVA: 0x00002B3C File Offset: 0x00000D3C
        public static Vector3 ClosestPointTo(this Circle3 circle3, Ray3 ray3)
        {
            Line3 line = new Line3(ray3.Origin, ray3.Direction);
            DistanceLine3Circle3 distanceLine3Circle = new DistanceLine3Circle3(line, circle3);

            if (distanceLine3Circle.LineParameter < 0.0)
            {
                return(circle3.ClosestPointTo(ray3.Origin));
            }
            return(distanceLine3Circle.ClosestPointOnCircle);
        }
Beispiel #8
0
        // Token: 0x0600003E RID: 62 RVA: 0x00002B90 File Offset: 0x00000D90
        public static Segment3 ShortestSegmentTo(this Circle3 circle3, Ray3 ray3)
        {
            Line3 line = new Line3(ray3.Origin, ray3.Direction);
            DistanceLine3Circle3 distanceLine3Circle = new DistanceLine3Circle3(line, circle3);

            if (distanceLine3Circle.LineParameter < 0.0)
            {
                return(circle3.ShortestSegmentTo(ray3.Origin));
            }
            return(new Segment3(distanceLine3Circle.ClosestPointOnCircle, distanceLine3Circle.ClosestPointOnLine));
        }
        // Token: 0x0600047F RID: 1151 RVA: 0x00015FBC File Offset: 0x000141BC
        public static AxisAlignedBox3 ComputeAxisAlignedBoundingBox(this Circle3 circle)
        {
            Vector3     center = circle.Center;
            UnitVector3 normal = circle.Normal;
            double      a      = Math.Acos(normal.Dot(UnitVector3.UnitX));
            double      a2     = Math.Acos(normal.Dot(UnitVector3.UnitY));
            double      a3     = Math.Acos(normal.Dot(UnitVector3.UnitZ));
            Vector3     vector = new Vector3(Math.Sin(a), Math.Sin(a2), Math.Sin(a3));

            vector *= circle.Radius;
            return(new AxisAlignedBox3(center - vector, center + vector));
        }
        // Token: 0x060000C0 RID: 192 RVA: 0x00004D20 File Offset: 0x00002F20
        internal static IEnumerable <double> GetPolynomialRoots(Line3 line, Circle3 circle)
        {
            Vector3 vector = circle.Center - line.Origin;
            double  num    = line.Direction.Dot(vector);
            Vector3 origin = line.Origin + num * line.Direction;

            line = new Line3(origin, line.Direction);
            Vector3 vector2       = line.Origin - circle.Center;
            double  squaredLength = vector2.SquaredLength;
            double  num2          = vector2.Dot(line.Direction);
            double  num3          = circle.Normal.Dot(line.Direction);
            double  num4          = vector2.Dot(circle.Normal);
            double  num5          = num2;
            double  num6          = num2 - num3 * num4;
            double  num7          = 1.0;
            double  num8          = num3;
            double  num9          = num7 - num8 * num8;
            double  num10         = num4;
            double  num11         = squaredLength - num10 * num10;
            double  num12         = num6;
            double  num13         = num9;
            double  num14         = circle.Radius * circle.Radius;
            double  num15         = num5;
            double  num16         = num15 * num15;
            double  num17         = 2.0 * num5 * 1.0;
            double  num18         = num6;
            double  num19         = num18 * num18;
            double  num20         = num9;
            double  num21         = num20 * num20;
            double  num22         = 2.0 * num6 * num9;
            double  num23         = 2.0 * num12;

            double[] coefficients = new double[]
            {
                num16 *num11 - num19 *num14,
                     num17 *num11 + num16 *num23 - num22 *num14,
                1.0 *num11 + num17 *num23 + num16 *num13 - num21 *num14,
                1.0 *num23 + num17 *num13,
                1.0 *num13
            };
            PolynomialRoots polynomialRoots = new PolynomialRoots(1E-05);
            polynomialRoots.FindB(new Polynomial1(coefficients), 6);
            List <double> list = new List <double>();
            for (int i = 0; i < polynomialRoots.Count; i++)
            {
                list.Add(polynomialRoots.GetRoot(i) + num);
            }
            return(list);
        }
        // Token: 0x060000B6 RID: 182 RVA: 0x00004C18 File Offset: 0x00002E18
        public DistanceLine3Circle3(Line3 line, Circle3 circle)
        {
            this = default(DistanceLine3Circle3);
            IEnumerable <double> polynomialRoots = DistanceLine3Circle3.GetPolynomialRoots(line, circle);
            double num = double.MaxValue;

            foreach (double num2 in polynomialRoots)
            {
                Vector3 vector = line.Origin + num2 * line.Direction;
                DistanceVector3Circle3 distanceVector3Circle = new DistanceVector3Circle3(vector, circle);
                double squaredDistance = distanceVector3Circle.SquaredDistance;
                if (squaredDistance < num)
                {
                    num = squaredDistance;
                    this.ClosestPointOnLine   = distanceVector3Circle.ClosestPointOnVector;
                    this.ClosestPointOnCircle = distanceVector3Circle.ClosestPointOnCircle;
                    this.LineParameter        = num2;
                }
            }
            this.SquaredDistance = num;
        }
Beispiel #12
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;
        }
Beispiel #13
0
        // Token: 0x06000111 RID: 273 RVA: 0x00005F64 File Offset: 0x00004164
        public static double DistanceTo(this Plane3 plane3, Circle3 circle3)
        {
            DistancePlane3Circle3 distancePlane3Circle = new DistancePlane3Circle3(plane3, circle3);

            return(distancePlane3Circle.Distance);
        }
Beispiel #14
0
        // Token: 0x060000A0 RID: 160 RVA: 0x00003BD4 File Offset: 0x00001DD4
        public static Segment3 ShortestSegmentTo(this Line3 line3, Circle3 circle3)
        {
            DistanceLine3Circle3 distanceLine3Circle = new DistanceLine3Circle3(line3, circle3);

            return(new Segment3(distanceLine3Circle.ClosestPointOnLine, distanceLine3Circle.ClosestPointOnCircle));
        }
Beispiel #15
0
        // Token: 0x0600009F RID: 159 RVA: 0x00003BB4 File Offset: 0x00001DB4
        public static Vector3 ClosestPointTo(this Line3 line3, Circle3 circle3)
        {
            DistanceLine3Circle3 distanceLine3Circle = new DistanceLine3Circle3(line3, circle3);

            return(distanceLine3Circle.ClosestPointOnLine);
        }
Beispiel #16
0
        // Token: 0x0600009E RID: 158 RVA: 0x00003B94 File Offset: 0x00001D94
        public static double DistanceTo(this Line3 line3, Circle3 circle3)
        {
            DistanceLine3Circle3 distanceLine3Circle = new DistanceLine3Circle3(line3, circle3);

            return(distanceLine3Circle.Distance);
        }
Beispiel #17
0
 // Token: 0x0600027D RID: 637 RVA: 0x0000A7AC File Offset: 0x000089AC
 public IntersectionPlane3Circle3(Plane3 plane, Circle3 circle)
 {
     this        = default(IntersectionPlane3Circle3);
     this.plane  = plane;
     this.circle = circle;
 }
Beispiel #18
0
        // Token: 0x0600038F RID: 911 RVA: 0x0000FA48 File Offset: 0x0000DC48
        public static bool Intersects(this Plane3 plane, Circle3 circle)
        {
            IntersectionPlane3Circle3 intersectionPlane3Circle = new IntersectionPlane3Circle3(plane, circle);

            return(intersectionPlane3Circle.Test());
        }
Beispiel #19
0
 // Token: 0x06000256 RID: 598 RVA: 0x0000A260 File Offset: 0x00008460
 public static ICollection <Vector3> IntersectionPointsWith(this Circle3 circle, Plane3 plane)
 {
     return(plane.IntersectionPointsWith(circle));
 }
Beispiel #20
0
        // Token: 0x06000043 RID: 67 RVA: 0x00002C7C File Offset: 0x00000E7C
        public static double SignedDistanceTo(this Circle3 circle3, Plane3 plane3)
        {
            DistancePlane3Circle3 distancePlane3Circle = new DistancePlane3Circle3(plane3, circle3);

            return(distancePlane3Circle.SignedDistance);
        }
Beispiel #21
0
        // Token: 0x06000040 RID: 64 RVA: 0x00002C10 File Offset: 0x00000E10
        public static Vector3 ClosestPointTo(this Circle3 circle3, Vector3 vector3)
        {
            DistanceVector3Circle3 distanceVector3Circle = new DistanceVector3Circle3(vector3, circle3);

            return(distanceVector3Circle.ClosestPointOnCircle);
        }
Beispiel #22
0
 // Token: 0x06000255 RID: 597 RVA: 0x0000A257 File Offset: 0x00008457
 public static bool Intersects(this Circle3 circle, Plane3 plane)
 {
     return(plane.Intersects(circle));
 }
Beispiel #23
0
 // Token: 0x0600003C RID: 60 RVA: 0x00002B31 File Offset: 0x00000D31
 public static double DistanceTo(this Circle3 circle3, Ray3 ray3)
 {
     return(ray3.DistanceTo(circle3));
 }
Beispiel #24
0
        // Token: 0x06000211 RID: 529 RVA: 0x00009404 File Offset: 0x00007604
        public static double DistanceTo(this Vector3 vector3, Circle3 circle3)
        {
            DistanceVector3Circle3 distanceVector3Circle = new DistanceVector3Circle3(vector3, circle3);

            return(distanceVector3Circle.Distance);
        }
Beispiel #25
0
        // Token: 0x06000212 RID: 530 RVA: 0x00009424 File Offset: 0x00007624
        public static Segment3 ShortestSegmentTo(this Vector3 vector3, Circle3 circle3)
        {
            DistanceVector3Circle3 distanceVector3Circle = new DistanceVector3Circle3(vector3, circle3);

            return(new Segment3(distanceVector3Circle.ClosestPointOnVector, distanceVector3Circle.ClosestPointOnCircle));
        }
Beispiel #26
0
        // Token: 0x06000390 RID: 912 RVA: 0x0000FA68 File Offset: 0x0000DC68
        public static ICollection <Vector3> IntersectionPointsWith(this Plane3 plane, Circle3 circle)
        {
            IntersectionPlane3Circle3 intersectionPlane3Circle = new IntersectionPlane3Circle3(plane, circle);

            return(new List <Vector3>(intersectionPlane3Circle.Find()));
        }