本文整理汇总了C++中Transformation::cartesianFromCartesianOrPolar方法的典型用法代码示例。如果您正苦于以下问题:C++ Transformation::cartesianFromCartesianOrPolar方法的具体用法?C++ Transformation::cartesianFromCartesianOrPolar怎么用?C++ Transformation::cartesianFromCartesianOrPolar使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Transformation
的用法示例。
在下文中一共展示了Transformation::cartesianFromCartesianOrPolar方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: adjustPolarAngleRanges
void Checker::adjustPolarAngleRanges (const DocumentModelCoords &modelCoords,
const Transformation &transformation,
const QList<Point> &points,
double &xMin,
double &xMax,
double &yMin) const
{
LOG4CPP_INFO_S ((*mainCat)) << "Checker::adjustPolarAngleRanges transformation=" << transformation;
const double UNIT_LENGTH = 1.0;
QString path; // For logging
if (modelCoords.coordsType() == COORDS_TYPE_POLAR) {
// Range minimum is at origin
yMin = modelCoords.originRadius();
path = QString ("yMin=%1 ").arg (yMin); // For logging
// Perform special processing to account for periodicity of polar coordinates. Start with unit vectors
// in the directions of the three axis points
double angle0 = points.at(0).posGraph().x();
double angle1 = points.at(1).posGraph().x();
double angle2 = points.at(2).posGraph().x();
QPointF pos0 = transformation.cartesianFromCartesianOrPolar(modelCoords,
QPointF (angle0, UNIT_LENGTH));
QPointF pos1 = transformation.cartesianFromCartesianOrPolar(modelCoords,
QPointF (angle1, UNIT_LENGTH));
QPointF pos2 = transformation.cartesianFromCartesianOrPolar(modelCoords,
QPointF (angle2, UNIT_LENGTH));
// Identify the axis point that is more in the center of the other two axis points. The arc is then drawn
// from one of the other two points to the other. Center point has smaller angles with the other points
double sumAngle0 = angleBetweenVectors(pos0, pos1) + angleBetweenVectors(pos0, pos2);
double sumAngle1 = angleBetweenVectors(pos1, pos0) + angleBetweenVectors(pos1, pos2);
double sumAngle2 = angleBetweenVectors(pos2, pos0) + angleBetweenVectors(pos2, pos1);
if ((sumAngle0 <= sumAngle1) && (sumAngle0 <= sumAngle2)) {
// Point 0 is in the middle. Either or neither of points 1 and 2 may be along point 0
if ((angleFromVectorToVector (pos0, pos1) < 0) ||
(angleFromVectorToVector (pos0, pos2) > 0)) {
path += QString ("from 1=%1 through 0 to 2=%2").arg (angle1).arg (angle2);
xMin = angle1;
xMax = angle2;
} else {
path += QString ("from 2=%1 through 0 to 1=%2").arg (angle2).arg (angle1);
xMin = angle2;
xMax = angle1;
}
} else if ((sumAngle1 <= sumAngle0) && (sumAngle1 <= sumAngle2)) {
// Point 1 is in the middle. Either or neither of points 0 and 2 may be along point 1
if ((angleFromVectorToVector (pos1, pos0) < 0) ||
(angleFromVectorToVector (pos1, pos2) > 0)) {
path += QString ("from 0=%1 through 1 to 2=%2").arg (angle0).arg (angle2);
xMin = angle0;
xMax = angle2;
} else {
path += QString ("from 2=%1 through 1 to 0=%2").arg (angle2).arg (angle0);
xMin = angle2;
xMax = angle0;
}
} else {
// Point 2 is in the middle. Either or neither of points 0 and 1 may be along point 2
if ((angleFromVectorToVector (pos2, pos0) < 0) ||
(angleFromVectorToVector (pos2, pos1) > 0)) {
path += QString ("from 0=%1 through 2 to 1=%2").arg (angle0).arg (angle1);
xMin = angle0;
xMax = angle1;
} else {
path += QString ("from 1=%1 through 2 to 0=%2").arg (angle1).arg (angle0);
xMin = angle1;
xMax = angle0;
}
}
// Make sure theta is increasing
while (xMax < xMin) {
double thetaPeriod = modelCoords.thetaPeriod();
path += QString (" xMax+=%1").arg (thetaPeriod);
xMax += thetaPeriod;
}
}
LOG4CPP_INFO_S ((*mainCat)) << "Checker::adjustPolarAngleRanges path=(" << path.toLatin1().data() << ")";
}