本文整理汇总了C++中SimulationModel::getElasticRodBendAndTwistStiffness方法的典型用法代码示例。如果您正苦于以下问题:C++ SimulationModel::getElasticRodBendAndTwistStiffness方法的具体用法?C++ SimulationModel::getElasticRodBendAndTwistStiffness怎么用?C++ SimulationModel::getElasticRodBendAndTwistStiffness使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimulationModel
的用法示例。
在下文中一共展示了SimulationModel::getElasticRodBendAndTwistStiffness方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: solvePositionConstraint
bool ElasticRodBendAndTwistConstraint::solvePositionConstraint(SimulationModel &model)
{
ParticleData &pd = model.getParticles();
ParticleData &pg = model.getGhostParticles();
Eigen::Vector3f &xA = pd.getPosition(m_bodies[0]);
Eigen::Vector3f &xB = pd.getPosition(m_bodies[1]);
Eigen::Vector3f &xC = pd.getPosition(m_bodies[2]);
Eigen::Vector3f &xD = pg.getPosition(m_bodies[3]);
Eigen::Vector3f &xE = pg.getPosition(m_bodies[4]);
const float wA = pd.getInvMass(m_bodies[0]);
const float wB = pd.getInvMass(m_bodies[1]);
const float wC = pd.getInvMass(m_bodies[2]);
const float wD = pg.getInvMass(m_bodies[3]);
const float wE = pg.getInvMass(m_bodies[4]);
Eigen::Vector3f corr[5];
bool res = PositionBasedElasticRod::ProjectBendingAndTwistingConstraint(
xA, wA, xB, wB, xC, wC, xD, wD, xE, wE,
m_bendAndTwistKs, 1.0f, m_restDarbouxVector,
corr[0], corr[1], corr[2], corr[3], corr[4], true);
if (res)
{
const float stiffness = model.getElasticRodBendAndTwistStiffness();
if (wA != 0.0f)
xA += stiffness*corr[0];
if (wB != 0.0f)
xB += stiffness*corr[1];
if (wC != 0.0f)
xC += stiffness*corr[2];
if (wD != 0.0f)
xD += stiffness*corr[3];
if (wE != 0.0f)
xE += stiffness*corr[4];
}
return res;
}
示例2: getBendAndTwistStiffness
void TW_CALL getBendAndTwistStiffness(void *value, void *clientData)
{
*(float *)(value) = model.getElasticRodBendAndTwistStiffness();
}