Пример #1
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));
        }
Пример #2
0
        // Token: 0x060003BC RID: 956 RVA: 0x00010B24 File Offset: 0x0000ED24
        public static Segment3?IntersectionWith(this Ray3 ray, Cylinder3 cylinder)
        {
            IntersectionRay3Cylinder3 intersectionRay3Cylinder = new IntersectionRay3Cylinder3(ray, cylinder);

            intersectionRay3Cylinder.Find();
            if (intersectionRay3Cylinder.IntersectionType == Intersection.Type.IT_SEGMENT)
            {
                return(new Segment3?(new Segment3(intersectionRay3Cylinder.Point0, intersectionRay3Cylinder.Point1)));
            }
            if (intersectionRay3Cylinder.IntersectionType == Intersection.Type.IT_POINT)
            {
                return(new Segment3?(new Segment3(intersectionRay3Cylinder.Point0, intersectionRay3Cylinder.Point0)));
            }
            return(null);
        }
Пример #3
0
        // Token: 0x060003BD RID: 957 RVA: 0x00010B94 File Offset: 0x0000ED94
        public static ICollection <Vector3> IntersectionPointsWith(this Ray3 ray, Cylinder3 cylinder)
        {
            Segment3?segment = ray.IntersectionWith(cylinder);

            if (segment == null)
            {
                return(new List <Vector3>());
            }
            Segment3 value = segment.Value;

            if (value.Extent < 1E-08)
            {
                return(new List <Vector3>
                {
                    value.Origin
                });
            }
            return(new List <Vector3>
            {
                value.NegativeEnd,
                value.PositiveEnd
            });
        }
Пример #4
0
        // Token: 0x0600037A RID: 890 RVA: 0x0000F064 File Offset: 0x0000D264
        internal static int Find(Vector3 origin, UnitVector3 dir, Cylinder3 cylinder, double[] t)
        {
            UnitVector3 direction = cylinder.Axis.Direction;
            UnitVector3 unitVector;
            UnitVector3 unitVector2;

            Vector3Factory.GenerateComplementBasis(out unitVector, out unitVector2, direction);
            double  num     = 0.5 * cylinder.Height;
            double  num2    = cylinder.Radius * cylinder.Radius;
            Vector3 vector  = origin - cylinder.Axis.Origin;
            Vector3 vector2 = new Vector3(unitVector.Dot(vector), unitVector2.Dot(vector), direction.Dot(vector));
            double  num3    = direction.Dot(dir);

            if (Math.Abs(num3) >= 0.99999999)
            {
                if (num2 - vector2.X * vector2.X - vector2.Y * vector2.Y < 0.0)
                {
                    return(0);
                }
                if (num3 > 0.0)
                {
                    t[0] = -vector2.Z - num;
                    t[1] = -vector2.Z + num;
                }
                else
                {
                    t[0] = vector2.Z - num;
                    t[1] = vector2.Z + num;
                }
                return(2);
            }
            else
            {
                Vector3 vector3 = new Vector3(unitVector.Dot(dir), unitVector2.Dot(dir), num3);
                if (Math.Abs(vector3.Z) <= 1E-08)
                {
                    if (Math.Abs(vector2.Z) > num)
                    {
                        return(0);
                    }
                    double num4 = vector2.X * vector2.X + vector2.Y * vector2.Y - num2;
                    double num5 = vector2.X * vector3.X + vector2.Y * vector3.Y;
                    double num6 = vector3.X * vector3.X + vector3.Y * vector3.Y;
                    double num7 = num5;
                    double num8 = num7 * num7 - num4 * num6;
                    if (num8 < -1E-08)
                    {
                        return(0);
                    }
                    if (num8 > 1E-08)
                    {
                        double num9  = Math.Sqrt(num8);
                        double num10 = 1.0 / num6;
                        t[0] = (-num5 - num9) * num10;
                        t[1] = (-num5 + num9) * num10;
                        return(2);
                    }
                    t[0] = -num5 / num6;
                    return(1);
                }
                else
                {
                    int    num11 = 0;
                    double num10 = 1.0 / vector3.Z;
                    double num12 = (-num - vector2.Z) * num10;
                    double num13 = vector2.X + num12 * vector3.X;
                    double num14 = vector2.Y + num12 * vector3.Y;
                    double num15 = num13 * num13;
                    double num16 = num14;
                    if (num15 + num16 * num16 <= num2)
                    {
                        t[num11++] = num12;
                    }
                    double num17 = (num - vector2.Z) * num10;
                    double num18 = vector2.X + num17 * vector3.X;
                    num14 = vector2.Y + num17 * vector3.Y;
                    double num19 = num18 * num18;
                    double num20 = num14;
                    if (num19 + num20 * num20 <= num2)
                    {
                        t[num11++] = num17;
                    }
                    if (num11 == 2)
                    {
                        if (t[0] > t[1])
                        {
                            double num21 = t[0];
                            t[0] = t[1];
                            t[1] = num21;
                        }
                        return(2);
                    }
                    double num4  = vector2.X * vector2.X + vector2.Y * vector2.Y - num2;
                    double num5  = vector2.X * vector3.X + vector2.Y * vector3.Y;
                    double num6  = vector3.X * vector3.X + vector3.Y * vector3.Y;
                    double num22 = num5;
                    double num8  = num22 * num22 - num4 * num6;
                    if (num8 < -1E-08)
                    {
                        MathBase.Assert(num11 == 0, "IntersectionLine3Cylinder3: Unexpected condition\n");
                        return(0);
                    }
                    if (num8 > 1E-08)
                    {
                        double num9 = Math.Sqrt(num8);
                        num10 = 1.0 / num6;
                        double num23 = (-num5 - num9) * num10;
                        if (num11 != 1 || Math.Abs(t[0] - num23) >= 1E-08)
                        {
                            if (num12 <= num17)
                            {
                                if (num12 <= num23 && num23 <= num17)
                                {
                                    t[num11++] = num23;
                                }
                            }
                            else if (num17 <= num23 && num23 <= num12)
                            {
                                t[num11++] = num23;
                            }
                        }
                        if (num11 == 2)
                        {
                            if (t[0] > t[1])
                            {
                                double num24 = t[0];
                                t[0] = t[1];
                                t[1] = num24;
                            }
                            return(2);
                        }
                        num23 = (-num5 + num9) * num10;
                        if (num12 <= num17)
                        {
                            if (num12 <= num23 && num23 <= num17)
                            {
                                t[num11++] = num23;
                            }
                        }
                        else if (num17 <= num23 && num23 <= num12)
                        {
                            t[num11++] = num23;
                        }
                    }
                    else
                    {
                        double num23 = -num5 / num6;
                        if (num12 <= num17)
                        {
                            if (num12 <= num23 && num23 <= num17)
                            {
                                t[num11++] = num23;
                            }
                        }
                        else if (num17 <= num23 && num23 <= num12)
                        {
                            t[num11++] = num23;
                        }
                    }
                    if (num11 == 2 && t[0] > t[1])
                    {
                        double num25 = t[0];
                        t[0] = t[1];
                        t[1] = num25;
                    }
                    return(num11);
                }
            }
        }
Пример #5
0
        // Token: 0x06000361 RID: 865 RVA: 0x0000E8A0 File Offset: 0x0000CAA0
        public static bool Intersects(this Line3 line, Cylinder3 cylinder)
        {
            IntersectionLine3Cylinder3 intersectionLine3Cylinder = new IntersectionLine3Cylinder3(line, cylinder);

            return(intersectionLine3Cylinder.Find());
        }
 // Token: 0x060004CD RID: 1229 RVA: 0x00018B5A File Offset: 0x00016D5A
 public static Cylinder3 Transform(this AffineTransform3 transformer, Cylinder3 cylinder)
 {
     return(new Cylinder3(transformer.Transform(cylinder.Axis), transformer.Scale * cylinder.Radius, transformer.Scale * cylinder.Height));
 }
Пример #7
0
        // Token: 0x06000409 RID: 1033 RVA: 0x0001226C File Offset: 0x0001046C
        public static bool Intersects(this Segment3 segment, Cylinder3 cylinder)
        {
            IntersectionSegment3Cylinder3 intersectionSegment3Cylinder = new IntersectionSegment3Cylinder3(segment, cylinder);

            return(intersectionSegment3Cylinder.Find());
        }
Пример #8
0
 // Token: 0x06000418 RID: 1048 RVA: 0x00012934 File Offset: 0x00010B34
 public IntersectionSegment3Cylinder3(Segment3 segment, Cylinder3 cylinder)
 {
     this          = default(IntersectionSegment3Cylinder3);
     this.segment  = segment;
     this.cylinder = cylinder;
 }
Пример #9
0
 // Token: 0x06000278 RID: 632 RVA: 0x0000A63C File Offset: 0x0000883C
 public static Segment3?IntersectionWith(this Cylinder3 cylinder, Segment3 segment)
 {
     return(segment.IntersectionWith(cylinder));
 }
Пример #10
0
 // Token: 0x06000277 RID: 631 RVA: 0x0000A633 File Offset: 0x00008833
 public static bool Intersects(this Cylinder3 cylinder, Segment3 segment)
 {
     return(segment.Intersects(cylinder));
 }
Пример #11
0
 // Token: 0x06000276 RID: 630 RVA: 0x0000A62A File Offset: 0x0000882A
 public static ICollection <Vector3> IntersectionPointsWith(this Cylinder3 cylinder, Ray3 ray)
 {
     return(ray.IntersectionPointsWith(cylinder));
 }
Пример #12
0
 // Token: 0x06000275 RID: 629 RVA: 0x0000A621 File Offset: 0x00008821
 public static Segment3?IntersectionWith(this Cylinder3 cylinder, Ray3 ray)
 {
     return(ray.IntersectionWith(cylinder));
 }
Пример #13
0
 // Token: 0x06000274 RID: 628 RVA: 0x0000A618 File Offset: 0x00008818
 public static bool Intersects(this Cylinder3 cylinder, Ray3 ray)
 {
     return(ray.Intersects(cylinder));
 }
Пример #14
0
 // Token: 0x06000273 RID: 627 RVA: 0x0000A60F File Offset: 0x0000880F
 public static ICollection <Vector3> IntersectionPointsWith(this Cylinder3 cylinder, Line3 line)
 {
     return(line.IntersectionPointsWith(cylinder));
 }
Пример #15
0
 // Token: 0x06000272 RID: 626 RVA: 0x0000A606 File Offset: 0x00008806
 public static Segment3?IntersectionWith(this Cylinder3 cylinder, Line3 line)
 {
     return(line.IntersectionWith(cylinder));
 }
Пример #16
0
 // Token: 0x06000372 RID: 882 RVA: 0x0000EF26 File Offset: 0x0000D126
 public IntersectionLine3Cylinder3(Line3 line, Cylinder3 cylinder)
 {
     this          = default(IntersectionLine3Cylinder3);
     this.line     = line;
     this.cylinder = cylinder;
 }
Пример #17
0
 // Token: 0x06000279 RID: 633 RVA: 0x0000A645 File Offset: 0x00008845
 public static ICollection <Vector3> IntersectionPointsWith(this Cylinder3 cylinder, Segment3 segment)
 {
     return(segment.IntersectionPointsWith(cylinder));
 }
Пример #18
0
 // Token: 0x06000271 RID: 625 RVA: 0x0000A5FD File Offset: 0x000087FD
 public static bool Intersects(this Cylinder3 cylinder, Line3 line)
 {
     return(line.Intersects(cylinder));
 }
Пример #19
0
        // Token: 0x060003BB RID: 955 RVA: 0x00010B04 File Offset: 0x0000ED04
        public static bool Intersects(this Ray3 ray, Cylinder3 cylinder)
        {
            IntersectionRay3Cylinder3 intersectionRay3Cylinder = new IntersectionRay3Cylinder3(ray, cylinder);

            return(intersectionRay3Cylinder.Find());
        }
Пример #20
0
 // Token: 0x060003CD RID: 973 RVA: 0x0001142E File Offset: 0x0000F62E
 public IntersectionRay3Cylinder3(Ray3 ray, Cylinder3 cylinder)
 {
     this          = default(IntersectionRay3Cylinder3);
     this.ray      = ray;
     this.cylinder = cylinder;
 }