本文整理汇总了C++中Transform3f::inverse方法的典型用法代码示例。如果您正苦于以下问题:C++ Transform3f::inverse方法的具体用法?C++ Transform3f::inverse怎么用?C++ Transform3f::inverse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Transform3f
的用法示例。
在下文中一共展示了Transform3f::inverse方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getRelTransform
CMUK_ERROR_CODE cmuk::getRelTransform( const cmuk::XformCache& cache,
FrameIndex f0,
FrameIndex f1,
Transform3f* xform ) const {
int if0 = int(f0);
int if1 = int(f1);
if (if0 != FRAME_GROUND && (if0 < 0 || if0 >= NUM_FRAMES)) {
return CMUK_BAD_FRAME_INDEX;
}
if (if1 !=FRAME_GROUND && (if1 < 0 || if1 >= NUM_FRAMES)) {
return CMUK_BAD_FRAME_INDEX;
}
if (!xform) {
return CMUK_INSUFFICIENT_ARGUMENTS;
}
int leg0 = -1;
int leg1 = -1;
if (if0 > int(FRAME_TRUNK)) { leg0 = (if0 - 1) / 4; }
if (if1 > int(FRAME_TRUNK)) { leg1 = (if0 - 1) / 4; }
if (leg0 >= 0 && leg1 >= 0 && leg0 != leg1) {
Transform3f t1, t2;
CMUK_ERROR_CODE status;
status = getRelTransform(cache, f0, FRAME_TRUNK, &t1);
if (status != CMUK_OKAY) { return status; }
status = getRelTransform(cache, FRAME_TRUNK, f1, &t2);
if (status != CMUK_OKAY) { return status; }
*xform = t1 * t2;
return CMUK_OKAY;
}
if (if0 == if1) {
*xform = Transform3f();
return CMUK_OKAY;
}
// if1 should be smaller than if0
bool swap = if0 < if1;
if (swap) {
int tmp = if0;
if0 = if1;
if1 = tmp;
}
Transform3f rval = cache.relXforms[if0];
if0 = parentFrame(if0);
// now we are going to decrement if0
while (if1 < if0 && if0 > 0) {
rval = rval * cache.relXforms[if0];
if0 = parentFrame(if0);
}
if (swap) {
rval = rval.inverse();
}
*xform = rval;
return CMUK_OKAY;
}