Ejemplo n.º 1
0
        public override IndexedVector3 LocalGetSupportingVertexWithoutMargin(ref IndexedVector3 vec0)
        {
            IndexedVector3 supVec = IndexedVector3.Zero;

            IndexedVector3 vec    = vec0;
            float          lenSqr = vec.LengthSquared();

            if (lenSqr < 0.0001f)
            {
                vec = new IndexedVector3(1, 0, 0);
            }
            else
            {
                float rlen = (1.0f) / (float)Math.Sqrt(lenSqr);
                vec *= rlen;
                //vec.Normalize();
            }

            LocalSupportVertexCallback supportCallback = new LocalSupportVertexCallback(ref vec);
            IndexedVector3             aabbMax         = new IndexedVector3(float.MaxValue);
            IndexedVector3             aabbMin         = -aabbMax;

            m_stridingMesh.InternalProcessAllTriangles(supportCallback, ref aabbMin, ref aabbMax);
            supVec = supportCallback.GetSupportVertexLocal();

            return(supVec);
        }
Ejemplo n.º 2
0
        public override void BatchedUnitVectorGetSupportingVertexWithoutMargin(IndexedVector3[] vectors, IndexedVector4[] supportVerticesOut, int numVectors)
        {
            for (int j = 0; j < numVectors; j++)
            {
                IndexedVector3             vec             = vectors[j];
                LocalSupportVertexCallback supportCallback = new LocalSupportVertexCallback(ref vec);
                IndexedVector3             aabbMax         = MathUtil.MAX_VECTOR;
                IndexedVector3             aabbMin         = MathUtil.MIN_VECTOR;

                m_stridingMesh.InternalProcessAllTriangles(supportCallback, ref aabbMin, ref aabbMax);
                supportVerticesOut[j] = new IndexedVector4(supportCallback.GetSupportVertexLocal(), 0);
            }
        }