当前位置: 首页>>代码示例>>C++>>正文


C++ Point2D::getY方法代码示例

本文整理汇总了C++中Point2D::getY方法的典型用法代码示例。如果您正苦于以下问题:C++ Point2D::getY方法的具体用法?C++ Point2D::getY怎么用?C++ Point2D::getY使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Point2D的用法示例。


在下文中一共展示了Point2D::getY方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

bool operator<(const Point2D & p1, const Point2D & p2) {
    if(p1.getY() < p2.getY())
        return true;
    if(p2.getY() < p1.getY())
        return false;
    return p1.getX() < p2.getX();
}
开发者ID:carlosraoni,项目名称:Geometria-Computacional,代码行数:7,代码来源:primitives.cpp

示例2:

Line2D::Line2D(Point2D pointA, Point2D pointB) {
	Point2D b = pointA;
	Point2D a = pointB;
	y_intercept = -a.getX()*((b.getY() - a.getY()) / (b.getX() - a.getX())) + a.getY();
	slope = (b.getY() - a.getY()) / (b.getX() - a.getX());

}
开发者ID:sergey-buryakov,项目名称:CEssLabs,代码行数:7,代码来源:main.cpp

示例3: draw

void GhostCell::draw(Point2D cell) {
	if (cell.getX() < 0 || cell.getY() < 0)
		return;

	appearance->apply();

	glPushMatrix();

	glTranslatef(-10, 0.251, -10);
	glRotatef(-90, 1, 0, 0);

	glTranslatef(cell.getY() * 2.5, cell.getX() * -2.5, 0);

	glBegin(GL_QUADS);

	glTexCoord2d(0, 0);
	glVertex3d(0, -size, 0);

	glTexCoord2d(1, 0);
	glVertex3d(size, -size, 0);

	glTexCoord2d(1, 1);
	glVertex3d(size, 0, 0);

	glTexCoord2d(0, 1);
	glVertex3d(0, 0, 0);

	glEnd();

	glPopMatrix();
}
开发者ID:ferrolho,项目名称:feup-laig,代码行数:31,代码来源:Eximo.cpp

示例4: contains

	bool contains(Point2D point) {
		double ri = this->slope*point.getX() + this->y_intercept;
		if (point.getY() < ri+0.00001 && point.getY() > ri - 0.00001)
			return true;
		return false;

	}
开发者ID:sergey-buryakov,项目名称:CEssLabs,代码行数:7,代码来源:main.cpp

示例5: getZOfPoint

Math::Point Projector::getZOfPoint(Point2D point) {
    GLfloat pointZ;
    glReadPixels(point.getX(),
        currentDimensions.getY() - point.getY(),
        1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &pointZ);
    
    return Math::Point(point.getX(), point.getY(), pointZ);
}
开发者ID:dwks,项目名称:HexRacer,代码行数:8,代码来源:Projector.cpp

示例6: checkCollision

// Method for testing collision/intersection with a 2D point
bool Rectangle::checkCollision(Point2D& p)
{
	if ((bottomLeft.getX() <= p.getX() && bottomRight.getX() >= p.getX()) &&
		(bottomLeft.getY() <= p.getY() && topLeft.getY() >= p.getY()))
	{
		return true;
	} else {
		return false;
	}
}
开发者ID:harmonymeow,项目名称:Practice,代码行数:11,代码来源:Rectangle.cpp

示例7: getBestDivide

double DoubleImage::getBestDivide(const Point2D& first, const Point2D& second, Channel channel) const {

	if (dType == T_MIDDLE) {
		return .5;
	}

	bool high = (dType == T_HIGHENTROPY);

	if (!this->hasEdges()) {
		throw logic_error("Edges not generated!");
	}

	double initialXDiff = second.getX() - first.getX();
	double initialYDiff = second.getY() - first.getY();

	Point2D point1(first.getX() + MIN_SUBDIVIDE_RATIO*(initialXDiff),
	               first.getY() + MIN_SUBDIVIDE_RATIO*(initialYDiff));
	Point2D point2(first.getX() + (1-MIN_SUBDIVIDE_RATIO)*(initialXDiff),
	               first.getY() + (1-MIN_SUBDIVIDE_RATIO)*(initialYDiff));

	vector<Point2D> points = getPointsOnLine(point1, point2);

	double bestVal = -1;
	double bestR = -1;

	for (vector<Point2D>::const_iterator it = points.begin(); it != points.end(); it++) {
		const double val = edgeAt(*it, channel);
		if ( ((high)?(bestVal < val):(bestVal > val)) || bestR < 0) {
			const double rx = (it->getX() - first.getX())/initialXDiff;
			const double ry = (it->getY() - first.getY())/initialYDiff;
			double r;
			if (doublesEqual(initialXDiff, 0)) {
				r = ry;
			} else if (doublesEqual(initialYDiff, 0)) {
				r = rx;
			} else {
				r = (rx+ry)/2.;
			}
			if (r > MIN_SUBDIVIDE_RATIO && r < 1-MIN_SUBDIVIDE_RATIO) {
				bestR = r;
				bestVal = val;
			}
		}
	}

	if (bestR < 0) {
		return 1/2.0;
	} else {
		return bestR;
	}
}
开发者ID:allanlw,项目名称:fractal,代码行数:51,代码来源:doubleimage.cpp

示例8: subimage

IntensityImageStudent ImageUtils::subimage(const IntensityImage * image, const Point2D<double> left_top, const Point2D<double> right_down)
{
   int left_x = 0;
   int right_x = image->getWidth();

   int left_y = 0;
   int right_y = image->getHeight();

   if (left_top.getX() > right_down.getX()){
       left_x = right_down.getX();
       right_x = left_top.getX();
   }
   else if (left_top.getX() < right_down.getX()){
       left_x = left_top.getX();
       right_x = right_down.getX();
   }

   if (left_top.getY() > right_down.getY()){
       left_y = right_down.getY();
       right_y = left_top.getY();
   }
   else if (left_top.getY() < right_down.getY()){
       left_y = left_top.getY();
       right_y = right_down.getY();
   }

	IntensityImageStudent result(right_x - left_x, right_y - left_y);
	for (int y = left_y; y < right_y; y++) {
		for (int x = left_x; x < right_x; x++) {
			result.setPixel(x - left_x, y - left_y, image->getPixel(x, y));
		}
	}
	return result;
}
开发者ID:flammified,项目名称:HU-Vision-1516-BestName2016,代码行数:34,代码来源:ImageUtils.cpp

示例9:

Point2D Point2D::operator*(Point2D &p)
{
  Point2D producto;
  producto.x=x*p.getX();
  producto.y=y*p.getY();
  return producto;
}
开发者ID:IvanVdc,项目名称:IA_Resta,代码行数:7,代码来源:Point2D.cpp

示例10: cos

//Draw a line from a given position, with given length and angle
Point2D<double> StudentLocalization::drawLine(double angle, int len, Point2D<double> point) const{
	angle = angle * M_PI / HALF_CIRCLE; // Convert degrees to radians
	Point2D<double> point1;
	point1.setX(point.getX() + len * cos(angle)); 
	point1.setY(point.getY() + len * sin(angle));
	return point1;
}
开发者ID:areitsma,项目名称:HU-Vision-1415-Base,代码行数:8,代码来源:StudentLocalization.cpp

示例11: setPosition

void MotionExecutor::setPosition(MotionCommand* _motionCommand){
    SetPosition* command=(SetPosition*)_motionCommand;
    debug(command->getSource()+" Received: Set position");

    Point2D previousPosition =driver.getPosition();

    currentMotionInstruction.Set(_motionCommand, lastState);
    std::stringstream ss;
    debug(ss.str());
    pfLock.lock();
    driver.setPositionAndOrientation(command->getPoint(),command->getOrientation());
    for(int i=0;i<2;++i){
        if (detectedEnemies[i].Id!=-1){
            pathFinder->removeObstacle(detectedEnemies[i].Id);
            detectedEnemies[i].Position.setX(detectedEnemies[i].Position.getX()+previousPosition.getX());
            detectedEnemies[i].Position.setY(detectedEnemies[i].Position.getY()+previousPosition.getY());

            detectedEnemies[i].CentralPosition.setX(detectedEnemies[i].CentralPosition.getX()+previousPosition.getX());
            detectedEnemies[i].CentralPosition.setY(detectedEnemies[i].CentralPosition.getY()+previousPosition.getY());
//            detectedEnemies[i].Id=dodajSestougao(detectedEnemies[i].Position.getX(),
//                                                 detectedEnemies[i].Position.getY(),
//                                                 triangleSide,driver.getOrientation());

            detectedEnemies[i].Id=dodajCustomOblik(detectedEnemies[i].Position.getX(),
                                                 detectedEnemies[i].Position.getY(),
                                                 driver.getOrientation());
        }
    }
    pfLock.unlock();
}
开发者ID:bloublou2014,项目名称:eurobot2k15,代码行数:30,代码来源:MotionExecutor.cpp

示例12: screenToGL

Math::Point Projector::screenToGL(Point2D point) {
    Math::Point offset;
    double orthoDim = Math::minimum(
        currentDimensions.getX(),
        currentDimensions.getY());
    
    // offset is the value that translates by half the screen in the X and Y
    // dimensions. Since due to resizeGL() above the viewport is set
    // differently when width > height as when height > width, this complex
    // code is necessary.
    //
    // offset is used to change the origin (0, 0) from the upper-left corner
    // to the centre of the screen as is expected in OpenGL unit coordinates.
    if(currentDimensions.getX() > currentDimensions.getY() || true) {
        offset = Math::Point(
            double(currentDimensions.getX()) / currentDimensions.getY(), -1.0);
    }
    else {
        offset = Math::Point(1.0,
            -double(currentDimensions.getY()) / currentDimensions.getX());
    }
    
    Math::Point unitPos(
        point.getX() / orthoDim,
        -point.getY() / orthoDim);
    
    return 2.0 * unitPos - offset;
}
开发者ID:dwks,项目名称:HexRacer,代码行数:28,代码来源:Projector.cpp

示例13: pointInside

bool Rectangle::pointInside(const Point2D& point) const {
	double px = point.getX();
	double py = point.getY();
	return (((px >= this->x || doublesEqual(px, this->x)) &&
			 (px <= this->x+this->w || doublesEqual(px, this->x+this->w))) &&
			((py >= this->y || doublesEqual(py, this->y)) &&
			 (px <= this->y+this->h || doublesEqual(py, this->y+this->h))));
}
开发者ID:allanlw,项目名称:fractal,代码行数:8,代码来源:rectangle.cpp

示例14: abs

/*!
 * \note Currently, only the Manhatten distance is implemented.
 */
int Point2D::dist(Point2D a, unsigned int type) {
	switch(type) {
		case Point2D::MANHATTEN :
			return abs(x-a.getX()) + abs(y-a.getY());
		case Point2D::EUCLID :
		default:
			return 0;
	}
}
开发者ID:hellospencer,项目名称:shortestpath,代码行数:12,代码来源:points.cpp

示例15:

Agent::Agent( Point2D& p )
{
	this->_location = Point2D( p );
	this->setPosition( p.getX(), p.getY(), 0 );
	this->_destination = Point2D();
	this->_heading = Vector2D();
	this->_speed = 0;
	this->_radius = 0;
}
开发者ID:brandonheyer,项目名称:Migratory,代码行数:9,代码来源:Agent.cpp


注:本文中的Point2D::getY方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。