本文整理汇总了C++中Point2D::Y方法的典型用法代码示例。如果您正苦于以下问题:C++ Point2D::Y方法的具体用法?C++ Point2D::Y怎么用?C++ Point2D::Y使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Point2D
的用法示例。
在下文中一共展示了Point2D::Y方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: expandRect
QRect expandRect(const Point2D &p, QRect rect)
{
auto expandMax = [](float outPoint, float expandedSide){return outPoint > expandedSide ? outPoint : expandedSide;};
auto expandMin = [](float outPoint, float expandedSide){return outPoint < expandedSide ? outPoint : expandedSide;};
rect.setRight(expandMax(p.X(), rect.right()));
rect.setLeft(expandMin(p.X(), rect.left()));
rect.setBottom(expandMax(p.Y(), rect.bottom()));
rect.setTop(expandMin(p.Y(), rect.top()));
return rect;
}
示例2: moveDown
bool moveDown() {
if (level > 0) {
beginP.Y() -= F_LIFT_STEPPING;
endP.Y() -= F_LIFT_STEPPING;
level--;
return true;
}
return false;
}
示例3: moveUp
bool moveUp() {
if (level < 2) {
beginP.Y() += F_LIFT_STEPPING;
endP.Y() += F_LIFT_STEPPING;
level++;
return true;
}
return false;
}
示例4: setNosePos
void setNosePos(Point2D _nosePos) {
working = true;
headPoints[0] = _nosePos;
Point2D tmp(_nosePos.X() - W_HEAD_SIZE, _nosePos.Y() - W_HEAD_SIZE);
headPoints[1] = tmp;
tmp.set(_nosePos.X() - W_HEAD_SIZE * 2, _nosePos.Y());
headPoints[2] = tmp;
tmp.set(_nosePos.X() - W_HEAD_SIZE, _nosePos.Y() + W_HEAD_SIZE);
headPoints[3] = tmp;
generateTailPoints();
working = false;
}
示例5: getScreenPoint
Point2D CFlightVisualiser::getScreenPoint(const Point3D& p, const QRect& fieldLimit)
{
Point2D plain = getPlainCords(p);
float y = (-fieldLimit.left() + plain.X()) / (fieldLimit.right() - fieldLimit.left());
float z = (-fieldLimit.bottom() + plain.Y()) / (fieldLimit.top() - fieldLimit.bottom());
y *= this->width();
z *= this->height();
return Point2D(y, /*this->height() -*/ z);
}
示例6: main
int main() {
Point2D temp;
Point2DCentroid centroid;
for(int i = 0; i < 1; i++){
temp = Point2D(randRange(0.0f, 1.0f), randRange(-1.0f, 1.0f));
cout << temp.X() << " " << temp.Y() << endl;
centroid.add(temp);
}
auto center = centroid.get();
cout << center.X() << " " << center.Y() << endl;
Point2D A(3, 5), B(1, 7), C;
float x = 7.0;
C = A + B; // points are vector
C -= A;
C *= x;
cout << C.X() << " " << C.Y() << endl;
return 0;
}
示例7: generateTailPoints
void generateTailPoints() {
float const multipl = 16 * pow(W_TAIL_PERIODS_NUM, 2);
float const ampl = sqrt((pow(W_TAIL_FULL_LENGTH, 2) + multipl * pow(W_TAIL_FULL_AMPL, 2)
- pow(length, 2)) / multipl);
int c = 0;
Point2D nosePos = headPoints[0];
for (float i = 0.0; i < length; i += W_TAIL_RESOLUTION) {
float x = i;
float y = nosePos.Y() - ampl * sin(2 * W_TAIL_PERIODS_NUM * M_PI / length * x);
if (toRight > 0) { //balra megy
x = nosePos.X() - 2 * W_HEAD_SIZE - x;
} else {
x = nosePos.X() + x;
}
tailPoints[c++] = Point2D(x, y);
}
}
示例8: drawCords
void CFlightVisualiser::drawCords(QPainter& painter, const QRect& fieldLimit)
{
Point3D zero3D(0, 0, 0), x3D(100, 0, 0), y3D(0, 100, 0), z3D(0, 0, 100);
Point2D zeroPoint = getScreenPoint(zero3D, fieldLimit);
Point2D x = getScreenPoint(x3D, fieldLimit);
Point2D y = getScreenPoint(y3D, fieldLimit);
Point2D z = getScreenPoint(z3D, fieldLimit);
painter.setPen(QPen(QColor(), 1));
painter.drawLine(QPointF(zeroPoint), QPointF(x));
painter.drawText(QRectF(QPointF(x), QPointF(x.X() + 20, x.Y() + 20)), "X");
painter.drawLine(QPointF(zeroPoint), QPointF(y));
painter.drawText(QRectF(QPointF(y), QPointF(y.X() + 20, y.Y() + 20)), "Y");
painter.drawLine(QPointF(zeroPoint), QPointF(z));
painter.drawText(QRectF(QPointF(z), QPointF(z.X() + 20, z.Y() + 20)), "Z");
painter.setPen(Qt::SolidLine);
const int distance = 1;
std::vector<QPoint> frameVec = {QPoint(distance, distance), QPoint(distance, this->height() - distance),
QPoint(distance, this->height() - distance), QPoint(this->width() - distance, this->height() - distance),
QPoint(this->width() - distance, this->height() - distance), QPoint(this->width() - distance, distance),
QPoint(this->width() - distance, distance), QPoint(distance, distance)};
QVector<QPoint> frameCords;
for(const auto& p: frameVec)
{
frameCords.push_back(p);
}
painter.drawLines(frameCords);
Rectangle3D max3dRect = getMaximumRect();
float xPosStart = max3dRect.minX;
float yPosStart = max3dRect.minY;
float xPosEnd = max3dRect.maxX;
float yPosEnd = max3dRect.maxY;
float xPos = xPosStart;
float yPos = yPosStart;
for(int i = 0; i < 11; ++i)
{
Point2D curXMinYWebPoint = getScreenPoint(Point3D(xPos, yPosStart, 0), fieldLimit);
Point2D curXMaxYWebPoint = getScreenPoint(Point3D(xPos, yPosEnd, 0), fieldLimit);
Point2D minXCurYWebPoint = getScreenPoint(Point3D(xPosStart, yPos, 0), fieldLimit);
Point2D maxXCurYWebPoint = getScreenPoint(Point3D(xPosEnd, yPos, 0), fieldLimit);
painter.drawLine(QPointF(curXMinYWebPoint.X(), curXMinYWebPoint.Y()), QPointF(curXMaxYWebPoint.X(), curXMaxYWebPoint.Y())); //x
painter.drawLine(QPointF(minXCurYWebPoint.X(), minXCurYWebPoint.Y()), QPointF(maxXCurYWebPoint.X(), maxXCurYWebPoint.Y()));
xPos += (xPosEnd - xPosStart) / 10;
yPos += (yPosEnd - yPosStart) / 10;
}
}
示例9: inRange
bool inRange(const Point2D& point) const {
if (this->data.empty())
return false;
return point.X()<this->width() && point.Y()<this->height();
}