コード例 #1
0
        internal void Insert(int index, SupportData supportData)
        {
            dirty = true;

            ShapeA.Insert(index, supportData.SupportA);
            ShapeB.Insert(index, supportData.SupportB);
            Simplex.Insert(index, supportData.Difference);
        }
コード例 #2
0
        internal void Add(SupportData support)
        {
            dirty = true;

            Simplex.Add(support.Difference);
            Debug.Assert(Simplex.Count <= 3);

            AddSupportPoints(support.SupportA, support.SupportB);
        }
コード例 #3
0
        internal static SupportData Support(Func <Microsoft.Xna.Framework.Vector2, Microsoft.Xna.Framework.Vector2> supportA, Func <Microsoft.Xna.Framework.Vector2, Microsoft.Xna.Framework.Vector2> supportB, Microsoft.Xna.Framework.Vector2 v)
        {
            var sa = supportA(v);
            var sb = supportB(-v);

            var result = new SupportData
            {
                SupportA = sa,
                SupportB = sb,
            };

            return(result);
        }
コード例 #4
0
        /// <summary>
        /// Used by the GJK algorithm to gradually walk a triangle into the final position.
        /// </summary>
        /// <param name="index"></param>
        /// <param name="supportData"></param>
        internal void StaggerInsert(int index, SupportData supportData)
        {
            dirty = true;

            if (index > 0 && Simplex.Count > 0)
            {
                ShapeA[0]  = ShapeA[index];
                ShapeB[0]  = ShapeB[index];
                Simplex[0] = Simplex[index];
            }

            ShapeA[index]  = supportData.SupportA;
            ShapeB[index]  = supportData.SupportB;
            Simplex[index] = supportData.Difference;
        }