本文整理汇总了C++中Point2d::getY方法的典型用法代码示例。如果您正苦于以下问题:C++ Point2d::getY方法的具体用法?C++ Point2d::getY怎么用?C++ Point2d::getY使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Point2d
的用法示例。
在下文中一共展示了Point2d::getY方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: alignToGrid
void LevelDesignerController::alignToGrid(void) {
PolygonList polygonList = _model->getPolygonList();
for (int k = 0; k < _model->rowCount(); ++k) {
TreeItem* polygonItem = _model->getItem(_model->index(k, 0));
std::vector<Point2d> vertices = polygonList.at(k).getVertices();
for (int i = 0; i < polygonItem->childCount(); ++i) {
Point2d currVertex = vertices.at(i);
int oldX = currVertex.getX();
int oldY = currVertex.getY();
int extraX = static_cast<int>(oldX)%50;
int extraY = static_cast<int>(oldY)%50;
int newX = oldX;
int newY = oldY;
if (extraY < 50/3)
newY = oldY - extraY;// + 5;
else if (extraY > 50 - 50/3)
newY = oldY + (50 - extraY);// + 5;
if (extraX < 50/3)
newX = oldX - extraX;// + 5;
else if (extraX > 50 - 50/3)
newX = oldX + (50 - extraX);// + 5;
if (oldX != newX || oldY != newY)
moveVertex(k, i, oldX, oldY, newX, newY);
}
}
}
示例2: applyLocalWindow
// transform the mouse (Window coordinates) to the local coordinates (accordingly to localScreen matrix)
// reference (local coordinates) is required to set the depth of the mouse cursor in screen
Point3d ViewportUtil::applyLocalWindow(const Point2d &mouse,const Point3d &reference) {
Point4d ref4d(reference);
normalizedLocal.transform(&ref4d);
Point4d result4d(mouse.getX(),mouse.getY(),ref4d.getZ()/ref4d.getW(),1.0);
localWindow.transform(&result4d);
Point3d result;
result.project(result4d);
return result;
}
示例3:
double Segment::distance2(const Point2d &p) {
return distance2(Point3d(p.getX(),p.getY(),0));
}
示例4: setAB
void Segment::setAB(const Point2d &aa,const Point2d &bb) {
a.set(aa.getX(),aa.getY(),0);
b.set(bb.getX(),bb.getY(),0);
}
示例5: main
#include <color.hpp>
#include <point2d.hpp>
#include <circle.hpp>
#include <rectangle.hpp>
#define _USE_MATH_DEFINES
#include <cmath>
int main(int argc, char *argv[])
{
return Catch::Session().run(argc, argv);
}
TEST_CASE("describe_test", "[test]"){
Point2d punkt{0.5, 1.0};
REQUIRE(punkt.getX() == Approx(0.5));
REQUIRE(punkt.getY() == Approx(1.0));
Point2d punkt2{1.0, 1.0};
punkt2.translate(-2.0, -2.0);
REQUIRE(punkt2.getX() == Approx(-1.0));
REQUIRE(punkt2.getY() == Approx(-1.0));
punkt2.rotate(M_PI);
REQUIRE(punkt2.getX() == Approx(1.0));
REQUIRE(punkt2.getY() == Approx(1.0));
Color farbe{1.0, 0.0, 0.0};
Circle kreis{punkt, 2.0, farbe};
REQUIRE(kreis.getRadius() == Approx(2.0));
REQUIRE(kreis.circumference() == Approx(12.56637));
REQUIRE(kreis.getColor().r == Approx(1.0));
REQUIRE(kreis.getCenter().getX() == Approx(0.5));
示例6:
inline Point2dFloat operator*(const Point2d pt, const float factor)
{
return Point2dFloat(pt.getX() * factor, pt.getY() * factor);
}