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


C++ Pyramid类代码示例

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


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

示例1: create_pyramid

void create_pyramid(const Parameters &params, Pyramid &pyr,
                    const rod::dimage<float3> &img0,
                    const rod::dimage<float3> &img1)
{
    rod::base_timer &timer_total = rod::timers.gpu_add("Pyramid creation");

    size_t nlevels 
        = log2(std::min(img0.width(),img0.height())) - log2(params.start_res)+1;

    rod::base_timer *timer 
        = &rod::timers.gpu_add("level 0",img0.width()*img0.height(),"P");

    rod::dimage<float> luma0(img0.width(),img0.height()), 
                       luma1(img1.width(),img1.height());

    PyramidLevel &lvl0 = pyr.append_new(img0.width(), img0.height());

    luminance(&luma0, &img0);
    luminance(&luma1, &img1);

    copy_to_array(lvl0.img0, &luma0);
    copy_to_array(lvl0.img1, &luma1);

    timer->stop();

    int base_level = 0;

    for(int l=1; l<nlevels; ++l)
    {
        int w = round(img0.width()/((float)(1<<l))),
            h = round(img0.height()/((float)(1<<l)));

        std::clog << "Level " << l << ": " << w << "x" << h << std::endl;

        std::ostringstream ss;
        ss << "level " << l;

        rod::scoped_timer_stop sts(rod::timers.gpu_add(ss.str(), w*h,"P"));

        PyramidLevel &lvl = pyr.append_new(w,h);

        while((float)pyr[base_level].width/w * pyr[base_level].height/h>=1024)
            ++base_level;

        luma0.resize(w,h);
        luma1.resize(w,h);

        downsample(&luma0, pyr[base_level].img0, 
                   pyr[base_level].width, pyr[base_level].height);
        downsample(&luma1, pyr[base_level].img1,
                   pyr[base_level].width, pyr[base_level].height);

        copy_to_array(lvl.img0, &luma0);
        copy_to_array(lvl.img1, &luma1);
    }

    timer_total.stop();
}
开发者ID:Nuos,项目名称:Image-Morphing,代码行数:58,代码来源:pyramid.new.cpp

示例2: CalculateVolume

number CalculateVolume(const Pyramid& pyramid,
		Grid::VertexAttachmentAccessor<APosition>& aaPos) {
	vector3& a = aaPos[pyramid.vertex(0)];
	vector3& b = aaPos[pyramid.vertex(1)];
	vector3& c = aaPos[pyramid.vertex(2)];
	vector3& d = aaPos[pyramid.vertex(3)];
	vector3& top = aaPos[pyramid.vertex(4)];

	return CalculateVolumePyramid(a, b, c, d, top);
}
开发者ID:marscher,项目名称:tkd_generator,代码行数:10,代码来源:volume_calculation.cpp

示例3: main

int main() {
	sf::ContextSettings set;
	set.antialiasingLevel = 8;
	sf::Window w(sf::VideoMode(700, 700), "ogl", sf::Style::Default, set);
	glewExperimental = true;
	glewInit();
	Context gl;
	gl.ClearColor(0.0, 0.0, 0.0, 1.0);
	gl.Enable(Capability::DepthTest);
	gl.Enable(Capability::CullFace);
	gl.Enable(Capability::Blend);
	w.setMouseCursorVisible(false);

	Pyramid pyramid { w };

	bool running = true;
	while(running) {
		sf::Event e;
		while(w.pollEvent(e)){
			if(e.type == sf::Event::Closed){ running = false; }
			if(e.type == sf::Event::KeyPressed) {
				switch(e.key.code) {
				case sf::Keyboard::Escape:
					running = false;
					break;
				case sf::Keyboard::W: case sf::Keyboard::Up:
					camera.forward();
					break;
				case sf::Keyboard::A: case sf::Keyboard::Left:
					camera.left();
					break;
				case sf::Keyboard::S: case sf::Keyboard::Down:
					camera.back();
					break;
				case sf::Keyboard::D: case sf::Keyboard::Right:
					camera.right();
					break;
				default:
					break;
				}
				}
			if(e.type == sf::Event::MouseMoved) {
					//idk
			}
		}

		pyramid.update();
		pyramid.draw(gl);
		gl.Clear().ColorBuffer().DepthBuffer();
		w.display();
	}
	return 0;
}
开发者ID:pm990320,项目名称:OpenGLLearning,代码行数:53,代码来源:main.cpp

示例4: switch

Ogre::ManualObject* BlockFactory::createBlock(
	Map::PrintType cellType,
	unsigned int i,
	unsigned int j,
	double scale
) {

	stringstream genName;
	genName << "manualBlock_" << i << "_" << j;

	switch (cellType) {
		case Map::EMPTY:
			return NULL;
			break;
		case Map::BREAKABLE: {
			Pyramid *myPyramid = new Pyramid(
				mSceneMgr->createManualObject(genName.str()),
				Block::COMPLETE,
				-(scale/2),
				-(scale/6),
				-(scale/2),
				scale,
				scale/2,
				scale
			);
			return myPyramid->GetManualBlock();
			break;
		}
		case Map::UNBREAKABLE: {
			Cube *myCube = new Cube(
				mSceneMgr->createManualObject(genName.str()),
				Block::COMPLETE,
				-(scale/2),
				-(scale/6),
				-(scale/2),
				scale,
				scale/3,
				scale
			);
			return myCube->GetManualBlock();
			break;
		}
		default:
			break;
	}

	//TODO Exception?
	Ogre::LogManager::getSingletonPtr()->logMessage("WARNING No representation for this kind of Block");
	std::cerr << cellType << std::endl;
	return NULL;
}
开发者ID:Target6,项目名称:pairOculus,代码行数:51,代码来源:BlockFactory.cpp

示例5: shroudLow

void Microphone::setUprightHeight (float h) {
	float shift = h - uH;
	tH += shift; uH = tH * 0.58436f;

	Cone			upright	 (uH * 0.21127f + 2 * uG, uR * 0.66667f, uR * 0.66667f, 24),
					shroudLow(uH * 0.21127f, uR, uR, 24),
					shroudHi (uH - upright.getHeight() - uH * 0.084537f, uR, uR, 24),
					bridge   (uH * 0.084537f,uR * 0.66667f, uR * 0.41667f, 24);

	Pyramid			handleBridgeUp	(uH * 0.09155f, uR * 0.653f, hI, uR * 0.653f, hI),
					handleBridgeDown(uH * 0.077f,   uR * 0.653f, hI, uR * 0.653f, hI),
					handle			(uH * 0.7598f,  uR * 0.792f, uR * 0.5418f, uR * 0.5418f, uR * 0.5418f, uR * 0.125f),
					handleTop		(uH * 0.05647f, uR * 0.792f, uR * 0.5418f, uR * 0.792f,  uR * 0.5418f,-uR * 0.3542f);

	upright.Fly(bH);
	shroudLow.Fly(tH * 0.0823f);
	shroudHi.Fly(shroudLow.getPosition().z + shroudLow.getHeight() + uG);
	bridge.Fly(shroudHi.getPosition().z + shroudHi.getHeight());

	handleBridgeUp.Fly(tH * 0.46f);
	handleBridgeUp.Follow(bR * 0.2f);
	handleBridgeDown.Fly(tH * 0.15f);
	handleBridgeDown.Follow(handleBridgeUp.getPosition().x);
	handle.Translate(bR * 0.306f, bR * 0.0059f, tH * 0.547f);
	handle.Pitch((FLOAT)M_PI);
	handle.Yaw((FLOAT)M_PI_2);
	handleTop.Translate(handle.getPosition().x, handle.getPosition().y, handle.getPosition().z);
	handleTop.Yaw((FLOAT)M_PI_2);

	replaceMesh(MIC_UPRIGHT, upright);
	replaceMesh(MIC_SHROUD_LOW, shroudLow);
	replaceMesh(MIC_SHROUD_HI, shroudHi);
	replaceMesh(MIC_BRIDGE, bridge);
	replaceMesh(MIC_HANDLE_BU, handleBridgeUp);
	replaceMesh(MIC_HANDLE_BD, handleBridgeDown);
	replaceMesh(MIC_HANDLE, handle);
	replaceMesh(MIC_HANDLE_TOP, handleTop);

	for (int i = MIC_HEAD; i < PARTS_NUM; i++){
		micParts[i]->Translate(	micParts[i]->getPosition().x,
								micParts[i]->getPosition().y,
								bridge.getPosition().z + bridge.getHeight() + hR);
		recalcMeshVertices((MIC_PART)i, *micParts[i]);
	}
}
开发者ID:vrishe,项目名称:3d-editor-08-a,代码行数:45,代码来源:Microphone.cpp

示例6: setHandleIndent

void Microphone::setHandleIndent (float i) {
	float shift = i - hI;
	hI = i;
	Pyramid			handleBridgeUp	(uH * 0.09155f, uR * 0.653f, hI * 1.5f, uR * 0.653f, hI * 1.5f),
					handleBridgeDown(uH * 0.077f,   uR * 0.653f, hI * 1.5f, uR * 0.653f, hI * 1.5f);
	handleBridgeUp.Fly(tH * 0.46f);
	handleBridgeUp.Follow(uR + hI / 2.f);
	handleBridgeDown.Fly(tH * 0.15f);
	handleBridgeDown.Follow(handleBridgeUp.getPosition().x);
	replaceMesh(MIC_HANDLE_BU, handleBridgeUp);
	replaceMesh(MIC_HANDLE_BD, handleBridgeDown);

	for (int i = MIC_HANDLE; i < MIC_HEAD; i++){
		micParts[i]->Translate(	micParts[i]->getPosition().x + shift,
								micParts[i]->getPosition().y,
								micParts[i]->getPosition().z);
		recalcMeshVertices((MIC_PART)i, *micParts[i]);
	}
}
开发者ID:vrishe,项目名称:3d-editor-08-a,代码行数:19,代码来源:Microphone.cpp

示例7: main

int main()
{

  cout << fixed << showpoint << setprecision(2);

  Cylinder one;
  cout << "Enter cylinder height and radius >>> ";
  cin >> one;
  cout << "The cylinder volume is " << one.volume(one) << endl;
  cout << "The cylinder surface area is " << one.surface_area(one) << endl;
  cout << one;

  Sphere two;
  cout << "Enter sphere radius >>> ";
  cin >> two.radius;
  cout << "The sphere volume is " << two.volume(two) << endl;
  cout << "The sphere surface area is " << two.surface_area(two) << endl;
  cout << two.radius << endl;

  Prism three;
  cout << "Enter rectangular prism base length, height, and width >>> ";
  cin >> three;
  cout << "The rectangular prism volume is " << three.volume(three) << endl;
  cout << "The rectangular prism surface area is " << three.surface_area (three) << endl;
  cout << three;

  Cone four;
  cout << "Enter cone height and radius >>> ";
  cin >> four;
  cout << "The cone volume is " << four.volume(four) << endl;
  cout << "The cone surface area is " << four.surface_area(four) << endl;
  cout << four;

  Pyramid five;
  cout << "Enter pyramid base side length and height >>> ";
  cin >> five;
  cout << "The pyramid volume is " << five.volume(five) << endl;
  cout << "The pyramid surface area is " << five.surface_area(five) << endl;
  cout << five;

  return 0;
}
开发者ID:ShadowfeindX,项目名称:codingground,代码行数:42,代码来源:main.cpp

示例8: Pyramid

void TwoBones::SetBoneHierarchy()
{
    // setup the bone model, this case we are using pyramid
    // todo - create a cool Bone Object, ball(drk blue) + pyramid arm (dark yellow)
    Pyramid* pPyramid = new Pyramid();
    pPyramid->loadTexture();
    pPyramid->createVAO();

    // Get the manager
    GraphicsObjectManager *goMgr = GraphicsObjectManager::getInstance();

    // here we insert bones directly into tree - 
    // vs calling goMgr->addObject which inserts every node with root as parent FIXME
    PCSTree* tree = goMgr->getTree();
    PCSNode* root = tree->getRoot();

    // create two bones
    PyramidObject* p0 = new PyramidObject( "name", pPyramid );
    p0->setIndex(0);
    p0->setName("Bone_0");
    tree->insert(p0, root);
    
    p0->setPos( Vect(0.0f, 0.0f, 0.0f) );
    p0->setLightPos( Vect(50.0f, 50.0f, 0.0f) );
    p0->setLightColor( Vect(1.5f, 0.5f, 0.5f) );   // RED
    

    PyramidObject* p1 = new PyramidObject( "name", pPyramid );
    p1->setIndex(1);
    p1->setName("Bone_1");
    tree->insert(p1, p0);

    p1->setPos( Vect(1.0f, 1.0f, 0.0f) );
    p1->setLightPos( Vect(50.0f, 50.0f, 0.0f) );
    p1->setLightColor( Vect(0.5f, 1.5f, 0.5f) );   // Green

    // set the first bone to pass into updateSkeleton in GlobalState.cpp's GameLoop()
    this->SetFirstBone(p0);

    // Debug
    tree->dumpTree();
}
开发者ID:mdubovoy,项目名称:Animation_System,代码行数:42,代码来源:TwoBones.cpp

示例9: smooth_helper

void smooth_helper(Pyramid& p, smooth_level_fun smooth, const size_t top_level)
{
    using boost::irange;
    using boost::adaptors::reversed;
    using namespace std;

    auto cnt = 0;
    auto v_copy = ImagePyramid{p.get_value2()};
    auto w_copy = LinkPyramid{p.get_links()};

    auto levels = irange(0ul, top_level + 1);

    for (const auto lv : levels | reversed) {
        cout << "Smoothing Level " << lv << " ... ";
        cnt += smooth(v_copy, w_copy, lv);
        cout << endl;
    }
    p.set_result(v_copy.bottom());
    cout << "Done." << endl;
    cout << "Number of Segments: " << cnt << endl;
}
开发者ID:mforner,项目名称:wpl-polsar,代码行数:21,代码来源:Smoothing.cpp

示例10: main

/**
 * @function main
 */
int main( int argc, char* argv[] ) {

    // Read image
    if( argc < 2 )
    { printf("You moron! I need an image \n"); return -1; }

    // Load image
    cv::Mat img = cv::imread( argv[1], -1 );

    // Create a Pyramid object
    Pyramid pyr;

    // Apply REDUCE 4 times to build the Gaussian Pyramid
   
    GP.resize(4);
    GP[0] = img.clone();
    GP[1] = pyr.Reduce( GP[0] );
    GP[2] = pyr.Reduce( GP[1] );
    GP[3] = pyr.Reduce( GP[2] );     


    // Write images
    imwrite("proj5-1-1-G0.png", GP[0]);    
    imwrite("proj5-1-1-G1.png", GP[1]);    
    imwrite("proj5-1-1-G2.png", GP[2]);    
    imwrite("proj5-1-1-G3.png", GP[3]);  

    // Show results
    cv::namedWindow("G0", CV_WINDOW_NORMAL );
    cv::namedWindow("G1", CV_WINDOW_NORMAL );
    cv::namedWindow("G2", CV_WINDOW_NORMAL );
    cv::namedWindow("G3", CV_WINDOW_NORMAL );     

    imshow( "G0", GP[0] );
    imshow( "G1", GP[1] );
    imshow( "G2", GP[2] );
    imshow( "G3", GP[3] );

    cv::waitKey(0);  
}
开发者ID:ana-GT,项目名称:CVHacking,代码行数:43,代码来源:proj5-1-1.cpp

示例11: pow

void SimpleWaldboost::createPyramids(cv::Size base, cv::Size min, int octaves, int levelsPerOctave)
{
	float scale = pow(2.0f, 1.0f / levelsPerOctave);
	_pyramids.clear();

	bool isLandscape = _image.cols > _image.rows;
	cv::Size newSize;

	for (int i = 0; i < octaves; ++i) 
	{
		cv::Size size = base;
		size.width /= static_cast<float>(i + 1);
		size.height /= static_cast<float>(i + 1);

		float scale = isLandscape ? _image.cols / size.width : _image.rows / size.width;									

		newSize.width = _image.cols / scale;
		newSize.height = _image.rows / scale;		
		
		Pyramid p;		
		for (int j = 0; j < levelsPerOctave; ++j)
		{
			PyramidImage pi;
							
			cv::resize(_image, pi.image, newSize);	
			pi.scale = scale;

			p.push_back(pi);
		
			size.width /= scale;
			size.height /= scale;

			if (size.width <= min.width || size.height <= min.height)
				break;
		}

		_pyramids.push_back(p);
	}
	
}
开发者ID:mmaci,项目名称:vutbr-fit-object-detection,代码行数:40,代码来源:SimpleWaldboost.cpp

示例12: stats_downward_links

Stats<floating_t> stats_downward_links(const Pyramid& p, const Node& node)
{
    using accumulators::extract::sum;
    using accumulators::stat_acc;
    namespace tag = accumulators::tag;
    using accumulators::left;

    auto acc = stat_acc<floating_t>{tag::tail<left>::cache_size = 16};
    for (const auto& desc : common::descs(node)) {
        acc(p.get_links()(node, desc));
    }
    return Stats<floating_t>{"down links", node.level, acc};
}
开发者ID:mforner,项目名称:wpl-polsar,代码行数:13,代码来源:StatAnalysis.cpp

示例13: checkCollisionPir

/*
 * Check for collisions with a pyramid. If we are return true
 * otherwise return false.
 */
bool Cube::checkCollisionPir(Pyramid p)
{
	float r0sqr = getRadius() * getRadius();
	float r1sqr = p.getRadius() * p.getRadius();

	float distX = getCenter().x - p.getCenter().x;
	float distY = getCenter().y - p.getCenter().y;
	float distZ = getCenter().z - p.getCenter().z;

	// Since we already need to square these, we won't need to take the absolute value
	// to accurately compare them to the radii
	distX *= distX;
	distY *= distY;
	distZ *= distZ;

	float sqrDist = (distX+distY+distZ);

	if((r0sqr + r1sqr) > sqrDist )
	{
		return true;
	}
	
	return false;
}
开发者ID:Euden,项目名称:OpenGL-University-C---Assessment,代码行数:28,代码来源:Cube.cpp

示例14: TileMismatch

int WangTilesProcessor::TileMismatch(const TilePack & tiles,
                                     const Pyramid & input)
{
    int result = -1;

    for(int lev = 0; lev < input.NumLevels(); lev++)
    {
        if(TileMismatch(tiles, input[lev]))
        {
            result = lev;
            break;
        }
    }

    return result;
}
开发者ID:1iyiwei,项目名称:tile-texture-map,代码行数:16,代码来源:WangTilesProcessor.cpp

示例15: print_stats

void print_stats(const Pyramid& p, level_t lv)
{
    using namespace stats;
    if (lv > 0) {
        std::cout << std::endl << analyse_weights(p.get_links(), lv);
    }
    std::cout << std::endl << detail::analyse("area", p.get_area()[lv]);
    std::cout << std::endl << detail::analyse("looks", p.get_looks()[lv]);
    std::cout << std::endl << detail::analyse("var", p.get_var()[lv]);

    std::cout << std::endl << detail::analyse("v1_00", p.get_value1()[lv], 0);
    std::cout << std::endl << detail::analyse("v1_11", p.get_value1()[lv], 1);
    std::cout << std::endl << detail::analyse("v1_22", p.get_value1()[lv], 2);

    std::cout << std::endl << detail::analyse("v2_00", p.get_value2()[lv], 0);
    std::cout << std::endl << detail::analyse("v2_11", p.get_value2()[lv], 1);
    std::cout << std::endl << detail::analyse("v2_22", p.get_value2()[lv], 2);

    std::cout << std::endl;
}
开发者ID:mforner,项目名称:wpl-polsar,代码行数:20,代码来源:StatAnalysis.cpp


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