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


C++ Point2d函数代码示例

本文整理汇总了C++中Point2d函数的典型用法代码示例。如果您正苦于以下问题:C++ Point2d函数的具体用法?C++ Point2d怎么用?C++ Point2d使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: color

bool c_CurveClustering::show_curves(const t_CurveSet &_curve_set,
                                    const size_t _height, const size_t _width,
                                    const std::string _file_name)
{
    Mat_<Vec3b> image = Mat_<Vec3b>::zeros(_height, _width);
    Scalar color(255, 255, 255);
    t_CurveSet::const_iterator cit = _curve_set.begin();
    t_CurveSet::const_iterator cit_end = _curve_set.end();
    for (; cit != cit_end; ++cit)
    {
        const t_PointSet &samples = (*cit)->get_samples();
        t_PointSet::const_iterator cit_p = samples.begin();
        t_PointSet::const_iterator cit_p_end = samples.end() - 1;
        for (; cit_p != cit_p_end; ++cit_p)
        {
            line(image, Point2d(cit_p->X(), cit_p->Y()),
                 Point2d((cit_p + 1)->X(), (cit_p + 1)->Y()), color);
        }
    }

    imshow(_file_name.c_str(), image);
    waitKey();
    imwrite(_file_name.c_str(), image);
    return true;
}
开发者ID:xiehao,项目名称:Image-Vectorization,代码行数:25,代码来源:curve_clustering.cpp

示例2: Point2d

  bool OCVLbp::InitializeLbp() {
    options.crop.clear();
    options.write_image = false;    

    options.lbptype = LBP;
    options.cslbp_threshold = 0.0;
      
    options.nneighbors = 8;
    options.neighborhood = LBP_8NEIGHBORS;
    options.radius = 2.0;

    options.overlapping_blocks = false;

    options.mapping = LBP_MAPPING_NONE;
    lbp_map.mapsize = 0;

    options.normalize_histogram = HISTNORM_NONE;
    
    options.do_funneling = false;    
    funneling_modelfile = "";

    options.do_illnorm = false;
    options.cropfirst = true;

    spoints_min = Point2d(0.0,0.0);
    spoints_max = Point2d(0.0,0.0);

    return true;
  }
开发者ID:aalto-cbir,项目名称:PicSOM,代码行数:29,代码来源:OCVLbp.C

示例3: sin

void WorldDrawer2d::DrawCircle(Object2d ** o1, float r,float g,float b){
	

	std::vector<Point2d> points;
	std::vector<int> topology;
	points.push_back(Point2d(0,0));
	for(int i = 0; i < 360; i++){
		float x = sin(3.1415f * i / 180) * 1;
		float y = cos(3.1415f * i / 180) * 1;
		points.push_back(Point2d(x,y));
	}
	topology.push_back(0);
	topology.push_back(1);
	topology.push_back(2);
	topology.push_back(2);
	topology.push_back(3);
	topology.push_back(0);
	for( int i = 3; i < points.size()-1; i++){
		topology.push_back(i);
		topology.push_back(i+1);
		topology.push_back(0);
	}
	topology.push_back(points.size()-1);
	topology.push_back(1);
	topology.push_back(0);
	(*o1) = new Object2d(points,topology);
	(*o1)->setcolor(r,g,b);
	cs1->objectAdd(*o1);


}
开发者ID:ClaudiaRogoz,项目名称:Projects,代码行数:31,代码来源:main.cpp

示例4: glutGet

/* metoda care creeaza un nou joc atunci cand acesta s-au tereminat */
void Game::restart() {
	int width = glutGet(GLUT_WINDOW_WIDTH);
	int height = glutGet(GLUT_WINDOW_HEIGHT);
	vector<Point2d> points;
	vector<int> topology;
	CoordinateSystem2d *cs = new CoordinateSystem2d();

	points.push_back(Point2d(-width, -height));
	points.push_back(Point2d(-width, height));
	points.push_back(Point2d(width, -height));
	points.push_back(Point2d(width, height));
	topology.push_back(0);
	topology.push_back(1);
	topology.push_back(2);
	topology.push_back(1);
	topology.push_back(2);
	topology.push_back(3);

	Object2d *obj = new Object2d(points, topology);
	obj->setcolor(0.5, 0.4, 0.3);
	
	cs_used.clear();
	cs->objectAdd(obj);
	cs_used.push_back(cs);
}	
开发者ID:alexandrudobrii,项目名称:MyProjects,代码行数:26,代码来源:Fusball.cpp

示例5: srand

bool c_CurveClustering::show_clusters(const t_ClusterSet &_cluster_set,
                                      const size_t _height,
                                      const size_t _width,
                                      const std::string _file_name)
{
    Mat_<Vec3b> image = Mat_<Vec3b>::zeros(_height, _width);
    srand(int(time(0)));

    t_ClusterSet::const_iterator cit = _cluster_set.begin();
    t_ClusterSet::const_iterator cit_end = _cluster_set.end();
    for (size_t i = 0; cit != cit_end; ++cit, ++i)
    {
        Scalar color(rand() % 255, rand() % 255, rand() % 255);
        std::vector<int>::const_iterator cit_i = cit->m_i_data.begin();
        std::vector<int>::const_iterator cit_i_end = cit->m_i_data.end();
        for (; cit_i != cit_i_end; ++cit_i)
        {
            const t_PointSet &samples = (*m_p_curve_set)[*cit_i]->get_samples();
            t_PointSet::const_iterator cit_p = samples.begin();
            t_PointSet::const_iterator cit_p_end = samples.end() - 1;
            for (; cit_p != cit_p_end; ++cit_p)
            {
                line(image, Point2d(cit_p->X(), cit_p->Y()),
                     Point2d((cit_p + 1)->X(), (cit_p + 1)->Y()), color);
            }
        }
    }
#if 1
    imshow(_file_name.c_str(), image);
    waitKey();
#endif
    imwrite(_file_name.c_str(), image);

    return true;
}
开发者ID:xiehao,项目名称:Image-Vectorization,代码行数:35,代码来源:curve_clustering.cpp

示例6: _mm_setr_pd

Point2d CameraPinhole::Project(const Point3d& p3d)
{
#ifdef __SSE__
    if(p3d.z==1.)
    {
        __m128d xy = _mm_setr_pd(p3d.x,p3d.y);
        xy=_mm_add_pd(_mm_setr_pd(cx,cy),_mm_mul_pd(xy,(__m128d){fx,fy}));
        return *(Point2d*)&xy;
    }
    else if(p3d.z>0)
    {
        double z_inv=1./p3d.z;
        return Point2d(fx*z_inv*p3d.x+cx,fy*z_inv*p3d.y+cy);
    }
    else return Point2d(-1,-1);
#else
    if(p3d.z==1.)
    {
        return Point2d(fx*p3d.x+cx,fy*p3d.y+cy);
    }
    else if(p3d.z>0)
    {
        double z_inv=1./p3d.z;
        return Point2d(fx*z_inv*p3d.x+cx,fy*z_inv*p3d.y+cy);
    }
    else return Point2d(-1,-1);
#endif
}
开发者ID:HANDS-FREE,项目名称:PIL,代码行数:28,代码来源:CameraImpl.cpp

示例7: ROS_ERROR

bool CameraProjections::GetOnImageCordinate(const vector<Point2f> contour,
		vector<Point> &resCountour)
{
	if (contour.size() < 1)
	{
		ROS_ERROR("Error In Programming");
		return false;
	}
	vector<Point2f> resC, resCountourd, contourShiftAndScale;
	vector<Point> resCI;

	for (uint32_t i = 0; i < contour.size(); i++)
	{
		Point2f f = Point2d(contour[i].x * 100., contour[i].y * 100.);
		f = Point2d(
				f.x / params.topView.scale->get()
						+ ((params.topView.width->get()
								/ params.topView.scale->get()) / 2.),
				(f.y / params.topView.scale->get())
						+ ((params.topView.width->get()
								/ params.topView.scale->get()) / 2.));
		contourShiftAndScale.push_back(f);
	}

	perspectiveTransform(contourShiftAndScale, resC, realHomoBack);

	for (uint32_t i = 0; i < resC.size(); i++)
	{
		resCI.push_back(Point((int) resC[i].x, (int) resC[i].y));
	}
	return _distorionModel.DistortP(resCI, resCountour);

}
开发者ID:NhatTanXT3,项目名称:humanoid_op_ros,代码行数:33,代码来源:CameraProjections.cpp

示例8: body

SpaceShip::SpaceShip() : body(Point2d(INITIAL_X, INITIAL_Y), Point2d(INITIAL_X+BODY_WIDTH, INITIAL_Y+BODY_HEIGHT)), 
						cannon(
							Point2d(INITIAL_X+(BODY_WIDTH-CANON_WIDTH)/2, INITIAL_Y+BODY_HEIGHT),
							Point2d(INITIAL_X+(BODY_WIDTH+CANON_WIDTH)/2, INITIAL_Y+BODY_HEIGHT+CANON_HEIGHT)
						),
						bullets(),
						lastTime(getMilliCount()),
						alive(true) {}
开发者ID:boconnell,项目名称:space-invaders,代码行数:8,代码来源:spaceship.cpp

示例9: getCorrespPoint

void LineHelpersTest::testPointLeftMiddleLeft()
{
	float weight = -1;
	Point2d res = getCorrespPoint(straightLine, Point2d(.5, 1), true, 1, weight, 0.01);
	double dist = norm(res - Point2d(.5, 1));
	QString err = getErrStr(Point2d(.5, 1), res, 1, weight);
	QVERIFY2((weight != 0 && dist < .1), err.toAscii().data());
}
开发者ID:bi0ha2ard,项目名称:aadc-2016,代码行数:8,代码来源:tst_linehelperstest.cpp

示例10: distanceTo

Point2d Point2d::rulerPoint(const Point2d& dir, float yoff) const
{
    float len = distanceTo(dir);
    if (len < _MGZERO) {
        return Point2d(x, y + yoff);
    }
    yoff /= len;
    return Point2d(x - (dir.y - y) * yoff, y + (dir.x - x) * yoff);
}
开发者ID:Vito2015,项目名称:vgcore,代码行数:9,代码来源:mgpnt.cpp

示例11: DrawFour

void WorldDrawer2d::MakeX(float r,float g, float b,Object2d* z1,Object2d* z2,int sens){
	DrawFour(0.25f,2.0f,&z1,r,g,b);
	DrawFour(0.25,2.0f,&z2,r,g,b);
	(z1)->rotateRelativeToPoint(Point2d(0.0f,0.0f),3.1415f/4);
	(z1)->translate(16.0f,0.0f);
	(z2)->rotateRelativeToPoint(Point2d(0.0f,0.0f),-3.1415f/4);
	(z2)->translate(16.0f,0.0f);

}
开发者ID:ClaudiaRogoz,项目名称:Projects,代码行数:9,代码来源:main.cpp

示例12: on_cdButton_clicked

void DialogRange::on_cdButton_clicked()
{
    //gp->calPlaneEquation();
    //gp->saveGroundParam();
    gp->readGroundParam();
    cout<<gp->getPointAtGround(Point2d(285,327))<<endl;
    cout<<gp->getPointAtGround(Point2d(285,294))<<endl;


}
开发者ID:him40813,项目名称:pix2qim,代码行数:10,代码来源:dialogrange.cpp

示例13: ArcWithDirectionAndAngle

	Arc ArcWithDirectionAndAngle(const Point2d &center, float radius, const vsr::cga2D::Vec &direction, float angle) {
		auto theta = std::atan2(direction[1], direction[0]);
		auto theta1 = theta - angle * 0.5f;
		auto theta2 = theta1 + angle;
		auto r = std::abs(radius);
		auto pt1 = center + Point2d(std::cos(theta1), std::sin(theta1)) * r;
		auto pt2 = center + Point2d(std::cos(theta2), std::sin(theta2)) * r;
		auto circle = Circle{center, radius};
		auto endpoints = std::signbit(radius) ? LineSegment{pt2, pt1} : LineSegment{pt1, pt2};
		return Arc{circle, endpoints};
	}
开发者ID:weshoke,项目名称:planar,代码行数:11,代码来源:primitives.cpp

示例14: backgroundColor

BasicButton::BasicButton(char* name, sf::Font &font, sf::Color textColor, sf::Color buttonColor, unsigned int size, Point2d position): 
	backgroundColor(buttonColor), buttonText (name,font,size)
{
	buttonText.setPosition(position.x,position.y);
	buttonText.setColor(textColor);
	double w = buttonText.getGlobalBounds().width;
	double h = buttonText.getGlobalBounds().height;
	Point2d textCenter = Point2d(buttonText.getGlobalBounds().left+0.5*w,buttonText.getGlobalBounds().top+0.5*h);
	hitbox.min = textCenter-Point2d(w*1.05+h*0.05,h*1.05+w*0.05);
	hitbox.max = textCenter+Point2d(w*1.05+h*0.05,h*1.05+w*0.05);
}
开发者ID:asgards1990,项目名称:UnderSky,代码行数:11,代码来源:BasicButton.cpp

示例15: GetRadianFromX

LineSegment LineSegment::PerpendicularLineSegment(double scale)
{
	double angle = GetRadianFromX();
	angle += M_PI / 2;
	Point2d mid = GetMiddle();
	double len = GetLength() / 2;
	len *= scale;
	double x1 = mid.x + cos(angle) * len;
	double y1 = mid.y + sin(angle) * len;
	double x2 = mid.x - cos(angle) * len;
	double y2 = mid.y - sin(angle) * len;
	return LineSegment(Point2d(x1, y1), Point2d(x2, y2));
}
开发者ID:AIS-Bonn,项目名称:humanoid_op_ros,代码行数:13,代码来源:LineSegment.cpp


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