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


C++ PolyLine::push_back方法代码示例

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


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

示例1: draw

// Render
void KinectApp::draw()
{

	// Clear window
	gl::setViewport( getWindowBounds() );
	gl::clear( Colorf( 0.1f, 0.1f, 0.1f ) );

	// We're capturing
	if ( mKinect->isCapturing() ) {

		// Set up camera for 3D
		gl::setMatrices( mCamera );

		// Move skeletons down below the rest of the interface
		gl::pushMatrices();
		gl::translate( 0.0f, -0.62f, 0.0f );

		// Iterate through skeletons
		uint32_t i = 0;
		for ( vector<Skeleton>::const_iterator skeletonIt = mSkeletons.cbegin(); skeletonIt != mSkeletons.cend(); ++skeletonIt, i++ ) {

			// Skeleton is valid when all joints are present
			if ( skeletonIt->size() == JointName::NUI_SKELETON_POSITION_COUNT ) {

				// Set color
				gl::color( mKinect->getUserColor( i ) );

				// Draw joints
				for ( Skeleton::const_iterator jointIt = skeletonIt->cbegin(); jointIt != skeletonIt->cend(); ++jointIt ) {
					gl::drawSphere( jointIt->second * Vec3f( -1.0f, 1.0f, 1.0f ), 0.025f, 16 );
				}

				// Draw body
				for ( vector<vector<JointName> >::const_iterator segmentIt = mSegments.cbegin(); segmentIt != mSegments.cend(); ++segmentIt ) {
					drawSegment( * skeletonIt, * segmentIt );
				}

			}

		}

		// Switch to 2D
		gl::popMatrices();
		gl::setMatricesWindow( getWindowSize(), true );

		// Draw depth and video textures
		gl::color( Colorf::white() );
		if ( mDepthSurface ) {
			Area srcArea( 0, 0, mDepthSurface.getWidth(), mDepthSurface.getHeight() );
			Rectf destRect( 265.0f, 15.0f, 505.0f, 195.0f );
			gl::draw( gl::Texture( mDepthSurface ), srcArea, destRect );
		}
		if ( mVideoSurface ) {
			Area srcArea( 0, 0, mVideoSurface.getWidth(), mVideoSurface.getHeight() );
			Rectf destRect( 508.0f, 15.0f, 748.0f, 195.0f );
			gl::draw( gl::Texture( mVideoSurface ), srcArea, destRect);
		}

	}

	// Check audio data
	if ( mData != 0 ) {

		// Get dimensions
		int32_t dataSize = mInput->getDataSize();
		float scale = 240.0f / (float)dataSize;
		float height = 180.0f;
		Vec2f position( 751.0f, 15.0f );

		// Draw background
		gl::color( ColorAf::black() );
		Rectf background( position.x, position.y, position.x + 240.0f, position.y + 180.0f );
		gl::drawSolidRect( background );

		// Draw audio input
		gl::color( ColorAf::white() );
		PolyLine<Vec2f> mLine;
		for ( int32_t i = 0; i < dataSize; i++ ) {
			mLine.push_back( position + Vec2f( i * scale, math<float>::clamp( mData[ i ], -1.0f, 1.0f ) * height * 0.5f + height * 0.5f ) );
		}
		if ( mLine.size() > 0 ) {
			gl::draw( mLine );
		}

	}

	// Draw the interface
	params::InterfaceGl::draw();

}
开发者ID:momo-the-monster,项目名称:Cinder-KinectSdk,代码行数:91,代码来源:KinectApp.cpp

示例2: main

int main(int argc, char *argv[])
{
	Figure f;

	// get some coordinates ready to use in a lot of objects
	
	Coordinate *a = new Coordinate (500,500);
	Coordinate *b = new Coordinate (1500,1500);

	// draw a polyline

	PolyLine *polyline = new PolyLine(a, b);
	polyline->push_back(new Coordinate(2000,1500));
	polyline->setLineStyle(Attributes::Dotted);
	
	// give the polyline arrows
	
	Arrow arr;
	arr.setType(Arrow::ClosedPointed);
	arr.setStyle(Arrow::Filled);

	polyline->setBackwardArrowBool(1);
	polyline->setBackwardArrow(arr);
	
	polyline->setForwardArrowBool(1);
	polyline->setForwardArrow(arr);
	
	// polyline is ready, keep it in the fig
	
	f.push_back(polyline);
	
	// an example box using the same coordinates

	Box *box = new Box(a, b);
	box->setThickness(2);
	f.push_back(box);
	
	// an ellipse in that box

	RadiiEllipse *re = new RadiiEllipse(new Coordinate(1000, 1000), new Coordinate(500, 200));
	f.push_back(re);
	
	// another ellipse in that box

	DiameterEllipse *de = new DiameterEllipse(new Coordinate(500, 800), new Coordinate(1500, 1200));
	f.push_back(de);
	
	// a circle defined by a radius, in the box

	RadiusCircle *rc = new RadiusCircle(new Coordinate(1000, 1000), 500);
	f.push_back(rc);
	
	// a circle defined by two points defining its radius

	DiameterCircle *dc = new DiameterCircle(a, b);
	f.push_back(dc);
	
	// some text

	Text* text = new Text(new Coordinate(1900, 900), "fig++");
	text->setFontSize(50);
	f.push_back(text);

	// an arc defined by its three defining points
	// first point comes first

	Arc* arc = new Arc(new Coordinate(1000, 1000), new Coordinate(2000, 1000), new Coordinate(2000, 2000));
	f.push_back(arc);
	
	// this is what's useful: putting something on an arbitrary place

	for (float x = 0; x <= 314; x=x+19.625) {
		PolyLine *l = 
			new PolyLine( 
				new Coordinate(
					(int)(1500.0+500.0*cos(x/100)),
					(int)(1500.0+500.0*sin(x/100))
				),
				new Coordinate(
					(int)(1500.0+1000.0*cos(x/100)),
					(int)(1500.0+1000.0*sin(x/100))
				)
			);
		l->setForwardArrowBool(1);
		arr.setType(Arrow::ClosedIntended);
		l->setForwardArrow(arr);
		f.push_back(l);
	}
	
	// a vector of coordinates

	std::vector<Coordinate *> vc;

	vc.push_back( new Coordinate (2500, 500) );
	vc.push_back( new Coordinate (3000, 500) );
	vc.push_back( new Coordinate (3000, 1000) );
	vc.push_back( new Coordinate (3500, 1000) );
	vc.push_back( new Coordinate (3500, 1500) );
	vc.push_back( new Coordinate (3000, 1500) );
	vc.push_back( new Coordinate (3000, 2000) );
//.........这里部分代码省略.........
开发者ID:aliekens,项目名称:cpfig,代码行数:101,代码来源:demo.cpp

示例3: draw

void Puppeteer::draw()
{
    // ----------------------------debug

    if (Constants::Debug::DRAW_PUPPETEER_BOUNDS) {
        Vec3f origin = Vec3f::zero();
        PolyLine<Vec3f> boundsL;
        boundsL.push_back(origin - axisVert * armLenL);
        boundsL.push_back(origin - axisVert * armLenL + axisHoriz * armLenL);
        boundsL.push_back(origin + axisVert * armLenL + axisHoriz * armLenL);
        boundsL.push_back(origin + axisVert * armLenL);
        boundsL.push_back(origin - axisVert * armLenL);
        boundsL.push_back(origin - axisVert * armLenL + normal * armLenL); //
        boundsL.push_back(origin - axisVert * armLenL + normal * armLenL + axisHoriz * armLenL);
        boundsL.push_back(origin + axisVert * armLenL + normal * armLenL + axisHoriz * armLenL);
        boundsL.push_back(origin + axisVert * armLenL + normal * armLenL);
        boundsL.push_back(origin - axisVert * armLenL + normal * armLenL);

        PolyLine<Vec3f> boundsR;
        boundsR.push_back(origin - axisVert * armLenR);
        boundsR.push_back(origin - axisVert * armLenR - axisHoriz * armLenR);
        boundsR.push_back(origin + axisVert * armLenR - axisHoriz * armLenR);
        boundsR.push_back(origin + axisVert * armLenR);
        boundsR.push_back(origin - axisVert * armLenR);
        boundsR.push_back(origin - axisVert * armLenR + normal * armLenR); //
        boundsR.push_back(origin - axisVert * armLenR + normal * armLenR - axisHoriz * armLenR);
        boundsR.push_back(origin + axisVert * armLenR + normal * armLenR - axisHoriz * armLenR);
        boundsR.push_back(origin + axisVert * armLenR + normal * armLenR);
        boundsR.push_back(origin - axisVert * armLenR + normal * armLenR);

        gl::pushMatrices();

        MayaCamUI* mayaCam = Constants::mayaCam();
        gl::setMatrices(mayaCam->getCamera());

        float scale = 1.0f;
        // original bounding boxes
        gl::color(Color(0.5f, 0.5f, 0.5f));
        gl::pushModelView();
        gl::translate(shoulderL);
        gl::draw(boundsL);
        gl::popModelView();

        gl::pushModelView();
        gl::translate(shoulderR);
        gl::draw(boundsR);
        gl::popModelView();

        // normalized bound boxes
        gl::color(Color(0, 0, 1));
        gl::pushModelView();
        gl::translate(-.5f, 0, 0);
        gl::scale(scale, scale, scale);
        gl::rotate( Quatf(normalizationMatrix) );
        gl::draw(boundsL);
        gl::popModelView();

        gl::pushModelView();
        gl::translate(-.5f, 0, 0);
        gl::scale(scale, scale, scale);
        gl::drawCube(handL, Vec3f(0.1f, 0.1f, 0.1f));
        gl::popModelView();

        gl::color(Color(0, 1, 0));
        gl::pushModelView();
        gl::translate(.5f, 0, 0);
        gl::scale(scale, scale, scale);
        gl::rotate( Quatf(normalizationMatrix) );
        gl::draw(boundsR);
        gl::popModelView();

        gl::pushModelView();
        gl::translate(.5f, 0, 0);
        gl::scale(scale, scale, scale);
        gl::drawCube(handR, Vec3f(0.1f, 0.1f, 0.1f));
        gl::popModelView();

        gl::popMatrices();

        gl::color( Color(1, 1, 1));
    }

    arduino->draw();
}
开发者ID:guojenman,项目名称:DisKinect,代码行数:84,代码来源:Puppeteer.cpp


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