Пример #1
0
vec3f PhysActor_PhysX::GetAngularVelocity()
{
	if (!impl->physActor)
	{
		LOG("Cannot get angular velocity from actor because actor ptr is null!");
		return vec3f(0.0f, 0.0f, 0.0f);
	}

	PxRigidBody* actor = nullptr;

	if (impl->physActor->isRigidDynamic() || impl->physActor->isRigidBody())
		actor = (PxRigidBody*)impl->physActor;
	else
	{
		LOG("Cannot get angular velocity from actor because actor is not a Rigid Dynamic or Rigid Body actor.");
		return vec3f(0.0f, 0.0f, 0.0f);
	}

	if (!actor)
		return vec3f(0.0f, 0.0f, 0.0f);

	PxVec3 velocity = actor->getAngularVelocity();
	vec3f vConv(velocity.x, velocity.y, velocity.z);

	return vConv;
}
Пример #2
0
Vector2dVec DepthMap::getPointVec(const std::vector<int> & idxVec) const
{
    Vector2dVec result;
    result.reserve(idxVec.size());
    for (auto & idx : idxVec)
    {
        const int idxh = idx % hStep; //FIXME
        result.emplace_back(uConv(idxh % xMax), vConv(idxh / xMax));
    }
    return result;
}
Пример #3
0
Vector2dVec DepthMap::getPointVec() const
{
    Vector2dVec result;
    result.reserve(xMax * yMax);
    for (int y = 0; y < yMax; y++)
    {
        for (int x = 0; x < xMax; x++)
        {
            result.emplace_back(uConv(x), vConv(y)); 
        }
    }
    return result;
}
Пример #4
0
void DepthMap::applyMask(const Mat8u & mask)
{
    for (int y = 0; y < yMax; y++)
    {
        for (int x = 0; x < xMax; x++)
        {
            if ( not mask(vConv(y), uConv(x)) ) 
            {
                for (int h = 0; h < hMax; h++)
                {
                    at(x, y, h) = 0;
                }
            }
        }
    }
}