当前位置: 首页>>代码示例>>C++>>正文


C++ SimulationModel::getSolidNormalizeStretch方法代码示例

本文整理汇总了C++中SimulationModel::getSolidNormalizeStretch方法的典型用法代码示例。如果您正苦于以下问题:C++ SimulationModel::getSolidNormalizeStretch方法的具体用法?C++ SimulationModel::getSolidNormalizeStretch怎么用?C++ SimulationModel::getSolidNormalizeStretch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SimulationModel的用法示例。


在下文中一共展示了SimulationModel::getSolidNormalizeStretch方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: solvePositionConstraint

bool StrainTetConstraint::solvePositionConstraint(SimulationModel &model)
{
	ParticleData &pd = model.getParticles();

	const unsigned i1 = m_bodies[0];
	const unsigned i2 = m_bodies[1];
	const unsigned i3 = m_bodies[2];
	const unsigned i4 = m_bodies[3];

	Eigen::Vector3f &x1 = pd.getPosition(i1);
	Eigen::Vector3f &x2 = pd.getPosition(i2);
	Eigen::Vector3f &x3 = pd.getPosition(i3);
	Eigen::Vector3f &x4 = pd.getPosition(i4);

	const float invMass1 = pd.getInvMass(i1);
	const float invMass2 = pd.getInvMass(i2);
	const float invMass3 = pd.getInvMass(i3);
	const float invMass4 = pd.getInvMass(i4);

	Eigen::Vector3f stiffness(model.getSolidStiffness(), model.getSolidStiffness(), model.getSolidStiffness());

	Eigen::Vector3f corr1, corr2, corr3, corr4;
	const bool res = PositionBasedDynamics::solve_StrainTetraConstraint(
		x1, invMass1,
		x2, invMass2,
		x3, invMass3,
		x4, invMass4,
		m_invRestMat,
		stiffness,
		stiffness,
		model.getSolidNormalizeStretch(),
		model.getSolidNormalizeShear(),
		corr1, corr2, corr3, corr4);

	if (res)
	{
		if (invMass1 != 0.0f)
			x1 += corr1;
		if (invMass2 != 0.0f)
			x2 += corr2;
		if (invMass3 != 0.0f)
			x3 += corr3;
		if (invMass4 != 0.0f)
			x4 += corr4;
	}
	return res;
}
开发者ID:mmmovania,项目名称:PositionBasedDynamics-ElasticRod,代码行数:47,代码来源:Constraints.cpp


注:本文中的SimulationModel::getSolidNormalizeStretch方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。