btVector3 btTriangleMeshShape::localGetSupportingVertex(const btVector3& vec) const { btVector3 supportVertex; btTransform ident; ident.setIdentity(); SupportVertexCallback supportCallback(vec,ident); btVector3 aabbMax(btScalar(BT_LARGE_FLOAT),btScalar(BT_LARGE_FLOAT),btScalar(BT_LARGE_FLOAT)); processAllTriangles(&supportCallback,-aabbMax,aabbMax); supportVertex = supportCallback.GetSupportVertexLocal(); return supportVertex; }
void btConvexTriangleMeshShape::batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors, btVector3* supportVerticesOut, int numVectors) const { //use 'w' component of supportVerticesOut? { for (int i = 0; i < numVectors; i++) { supportVerticesOut[i][3] = btScalar(-BT_LARGE_FLOAT); } } ///@todo: could do the batch inside the callback! for (int j = 0; j < numVectors; j++) { const btVector3& vec = vectors[j]; LocalSupportVertexCallback supportCallback(vec); btVector3 aabbMax(btScalar(BT_LARGE_FLOAT), btScalar(BT_LARGE_FLOAT), btScalar(BT_LARGE_FLOAT)); m_stridingMesh->InternalProcessAllTriangles(&supportCallback, -aabbMax, aabbMax); supportVerticesOut[j] = supportCallback.GetSupportVertexLocal(); } }
btVector3 btConvexTriangleMeshShape::localGetSupportingVertexWithoutMargin(const btVector3& vec0)const { btVector3 supVec(btScalar(0.),btScalar(0.),btScalar(0.)); btVector3 vec = vec0; btScalar lenSqr = vec.length2(); if (lenSqr < btScalar(0.0001)) { vec.setValue(1,0,0); } else { btScalar rlen = btScalar(1.) / btSqrt(lenSqr ); vec *= rlen; } LocalSupportVertexCallback supportCallback(vec); btVector3 aabbMax(btScalar(BT_LARGE_FLOAT),btScalar(BT_LARGE_FLOAT),btScalar(BT_LARGE_FLOAT)); m_stridingMesh->InternalProcessAllTriangles(&supportCallback,-aabbMax,aabbMax); supVec = supportCallback.GetSupportVertexLocal(); return supVec; }
SimdVector3 ConvexTriangleMeshShape::LocalGetSupportingVertexWithoutMargin(const SimdVector3& vec0)const { SimdVector3 supVec(0.f,0.f,0.f); SimdVector3 vec = vec0; SimdScalar lenSqr = vec.length2(); if (lenSqr < 0.0001f) { vec.setValue(1,0,0); } else { float rlen = 1.f / SimdSqrt(lenSqr ); vec *= rlen; } LocalSupportVertexCallback supportCallback(vec); SimdVector3 aabbMax(1e30f,1e30f,1e30f); m_stridingMesh->InternalProcessAllTriangles(&supportCallback,-aabbMax,aabbMax); supVec = supportCallback.GetSupportVertexLocal(); return supVec; }
void ConvexTriangleMeshShape::BatchedUnitVectorGetSupportingVertexWithoutMargin(const SimdVector3* vectors,SimdVector3* supportVerticesOut,int numVectors) const { //use 'w' component of supportVerticesOut? { for (int i=0;i<numVectors;i++) { supportVerticesOut[i][3] = -1e30f; } } //todo: could do the batch inside the callback! for (int j=0;j<numVectors;j++) { const SimdVector3& vec = vectors[j]; LocalSupportVertexCallback supportCallback(vec); SimdVector3 aabbMax(1e30f,1e30f,1e30f); m_stridingMesh->InternalProcessAllTriangles(&supportCallback,-aabbMax,aabbMax); supportVerticesOut[j] = supportCallback.GetSupportVertexLocal(); } }