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


C++ Drawable::SetScale方法代码示例

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


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

示例1: Drawable_initialize

static VALUE Drawable_initialize(int argc, VALUE *argv, VALUE vSelf) {
	// Get C++ object pointer from vSelf
	Drawable *pSelf;
	Data_Get_Struct(vSelf, Drawable, pSelf);
	if(argc == 0) {
		// Nothing to initialize
	} else if(argc >= 1 && argc <= 5 && (argc < 5 || IS(argv[4], g_cColor))) {
		if(argc >= 1)
			pSelf->SetLeft((float)NUM2DBL(argv[0]));
		if(argc >= 2)
			pSelf->SetTop((float)NUM2DBL(argv[1]));
		if(argc >= 3) {
			if(ISNUM(argv[2])) {
				float f = (float)NUM2DBL(argv[2]);
				pSelf->SetScale(f, f);
			} else if(IS(argv[2], rb_cArray)) {
				float x = (float)NUM2DBL(rb_ary_entry(argv[2], 0));
				float y = (float)NUM2DBL(rb_ary_entry(argv[2], 1));
				pSelf->SetScale(x, y);
			}
		}
		if(argc >= 4)
			pSelf->SetRotation((float)NUM2DBL(argv[3]));
		if(argc >= 5)
			pSelf->SetColor(*(Color *)DATA_PTR(argv[4]));
	} else
		rb_raise(rb_eTypeError, "wrong argument type(s)");
	return vSelf;
}
开发者ID:freemaul,项目名称:SFML,代码行数:29,代码来源:sfDrawable.cpp

示例2: Drawable_set_scale

static VALUE Drawable_set_scale(VALUE vSelf, VALUE vScale) {
	// Get C++ object pointer from vSelf
	Drawable *pSelf;
	Data_Get_Struct(vSelf, Drawable, pSelf);
	if(ISNUM(vScale)) {
		float f = (float)NUM2DBL(vScale);
		pSelf->SetScale(f, f);
	} else if(IS(vScale, rb_cArray)) {
		float x = (float)NUM2DBL(rb_ary_entry(vScale, 0));
		float y = (float)NUM2DBL(rb_ary_entry(vScale, 1));
		pSelf->SetScale(x, y);
	} else
		rb_raise(rb_eTypeError, "wrong argument type(s)");
	return Qnil;
}
开发者ID:freemaul,项目名称:SFML,代码行数:15,代码来源:sfDrawable.cpp

示例3: videocallback

void videocallback(IplImage *image)
{
    bool flip_image = (image->origin?true:false);
    if (flip_image) {
        cvFlip(image);
        image->origin = !image->origin;
    }

    if (init) {
        init = false;
        cout << "Loading calibration: " << calibrationFilename.str();
        if (fernEstimator.setCalibration(calibrationFilename.str(), image->width, image->height)) {
            cout << " [Ok]" << endl;
        } else {
            fernEstimator.setResolution(image->width, image->height);
            cout << " [Fail]" << endl;
        }
        double p[16];
        fernEstimator.camera().GetOpenglProjectionMatrix(p, image->width, image->height);
        GlutViewer::SetGlProjectionMatrix(p);
        d.SetScale(10);
        gray = cv::Mat(image);
    }

    if (image->nChannels == 3) {
        cv::Mat img = cvarrToMat(image);
        cv::cvtColor(img, gray, CV_RGB2GRAY);
    }
    else {
        gray = image;
    }

    vector<CvPoint2D64f> ipts;
    vector<CvPoint3D64f> mpts;

    fernDetector.findFeatures(gray, true);
    fernDetector.imagePoints(ipts);
    fernDetector.modelPoints(mpts, true);
    double test = fernDetector.inlierRatio();
    if (test > 0.15 && mpts.size() > 4) {
        fernEstimator.calculateFromPointCorrespondences(mpts, ipts);
    }

    GlutViewer::DrawableClear();
    Pose pose = fernEstimator.pose();
    pose.GetMatrixGL(d.gl_mat);
    GlutViewer::DrawableAdd(&d);

    if (flip_image) {
        cvFlip(image);
        image->origin = !image->origin;
    }
}
开发者ID:campbeb6,项目名称:RedhawkQuad,代码行数:53,代码来源:SampleMarkerlessDetector.cpp


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