Ejemplo n.º 1
0
        public override void SupportMapping(ref TSVector direction, out TSVector result)
        {
            TSVector tSVector;

            TSVector.Normalize(ref direction, out tSVector);
            TSVector.Multiply(ref tSVector, this.sphericalExpansion, out tSVector);
            int  num  = 0;
            FP   y    = TSVector.Dot(ref this.points[0], ref direction);
            FP   fP   = TSVector.Dot(ref this.points[1], ref direction);
            bool flag = fP > y;

            if (flag)
            {
                y   = fP;
                num = 1;
            }
            fP = TSVector.Dot(ref this.points[2], ref direction);
            bool flag2 = fP > y;

            if (flag2)
            {
                num = 2;
            }
            TSVector.Add(ref this.points[num], ref tSVector, out result);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Multiplies a vector by a scale factor.
        /// </summary>
        /// <param name="value2">The vector to scale.</param>
        /// <param name="value1">The scale factor.</param>
        /// <returns>Returns the scaled vector.</returns>
        #region public static JVector operator *(FP value1, JVector value2)
        public static TSVector operator *(FP value1, TSVector value2)
        {
            TSVector result;

            TSVector.Multiply(ref value2, value1, out result);
            return(result);
        }
Ejemplo n.º 3
0
        public override void SupportMapping(ref TSVector direction, out TSVector result)
        {
            FP   fP   = FP.Sqrt(direction.x * direction.x + direction.z * direction.z);
            bool flag = FP.Abs(direction.y) > FP.Zero;

            if (flag)
            {
                TSVector tSVector;
                TSVector.Normalize(ref direction, out tSVector);
                TSVector.Multiply(ref tSVector, this.radius, out result);
                result.y += FP.Sign(direction.y) * FP.Half * this.length;
            }
            else
            {
                bool flag2 = fP > FP.Zero;
                if (flag2)
                {
                    result.x = direction.x / fP * this.radius;
                    result.y = FP.Zero;
                    result.z = direction.z / fP * this.radius;
                }
                else
                {
                    result.x = FP.Zero;
                    result.y = FP.Zero;
                    result.z = FP.Zero;
                }
            }
        }
Ejemplo n.º 4
0
 public void SupportCenter(out TSVector center)
 {
     center = this.owner.points[this.indices.I0].position;
     TSVector.Add(ref center, ref this.owner.points[this.indices.I1].position, out center);
     TSVector.Add(ref center, ref this.owner.points[this.indices.I2].position, out center);
     TSVector.Multiply(ref center, FP.One / (3 * FP.One), out center);
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Multiply a vector with a factor.
        /// </summary>
        /// <param name="value1">The vector to multiply.</param>
        /// <param name="scaleFactor">The scale factor.</param>
        /// <returns>Returns the multiplied vector.</returns>
        #region public static JVector Multiply(JVector value1, FP scaleFactor)
        public static TSVector Multiply(TSVector value1, FP scaleFactor)
        {
            TSVector result;

            TSVector.Multiply(ref value1, scaleFactor, out result);
            return(result);
        }
Ejemplo n.º 6
0
        private void IntegrateForces()
        {
            int i     = 0;
            int count = this.rigidBodies.Count;

            while (i < count)
            {
                RigidBody rigidBody = this.rigidBodies[i];
                bool      flag      = !rigidBody.isStatic && rigidBody.IsActive;
                if (flag)
                {
                    TSVector tSVector;
                    TSVector.Multiply(ref rigidBody.force, rigidBody.inverseMass * this.timestep, out tSVector);
                    TSVector.Add(ref tSVector, ref rigidBody.linearVelocity, out rigidBody.linearVelocity);
                    bool flag2 = !rigidBody.isParticle;
                    if (flag2)
                    {
                        TSVector.Multiply(ref rigidBody.torque, this.timestep, out tSVector);
                        TSVector.Transform(ref tSVector, ref rigidBody.invInertiaWorld, out tSVector);
                        TSVector.Add(ref tSVector, ref rigidBody.angularVelocity, out rigidBody.angularVelocity);
                    }
                    bool affectedByGravity = rigidBody.affectedByGravity;
                    if (affectedByGravity)
                    {
                        TSVector.Multiply(ref this.gravity, this.timestep, out tSVector);
                        TSVector.Add(ref rigidBody.linearVelocity, ref tSVector, out rigidBody.linearVelocity);
                    }
                }
                rigidBody.force.MakeZero();
                rigidBody.torque.MakeZero();
                i++;
            }
        }
Ejemplo n.º 7
0
        private void CreateAABox(ref TSBBox aabb, Octree.EChild child, out TSBBox result)
        {
            TSVector tSVector;

            TSVector.Subtract(ref aabb.max, ref aabb.min, out tSVector);
            TSVector.Multiply(ref tSVector, FP.Half, out tSVector);
            TSVector zero = TSVector.zero;

            switch (child)
            {
            case Octree.EChild.MMM:
                zero = new TSVector(0, 0, 0);
                break;

            case Octree.EChild.XP:
                zero = new TSVector(1, 0, 0);
                break;

            case Octree.EChild.YP:
                zero = new TSVector(0, 1, 0);
                break;

            case Octree.EChild.PPM:
                zero = new TSVector(1, 1, 0);
                break;

            case Octree.EChild.ZP:
                zero = new TSVector(0, 0, 1);
                break;

            case Octree.EChild.PMP:
                zero = new TSVector(1, 0, 1);
                break;

            case Octree.EChild.MPP:
                zero = new TSVector(0, 1, 1);
                break;

            case Octree.EChild.PPP:
                zero = new TSVector(1, 1, 1);
                break;

            default:
                Debug.WriteLine("Octree.CreateAABox  got impossible child");
                break;
            }
            result     = default(TSBBox);
            result.min = new TSVector(zero.x * tSVector.x, zero.y * tSVector.y, zero.z * tSVector.z);
            TSVector.Add(ref result.min, ref aabb.min, out result.min);
            TSVector.Add(ref result.min, ref tSVector, out result.max);
            FP       eN = FP.EN5;
            TSVector tSVector2;

            TSVector.Multiply(ref tSVector, eN, out tSVector2);
            TSVector.Subtract(ref result.min, ref tSVector2, out result.min);
            TSVector.Add(ref result.max, ref tSVector2, out result.max);
        }
Ejemplo n.º 8
0
        public void ApplyImpulse(TSVector impulse)
        {
            bool flag = this.isStatic;

            if (flag)
            {
                throw new InvalidOperationException("Can't apply an impulse to a static body.");
            }
            TSVector tSVector;

            TSVector.Multiply(ref impulse, this.inverseMass, out tSVector);
            TSVector.Add(ref this.linearVelocity, ref tSVector, out this.linearVelocity);
        }
Ejemplo n.º 9
0
        private void IntegrateCallback(object obj)
        {
            RigidBody rigidBody = obj as RigidBody;
            TSVector  tSVector;

            TSVector.Multiply(ref rigidBody.linearVelocity, this.timestep, out tSVector);
            TSVector.Add(ref tSVector, ref rigidBody.position, out rigidBody.position);
            bool flag = !rigidBody.isParticle;

            if (flag)
            {
                FP       magnitude = rigidBody.angularVelocity.magnitude;
                bool     flag2     = magnitude < FP.EN3;
                TSVector tSVector2;
                if (flag2)
                {
                    TSVector.Multiply(ref rigidBody.angularVelocity, FP.Half * this.timestep - this.timestep * this.timestep * this.timestep * (2082 * FP.EN6) * magnitude * magnitude, out tSVector2);
                }
                else
                {
                    TSVector.Multiply(ref rigidBody.angularVelocity, FP.Sin(FP.Half * magnitude * this.timestep) / magnitude, out tSVector2);
                }
                TSQuaternion tSQuaternion = new TSQuaternion(tSVector2.x, tSVector2.y, tSVector2.z, FP.Cos(magnitude * this.timestep * FP.Half));
                TSQuaternion tSQuaternion2;
                TSQuaternion.CreateFromMatrix(ref rigidBody.orientation, out tSQuaternion2);
                TSQuaternion.Multiply(ref tSQuaternion, ref tSQuaternion2, out tSQuaternion);
                tSQuaternion.Normalize();
                TSMatrix.CreateFromQuaternion(ref tSQuaternion, out rigidBody.orientation);
            }
            bool flag3 = (rigidBody.Damping & RigidBody.DampingType.Linear) > RigidBody.DampingType.None;

            if (flag3)
            {
                TSVector.Multiply(ref rigidBody.linearVelocity, this.currentLinearDampFactor, out rigidBody.linearVelocity);
            }
            bool flag4 = (rigidBody.Damping & RigidBody.DampingType.Angular) > RigidBody.DampingType.None;

            if (flag4)
            {
                TSVector.Multiply(ref rigidBody.angularVelocity, this.currentAngularDampFactor, out rigidBody.angularVelocity);
            }
            rigidBody.Update();
            bool flag5 = this.CollisionSystem.EnableSpeculativeContacts || rigidBody.EnableSpeculativeContacts;

            if (flag5)
            {
                rigidBody.SweptExpandBoundingBox(this.timestep);
            }
        }
Ejemplo n.º 10
0
        public void ApplyImpulse(TSVector impulse, TSVector relativePosition)
        {
            bool flag = this.isStatic;

            if (flag)
            {
                throw new InvalidOperationException("Can't apply an impulse to a static body.");
            }
            TSVector tSVector;

            TSVector.Multiply(ref impulse, this.inverseMass, out tSVector);
            TSVector.Add(ref this.linearVelocity, ref tSVector, out this.linearVelocity);
            TSVector.Cross(ref relativePosition, ref impulse, out tSVector);
            TSVector.Transform(ref tSVector, ref this.invInertiaWorld, out tSVector);
            TSVector.Add(ref this.angularVelocity, ref tSVector, out this.angularVelocity);
        }
Ejemplo n.º 11
0
            public override void Iterate()
            {
                bool flag = this.skipConstraint;

                if (!flag)
                {
                    FP x = TSVector.Dot(ref this.body1.linearVelocity, ref this.jacobian[0]);
                    x += TSVector.Dot(ref this.body2.linearVelocity, ref this.jacobian[1]);
                    FP   y     = this.accumulatedImpulse * this.softnessOverDt;
                    FP   fP    = -this.effectiveMass * (x + this.bias + y);
                    bool flag2 = this.behavior == SoftBody.Spring.DistanceBehavior.LimitMinimumDistance;
                    if (flag2)
                    {
                        FP y2 = this.accumulatedImpulse;
                        this.accumulatedImpulse = TSMath.Max(this.accumulatedImpulse + fP, 0);
                        fP = this.accumulatedImpulse - y2;
                    }
                    else
                    {
                        bool flag3 = this.behavior == SoftBody.Spring.DistanceBehavior.LimitMaximumDistance;
                        if (flag3)
                        {
                            FP y3 = this.accumulatedImpulse;
                            this.accumulatedImpulse = TSMath.Min(this.accumulatedImpulse + fP, 0);
                            fP = this.accumulatedImpulse - y3;
                        }
                        else
                        {
                            this.accumulatedImpulse += fP;
                        }
                    }
                    bool flag4 = !this.body1.isStatic;
                    if (flag4)
                    {
                        TSVector tSVector;
                        TSVector.Multiply(ref this.jacobian[0], fP * this.body1.inverseMass, out tSVector);
                        TSVector.Add(ref tSVector, ref this.body1.linearVelocity, out this.body1.linearVelocity);
                    }
                    bool flag5 = !this.body2.isStatic;
                    if (flag5)
                    {
                        TSVector tSVector;
                        TSVector.Multiply(ref this.jacobian[1], fP * this.body2.inverseMass, out tSVector);
                        TSVector.Add(ref tSVector, ref this.body2.linearVelocity, out this.body2.linearVelocity);
                    }
                }
            }
Ejemplo n.º 12
0
        private void FindSupportPoints(RigidBody body1, RigidBody body2, Shape shape1, Shape shape2, ref TSVector point, ref TSVector normal, out TSVector point1, out TSVector point2)
        {
            TSVector tSVector;

            TSVector.Negate(ref normal, out tSVector);
            TSVector tSVector2;

            this.SupportMapping(body1, shape1, ref tSVector, out tSVector2);
            TSVector tSVector3;

            this.SupportMapping(body2, shape2, ref normal, out tSVector3);
            TSVector.Subtract(ref tSVector2, ref point, out tSVector2);
            TSVector.Subtract(ref tSVector3, ref point, out tSVector3);
            FP scaleFactor  = TSVector.Dot(ref tSVector2, ref normal);
            FP scaleFactor2 = TSVector.Dot(ref tSVector3, ref normal);

            TSVector.Multiply(ref normal, scaleFactor, out tSVector2);
            TSVector.Multiply(ref normal, scaleFactor2, out tSVector3);
            TSVector.Add(ref point, ref tSVector2, out point1);
            TSVector.Add(ref point, ref tSVector3, out point2);
        }
Ejemplo n.º 13
0
        public override void SetCurrentShape(int index)
        {
            this.vecs[0] = this.octree.GetVertex(this.octree.tris[this.potentialTriangles[index]].I0);
            this.vecs[1] = this.octree.GetVertex(this.octree.tris[this.potentialTriangles[index]].I1);
            this.vecs[2] = this.octree.GetVertex(this.octree.tris[this.potentialTriangles[index]].I2);
            TSVector geomCen = this.vecs[0];

            TSVector.Add(ref geomCen, ref this.vecs[1], out geomCen);
            TSVector.Add(ref geomCen, ref this.vecs[2], out geomCen);
            TSVector.Multiply(ref geomCen, FP.One / (3 * FP.One), out geomCen);
            this.geomCen = geomCen;
            TSVector.Subtract(ref this.vecs[1], ref this.vecs[0], out geomCen);
            TSVector.Subtract(ref this.vecs[2], ref this.vecs[0], out this.normal);
            TSVector.Cross(ref geomCen, ref this.normal, out this.normal);
            bool flag = this.flipNormal;

            if (flag)
            {
                this.normal.Negate();
            }
        }
Ejemplo n.º 14
0
        public override void SetCurrentShape(int index)
        {
            bool flag  = false;
            bool flag2 = index >= this.numX * this.numZ;

            if (flag2)
            {
                flag   = true;
                index -= this.numX * this.numZ;
            }
            int  num   = index % this.numX;
            int  num2  = index / this.numX;
            bool flag3 = flag;

            if (flag3)
            {
                this.points[0].Set((this.minX + num) * this.scaleX, this.heights[this.minX + num, this.minZ + num2], (this.minZ + num2) * this.scaleZ);
                this.points[1].Set((this.minX + num + 1) * this.scaleX, this.heights[this.minX + num + 1, this.minZ + num2], (this.minZ + num2) * this.scaleZ);
                this.points[2].Set((this.minX + num) * this.scaleX, this.heights[this.minX + num, this.minZ + num2 + 1], (this.minZ + num2 + 1) * this.scaleZ);
            }
            else
            {
                this.points[0].Set((this.minX + num + 1) * this.scaleX, this.heights[this.minX + num + 1, this.minZ + num2], (this.minZ + num2) * this.scaleZ);
                this.points[1].Set((this.minX + num + 1) * this.scaleX, this.heights[this.minX + num + 1, this.minZ + num2 + 1], (this.minZ + num2 + 1) * this.scaleZ);
                this.points[2].Set((this.minX + num) * this.scaleX, this.heights[this.minX + num, this.minZ + num2 + 1], (this.minZ + num2 + 1) * this.scaleZ);
            }
            TSVector geomCen = this.points[0];

            TSVector.Add(ref geomCen, ref this.points[1], out geomCen);
            TSVector.Add(ref geomCen, ref this.points[2], out geomCen);
            TSVector.Multiply(ref geomCen, FP.One / (3 * FP.One), out geomCen);
            this.geomCen = geomCen;
            TSVector.Subtract(ref this.points[1], ref this.points[0], out geomCen);
            TSVector.Subtract(ref this.points[2], ref this.points[0], out this.normal);
            TSVector.Cross(ref geomCen, ref this.normal, out this.normal);
        }
Ejemplo n.º 15
0
 public override void SupportMapping(ref TSVector direction, out TSVector result)
 {
     result = direction;
     result.Normalize();
     TSVector.Multiply(ref result, this.radius, out result);
 }
Ejemplo n.º 16
0
        public static bool Raycast(ISupportMappable support, ref TSMatrix orientation, ref TSMatrix invOrientation, ref TSVector position, ref TSVector origin, ref TSVector direction, out FP fraction, out TSVector normal)
        {
            VoronoiSimplexSolver @new = GJKCollide.simplexSolverPool.GetNew();

            @new.Reset();
            normal   = TSVector.zero;
            fraction = FP.MaxValue;
            FP       fP       = FP.Zero;
            TSVector tSVector = direction;
            TSVector p        = origin;
            TSVector tSVector2;

            GJKCollide.SupportMapTransformed(support, ref orientation, ref position, ref tSVector, out tSVector2);
            TSVector tSVector3;

            TSVector.Subtract(ref p, ref tSVector2, out tSVector3);
            int  num = 15;
            FP   x   = tSVector3.sqrMagnitude;
            FP   eN  = FP.EN6;
            bool result;

            while (x > eN && num-- != 0)
            {
                TSVector q;
                GJKCollide.SupportMapTransformed(support, ref orientation, ref position, ref tSVector3, out q);
                TSVector w;
                TSVector.Subtract(ref p, ref q, out w);
                FP   x2   = TSVector.Dot(ref tSVector3, ref w);
                bool flag = x2 > FP.Zero;
                if (flag)
                {
                    FP   fP2   = TSVector.Dot(ref tSVector3, ref tSVector);
                    bool flag2 = fP2 >= -TSMath.Epsilon;
                    if (flag2)
                    {
                        GJKCollide.simplexSolverPool.GiveBack(@new);
                        result = false;
                        return(result);
                    }
                    fP -= x2 / fP2;
                    TSVector.Multiply(ref tSVector, fP, out p);
                    TSVector.Add(ref origin, ref p, out p);
                    TSVector.Subtract(ref p, ref q, out w);
                    normal = tSVector3;
                }
                bool flag3 = [email protected](w);
                if (flag3)
                {
                    @new.AddVertex(w, p, q);
                }
                bool flag4 = @new.Closest(out tSVector3);
                if (flag4)
                {
                    x = tSVector3.sqrMagnitude;
                }
                else
                {
                    x = FP.Zero;
                }
            }
            TSVector tSVector4;
            TSVector value;

            @new.ComputePoints(out tSVector4, out value);
            value   -= origin;
            fraction = value.magnitude / direction.magnitude;
            bool flag5 = normal.sqrMagnitude > TSMath.Epsilon * TSMath.Epsilon;

            if (flag5)
            {
                normal.Normalize();
            }
            GJKCollide.simplexSolverPool.GiveBack(@new);
            result = true;
            return(result);
        }
Ejemplo n.º 17
0
        public static bool Detect(ISupportMappable support1, ISupportMappable support2, ref TSMatrix orientation1, ref TSMatrix orientation2, ref TSVector position1, ref TSVector position2, out TSVector point, out TSVector normal, out FP penetration)
        {
            TSVector zero  = TSVector.zero;
            TSVector zero2 = TSVector.zero;
            TSVector zero3 = TSVector.zero;

            point       = (normal = TSVector.zero);
            penetration = FP.Zero;
            TSVector tSVector;

            support1.SupportCenter(out tSVector);
            TSVector.Transform(ref tSVector, ref orientation1, out tSVector);
            TSVector.Add(ref position1, ref tSVector, out tSVector);
            TSVector tSVector2;

            support2.SupportCenter(out tSVector2);
            TSVector.Transform(ref tSVector2, ref orientation2, out tSVector2);
            TSVector.Add(ref position2, ref tSVector2, out tSVector2);
            TSVector tSVector3;

            TSVector.Subtract(ref tSVector2, ref tSVector, out tSVector3);
            bool flag = tSVector3.IsNearlyZero();

            if (flag)
            {
                tSVector3 = new TSVector(FP.EN4, 0, 0);
            }
            TSVector tSVector4 = tSVector3;

            TSVector.Negate(ref tSVector3, out normal);
            TSVector tSVector5;

            XenoCollide.SupportMapTransformed(support1, ref orientation1, ref position1, ref tSVector4, out tSVector5);
            TSVector tSVector6;

            XenoCollide.SupportMapTransformed(support2, ref orientation2, ref position2, ref normal, out tSVector6);
            TSVector tSVector7;

            TSVector.Subtract(ref tSVector6, ref tSVector5, out tSVector7);
            bool flag2 = TSVector.Dot(ref tSVector7, ref normal) <= FP.Zero;
            bool result;

            if (flag2)
            {
                result = false;
            }
            else
            {
                TSVector.Cross(ref tSVector7, ref tSVector3, out normal);
                bool flag3 = normal.IsNearlyZero();
                if (flag3)
                {
                    TSVector.Subtract(ref tSVector7, ref tSVector3, out normal);
                    normal.Normalize();
                    point = tSVector5;
                    TSVector.Add(ref point, ref tSVector6, out point);
                    TSVector.Multiply(ref point, FP.Half, out point);
                    TSVector tSVector8;
                    TSVector.Subtract(ref tSVector6, ref tSVector5, out tSVector8);
                    penetration = TSVector.Dot(ref tSVector8, ref normal);
                    result      = true;
                }
                else
                {
                    TSVector.Negate(ref normal, out tSVector4);
                    TSVector tSVector9;
                    XenoCollide.SupportMapTransformed(support1, ref orientation1, ref position1, ref tSVector4, out tSVector9);
                    TSVector tSVector10;
                    XenoCollide.SupportMapTransformed(support2, ref orientation2, ref position2, ref normal, out tSVector10);
                    TSVector tSVector11;
                    TSVector.Subtract(ref tSVector10, ref tSVector9, out tSVector11);
                    bool flag4 = TSVector.Dot(ref tSVector11, ref normal) <= FP.Zero;
                    if (flag4)
                    {
                        result = false;
                    }
                    else
                    {
                        TSVector tSVector8;
                        TSVector.Subtract(ref tSVector7, ref tSVector3, out tSVector8);
                        TSVector tSVector12;
                        TSVector.Subtract(ref tSVector11, ref tSVector3, out tSVector12);
                        TSVector.Cross(ref tSVector8, ref tSVector12, out normal);
                        FP   x     = TSVector.Dot(ref normal, ref tSVector3);
                        bool flag5 = x > FP.Zero;
                        if (flag5)
                        {
                            TSVector.Swap(ref tSVector7, ref tSVector11);
                            TSVector.Swap(ref tSVector5, ref tSVector9);
                            TSVector.Swap(ref tSVector6, ref tSVector10);
                            TSVector.Negate(ref normal, out normal);
                            Debug.Log("normal: " + normal);
                        }
                        int  num   = 0;
                        int  num2  = 0;
                        bool flag6 = false;
                        while (true)
                        {
                            bool flag7 = num2 > 34;
                            if (flag7)
                            {
                                break;
                            }
                            num2++;
                            TSVector.Negate(ref normal, out tSVector4);
                            TSVector tSVector13;
                            XenoCollide.SupportMapTransformed(support1, ref orientation1, ref position1, ref tSVector4, out tSVector13);
                            TSVector tSVector14;
                            XenoCollide.SupportMapTransformed(support2, ref orientation2, ref position2, ref normal, out tSVector14);
                            TSVector tSVector15;
                            TSVector.Subtract(ref tSVector14, ref tSVector13, out tSVector15);
                            bool flag8 = TSVector.Dot(ref tSVector15, ref normal) <= FP.Zero;
                            if (flag8)
                            {
                                goto Block_7;
                            }
                            TSVector.Cross(ref tSVector7, ref tSVector15, out tSVector8);
                            bool flag9 = TSVector.Dot(ref tSVector8, ref tSVector3) < FP.Zero;
                            if (flag9)
                            {
                                tSVector11 = tSVector15;
                                tSVector9  = tSVector13;
                                tSVector10 = tSVector14;
                                TSVector.Subtract(ref tSVector7, ref tSVector3, out tSVector8);
                                TSVector.Subtract(ref tSVector15, ref tSVector3, out tSVector12);
                                TSVector.Cross(ref tSVector8, ref tSVector12, out normal);
                            }
                            else
                            {
                                TSVector.Cross(ref tSVector15, ref tSVector11, out tSVector8);
                                bool flag10 = TSVector.Dot(ref tSVector8, ref tSVector3) < FP.Zero;
                                if (!flag10)
                                {
                                    goto IL_385;
                                }
                                tSVector7 = tSVector15;
                                tSVector5 = tSVector13;
                                tSVector6 = tSVector14;
                                TSVector.Subtract(ref tSVector15, ref tSVector3, out tSVector8);
                                TSVector.Subtract(ref tSVector11, ref tSVector3, out tSVector12);
                                TSVector.Cross(ref tSVector8, ref tSVector12, out normal);
                            }
                        }
                        result = false;
                        return(result);

Block_7:
                        result = false;
                        return(result);

IL_385:
                        while (true)
                        {
                            num++;
                            TSVector.Subtract(ref tSVector11, ref tSVector7, out tSVector8);
                            TSVector tSVector15;
                            TSVector.Subtract(ref tSVector15, ref tSVector7, out tSVector12);
                            TSVector.Cross(ref tSVector8, ref tSVector12, out normal);
                            bool flag11 = normal.IsNearlyZero();
                            if (flag11)
                            {
                                break;
                            }
                            normal.Normalize();
                            FP   x2     = TSVector.Dot(ref normal, ref tSVector7);
                            bool flag12 = x2 >= 0 && !flag6;
                            if (flag12)
                            {
                                flag6 = true;
                            }
                            TSVector.Negate(ref normal, out tSVector4);
                            XenoCollide.SupportMapTransformed(support1, ref orientation1, ref position1, ref tSVector4, out zero);
                            XenoCollide.SupportMapTransformed(support2, ref orientation2, ref position2, ref normal, out zero2);
                            TSVector.Subtract(ref zero2, ref zero, out zero3);
                            TSVector.Subtract(ref zero3, ref tSVector15, out tSVector8);
                            FP x3 = TSVector.Dot(ref tSVector8, ref normal);
                            penetration = TSVector.Dot(ref zero3, ref normal);
                            bool flag13 = x3 <= XenoCollide.CollideEpsilon || penetration <= FP.Zero || num > 34;
                            if (flag13)
                            {
                                goto Block_15;
                            }
                            TSVector.Cross(ref zero3, ref tSVector3, out tSVector8);
                            FP   x4     = TSVector.Dot(ref tSVector8, ref tSVector7);
                            bool flag14 = x4 >= FP.Zero;
                            if (flag14)
                            {
                                x4 = TSVector.Dot(ref tSVector8, ref tSVector11);
                                bool flag15 = x4 >= FP.Zero;
                                if (flag15)
                                {
                                    tSVector7 = zero3;
                                    tSVector5 = zero;
                                    tSVector6 = zero2;
                                }
                                else
                                {
                                    tSVector15 = zero3;
                                    TSVector tSVector13 = zero;
                                    TSVector tSVector14 = zero2;
                                }
                            }
                            else
                            {
                                x4 = TSVector.Dot(ref tSVector8, ref tSVector15);
                                bool flag16 = x4 >= FP.Zero;
                                if (flag16)
                                {
                                    tSVector11 = zero3;
                                    tSVector9  = zero;
                                    tSVector10 = zero2;
                                }
                                else
                                {
                                    tSVector7 = zero3;
                                    tSVector5 = zero;
                                    tSVector6 = zero2;
                                }
                            }
                        }
                        result = true;
                        return(result);

Block_15:
                        bool flag17 = flag6;
                        if (flag17)
                        {
                            TSVector.Cross(ref tSVector7, ref tSVector11, out tSVector8);
                            TSVector tSVector15;
                            FP       fP = TSVector.Dot(ref tSVector8, ref tSVector15);
                            TSVector.Cross(ref tSVector15, ref tSVector11, out tSVector8);
                            FP fP2 = TSVector.Dot(ref tSVector8, ref tSVector3);
                            TSVector.Cross(ref tSVector3, ref tSVector7, out tSVector8);
                            FP fP3 = TSVector.Dot(ref tSVector8, ref tSVector15);
                            TSVector.Cross(ref tSVector11, ref tSVector7, out tSVector8);
                            FP   fP4    = TSVector.Dot(ref tSVector8, ref tSVector3);
                            FP   fP5    = fP + fP2 + fP3 + fP4;
                            bool flag18 = fP5 <= 0;
                            if (flag18)
                            {
                                fP = 0;
                                TSVector.Cross(ref tSVector11, ref tSVector15, out tSVector8);
                                fP2 = TSVector.Dot(ref tSVector8, ref normal);
                                TSVector.Cross(ref tSVector15, ref tSVector7, out tSVector8);
                                fP3 = TSVector.Dot(ref tSVector8, ref normal);
                                TSVector.Cross(ref tSVector7, ref tSVector11, out tSVector8);
                                fP4 = TSVector.Dot(ref tSVector8, ref normal);
                                fP5 = fP2 + fP3 + fP4;
                            }
                            FP x5 = FP.One / fP5;
                            TSVector.Multiply(ref tSVector, fP, out point);
                            TSVector.Multiply(ref tSVector5, fP2, out tSVector8);
                            TSVector.Add(ref point, ref tSVector8, out point);
                            TSVector.Multiply(ref tSVector9, fP3, out tSVector8);
                            TSVector.Add(ref point, ref tSVector8, out point);
                            TSVector tSVector13;
                            TSVector.Multiply(ref tSVector13, fP4, out tSVector8);
                            TSVector.Add(ref point, ref tSVector8, out point);
                            TSVector.Multiply(ref tSVector2, fP, out tSVector12);
                            TSVector.Add(ref tSVector12, ref point, out point);
                            TSVector.Multiply(ref tSVector6, fP2, out tSVector8);
                            TSVector.Add(ref point, ref tSVector8, out point);
                            TSVector.Multiply(ref tSVector10, fP3, out tSVector8);
                            TSVector.Add(ref point, ref tSVector8, out point);
                            TSVector tSVector14;
                            TSVector.Multiply(ref tSVector14, fP4, out tSVector8);
                            TSVector.Add(ref point, ref tSVector8, out point);
                            TSVector.Multiply(ref point, x5 * FP.Half, out point);
                        }
                        result = flag6;
                    }
                }
            }
            return(result);
        }