本文整理汇总了C++中ParameterMap::addV3D方法的典型用法代码示例。如果您正苦于以下问题:C++ ParameterMap::addV3D方法的具体用法?C++ ParameterMap::addV3D怎么用?C++ ParameterMap::addV3D使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ParameterMap
的用法示例。
在下文中一共展示了ParameterMap::addV3D方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: moveComponent
/**
* Add/modify an entry in the parameter map for the given component
* to update its position. The component is const
* as the move doesn't actually change the object
* @param comp A reference to the component to move
* @param pmap A reference to the ParameterMap that will hold the new position
* @param pos The new position
* @param positionType Defines how the given position should be interpreted @see
* TransformType enumeration
*/
void moveComponent(const IComponent &comp, ParameterMap &pmap,
const Kernel::V3D &pos, const TransformType positionType) {
//
// This behaviour was copied from how MoveInstrumentComponent worked
//
// First set it to the new absolute position
V3D newPos = pos;
switch (positionType) {
case Absolute: // Do nothing
break;
case Relative:
newPos += comp.getPos();
break;
default:
throw std::invalid_argument("moveComponent - Unknown positionType: " +
boost::lexical_cast<std::string>(positionType));
}
// Then find the corresponding relative position
auto parent = comp.getParent();
if (parent) {
newPos -= parent->getPos();
Quat rot = parent->getRotation();
rot.inverse();
rot.rotate(newPos);
}
// Add a parameter for the new position
pmap.addV3D(comp.getComponentID(), "pos", newPos);
}