本文整理汇总了C++中ViewerNodePtr::getWipeAngle方法的典型用法代码示例。如果您正苦于以下问题:C++ ViewerNodePtr::getWipeAngle方法的具体用法?C++ ViewerNodePtr::getWipeAngle怎么用?C++ ViewerNodePtr::getWipeAngle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ViewerNodePtr
的用法示例。
在下文中一共展示了ViewerNodePtr::getWipeAngle方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: firstPoint
ViewerGL::Implementation::WipePolygonEnum
ViewerGL::Implementation::getWipePolygon(const RectD & texRectClipped,
bool rightPlane,
QPolygonF * polygonPoints) const
{
///Compute a second point on the plane separator line
///we don't really care how far it is from the center point, it just has to be on the line
ViewerNodePtr node = _this->getViewerTab()->getInternalNode();
QPointF center = node->getWipeCenter();
double angle = node->getWipeAngle();
///extrapolate the line to the maximum size of the RoD so we're sure the line
///intersection algorithm works
double maxSize = std::max(texRectClipped.x2 - texRectClipped.x1, texRectClipped.y2 - texRectClipped.y1) * 10000.;
double xmax, ymax;
xmax = std::cos(angle + M_PI_2) * maxSize;
ymax = std::sin(angle + M_PI_2) * maxSize;
// first, compute wether the whole rectangle is on one side of the wipe
const QPointF firstPoint ( center.x() + (rightPlane ? xmax : -xmax), center.y() + (rightPlane ? ymax : -ymax) );
const QPointF secondPoint( center.x() + (rightPlane ? -xmax : xmax), center.y() + (rightPlane ? -ymax : ymax) );
double crossProd11 = ( ( secondPoint.x() - center.x() ) * ( texRectClipped.y1 - center.y() )
- ( secondPoint.y() - center.y() ) * ( texRectClipped.x1 - center.x() ) );
double crossProd12 = ( ( secondPoint.x() - center.x() ) * ( texRectClipped.y2 - center.y() )
- ( secondPoint.y() - center.y() ) * ( texRectClipped.x1 - center.x() ) );
double crossProd21 = ( ( secondPoint.x() - center.x() ) * ( texRectClipped.y1 - center.y() )
- ( secondPoint.y() - center.y() ) * ( texRectClipped.x2 - center.x() ) );
double crossProd22 = ( ( secondPoint.x() - center.x() ) * ( texRectClipped.y2 - center.y() )
- ( secondPoint.y() - center.y() ) * ( texRectClipped.x2 - center.x() ) );
polygonPoints->clear();
// if all cross products have the same sign, the rectangle is on one side
if ( (crossProd11 >= 0) && (crossProd12 >= 0) && (crossProd21 >= 0) && (crossProd22 >= 0) ) {
return ViewerGL::Implementation::eWipePolygonFull;
}
if ( (crossProd11 <= 0) && (crossProd12 <= 0) && (crossProd21 <= 0) && (crossProd22 <= 0) ) {
return ViewerGL::Implementation::eWipePolygonEmpty;
}
// now go through all four corners:
// - if the cross product is positive, the corner must be inserted
// - if the cross-product changes sign then the intersection must be inserted
const QLineF inter(firstPoint, secondPoint);
if (crossProd11 >= 0) {
*polygonPoints << QPointF(texRectClipped.x1, texRectClipped.y1);
}
if (crossProd11 * crossProd21 < 0) {
QLineF e(texRectClipped.x1, texRectClipped.y1, texRectClipped.x2, texRectClipped.y1);
QPointF p;
QLineF::IntersectType t = inter.intersect(e, &p);
if (t == QLineF::BoundedIntersection) {
*polygonPoints << p;
}
}
if (crossProd21 >= 0) {
*polygonPoints << QPointF(texRectClipped.x2, texRectClipped.y1);
}
if (crossProd21 * crossProd22 < 0) {
QLineF e(texRectClipped.x2, texRectClipped.y1, texRectClipped.x2, texRectClipped.y2);
QPointF p;
QLineF::IntersectType t = inter.intersect(e, &p);
if (t == QLineF::BoundedIntersection) {
*polygonPoints << p;
}
}
if (crossProd22 >= 0) {
*polygonPoints << QPointF(texRectClipped.x2, texRectClipped.y2);
}
if (crossProd22 * crossProd12 < 0) {
QLineF e(texRectClipped.x2, texRectClipped.y2, texRectClipped.x1, texRectClipped.y2);
QPointF p;
QLineF::IntersectType t = inter.intersect(e, &p);
if (t == QLineF::BoundedIntersection) {
*polygonPoints << p;
}
}
if (crossProd12 >= 0) {
*polygonPoints << QPointF(texRectClipped.x1, texRectClipped.y2);
}
if (crossProd12 * crossProd11 < 0) {
QLineF e(texRectClipped.x1, texRectClipped.y2, texRectClipped.x1, texRectClipped.y1);
QPointF p;
QLineF::IntersectType t = inter.intersect(e, &p);
if (t == QLineF::BoundedIntersection) {
*polygonPoints << p;
}
}
return ViewerGL::Implementation::eWipePolygonPartial;
} // getWipePolygon