本文整理汇总了C++中Plane3::normalizePlane方法的典型用法代码示例。如果您正苦于以下问题:C++ Plane3::normalizePlane方法的具体用法?C++ Plane3::normalizePlane怎么用?C++ Plane3::normalizePlane使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Plane3
的用法示例。
在下文中一共展示了Plane3::normalizePlane方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: alignPlane
/******************************************************************************
* Aligns the modifier's slicing plane to the three selected particles.
******************************************************************************/
void PickParticlePlaneInputMode::alignPlane(SliceModifier* mod)
{
OVITO_ASSERT(_pickedParticles.size() == 3);
try {
Plane3 worldPlane(_pickedParticles[0].worldPos, _pickedParticles[1].worldPos, _pickedParticles[2].worldPos, true);
if(worldPlane.normal.equals(Vector3::Zero(), FLOATTYPE_EPSILON))
throw Exception(tr("Cannot set the new slicing plane. The three selected particle are colinear."));
// Get the object to world transformation for the currently selected node.
ObjectNode* node = _pickedParticles[0].objNode;
TimeInterval interval;
const AffineTransformation& nodeTM = node->getWorldTransform(mod->dataset()->animationSettings()->time(), interval);
// Transform new plane from world to object space.
Plane3 localPlane = nodeTM.inverse() * worldPlane;
// Flip new plane orientation if necessary to align it with old orientation.
if(localPlane.normal.dot(mod->normal()) < 0)
localPlane = -localPlane;
localPlane.normalizePlane();
UndoableTransaction::handleExceptions(mod->dataset()->undoStack(), tr("Align plane to particles"), [mod, &localPlane]() {
mod->setNormal(localPlane.normal);
mod->setDistance(localPlane.dist);
});
}
catch(const Exception& ex) {
ex.showError();
}
}