本文整理汇总了C++中SbMatrix::multLineMatrix方法的典型用法代码示例。如果您正苦于以下问题:C++ SbMatrix::multLineMatrix方法的具体用法?C++ SbMatrix::multLineMatrix怎么用?C++ SbMatrix::multLineMatrix使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SbMatrix
的用法示例。
在下文中一共展示了SbMatrix::multLineMatrix方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: noTranslationLine
SbBool
SbCylinder::intersect(const SbLine &line, SbVec3f &enter, SbVec3f &exit) const
//
////////////////////////////////////////////////////////////////////////
{
// The intersection will actually be done on a radius 1 cylinder
// aligned with the y axis, so we transform the line into that
// space, then intersect, then transform the results back.
// rotation to y axis
SbRotation rotToYAxis(axis.getDirection(), SbVec3f(0,1,0));
SbMatrix mtxToYAxis;
mtxToYAxis.setRotate(rotToYAxis);
// scale to unit space
float scaleFactor = 1.0f/radius;
SbMatrix toUnitCylSpace;
toUnitCylSpace.setScale(SbVec3f(scaleFactor, scaleFactor, scaleFactor));
toUnitCylSpace.multLeft(mtxToYAxis);
// find the given line un-translated
SbVec3f origin = line.getPosition();
origin -= axis.getPosition();
SbLine noTranslationLine(origin, origin + line.getDirection());
// find the un-translated line in unit cylinder's space
SbLine cylLine;
toUnitCylSpace.multLineMatrix(noTranslationLine, cylLine);
// find the intersection on the unit cylinder
SbVec3f cylEnter, cylExit;
SbBool intersected = unitCylinderIntersect(cylLine, cylEnter, cylExit);
if (intersected) {
// transform back to original space
SbMatrix fromUnitCylSpace = toUnitCylSpace.inverse();
fromUnitCylSpace.multVecMatrix(cylEnter, enter);
enter += axis.getPosition();
fromUnitCylSpace.multVecMatrix(cylExit, exit);
exit += axis.getPosition();
}
return intersected;
}