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


C++ scaling函数代码示例

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


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

示例1: pl_collisionshape_SetScaling

void pl_collisionshape_SetScaling(PlCollisionShape* cshape, PlVector3* cscaling)
{
	CAST_ASSERT(cshape,btCollisionShape*,shape);

	btVector3 scaling(cscaling[0],cscaling[1],cscaling[2]);
	shape->setLocalScaling(scaling);	
}
开发者ID:cessationoftime,项目名称:BulletVapi,代码行数:7,代码来源:Bullet-C-API.cpp

示例2: sizeof

void ImportObjSetup::initPhysics()
{
	m_guiHelper->setUpAxis(2);
	this->createEmptyDynamicsWorld();
	m_guiHelper->createPhysicsDebugDrawer(m_dynamicsWorld);
	m_dynamicsWorld->getDebugDrawer()->setDebugMode(btIDebugDraw::DBG_DrawWireframe);
	const char* fileName = "samurai_monastry.obj";
    char relativeFileName[1024];
	const char* prefix[]={"./data/","../data/","../../data/","../../../data/","../../../../data/"};
	int prefixIndex=-1;
	{
		
		int numPrefixes = sizeof(prefix)/sizeof(char*);
		
		for (int i=0;i<numPrefixes;i++)
		{
			FILE* f = 0;
			sprintf(relativeFileName,"%s%s",prefix[i],fileName);
			f = fopen(relativeFileName,"r");
			if (f)
			{
				fclose(f);
				prefixIndex = i;
				break;
			}
		}
	}
	
	if (prefixIndex<0)
		return;
	
	btVector3 shift(0,0,0);
	btVector3 scaling(10,10,10);
//	int index=10;
	
	{
		
		std::vector<tinyobj::shape_t> shapes;
		std::string err = tinyobj::LoadObj(shapes, relativeFileName, prefix[prefixIndex]);
		
		GLInstanceGraphicsShape* gfxShape = btgCreateGraphicsShapeFromWavefrontObj(shapes);
		
		btTransform trans;
		trans.setIdentity();
		trans.setRotation(btQuaternion(btVector3(1,0,0),SIMD_HALF_PI));
		
		btVector3 position = trans.getOrigin();
		btQuaternion orn = trans.getRotation();
		
		btVector3 color(0,0,1);
		
		
		int shapeId = m_guiHelper->getRenderInterface()->registerShape(&gfxShape->m_vertices->at(0).xyzw[0], gfxShape->m_numvertices, &gfxShape->m_indices->at(0), gfxShape->m_numIndices);
		
		//int id = 
		m_guiHelper->getRenderInterface()->registerGraphicsInstance(shapeId,position,orn,color,scaling);

	
	}
}
开发者ID:GCodergr,项目名称:bullet3,代码行数:60,代码来源:ImportObjExample.cpp

示例3: createDirich

p_struct createDirich(std::vector<double> alpha, std::size_t numSamples) {
  arma::mat R(numSamples, alpha.size()); //careful because of fortran <-> c-order!
  typedef std::gamma_distribution<double> Distribution;

  std::vector<int> seeds(alpha.size());
  std::seed_seq({0}).generate(seeds.begin(), seeds.end());

  std::vector<std::future<int> > answers(alpha.size());

  for (std::size_t i = 0; i < alpha.size(); ++i) {
    std::default_random_engine rSeedEngine_(seeds[i]);
    auto generator = std::bind(Distribution(alpha[i]), rSeedEngine_);
    answers[i] = std::async(std::launch::deferred,&writeToArray<decltype(R.begin()), decltype(generator)>, R.begin() + numSamples * i, R.begin() + numSamples * (i + 1), generator);
  }
  for (int i = 0; i < alpha.size(); ++i) {
    answers[i].get();
  }
  //normalize for every sample:
  arma::mat scaling = arma::sum(R,1);
  for (std::size_t i = 0; i < numSamples; ++i) {
    R.row(i) /= arma::as_scalar(scaling(i));
  }
  p_struct p;
  p.p2 = 1 - arma::as_scalar(arma::sum(arma::max(R, 1))) / numSamples;
  arma::mat alphaW(alpha.data(), alpha.size(), 1, false);
  p.p1 = 1 - arma::as_scalar(arma::max(alphaW) / arma::sum(alphaW));
  //arma::sum(R, 1).print();
  //std::cout << "blub" << std::endl;
  return p;
}
开发者ID:buotex,项目名称:pknn_al,代码行数:30,代码来源:uncertainty.cpp

示例4: plSetScaling

void plSetScaling(plCollisionShapeHandle cshape, plVector3 cscaling)
{
	btCollisionShape* shape = reinterpret_cast<btCollisionShape*>( cshape);
	btAssert(shape);
	btVector3 scaling(cscaling[0],cscaling[1],cscaling[2]);
	shape->setLocalScaling(scaling);	
}
开发者ID:0302zq,项目名称:libgdx,代码行数:7,代码来源:Bullet-C-API.cpp

示例5: scaling

void CImage::DrawSprite(LPD3DXSPRITE SpriteInterface, LPDIRECT3DTEXTURE9 TextureInterface, int PosX, int PosY, int Rotation, int Align)
{
	if(SpriteInterface == NULL || TextureInterface == NULL)
		return;

	D3DXVECTOR3 Vec;

	Vec.x = (FLOAT)PosX;
	Vec.y = (FLOAT)PosY;
	Vec.z = (FLOAT)0.0f;

	D3DXMATRIX mat;
	D3DXVECTOR2 scaling(1.0f, 1.0f);
	D3DSURFACE_DESC desc;
	TextureInterface->GetLevelDesc(0, &desc);
	D3DXVECTOR2 spriteCentre;
	if(Align == 1)
		spriteCentre = D3DXVECTOR2((FLOAT)desc.Width / 2, (FLOAT)desc.Height / 2);
	else
		spriteCentre = D3DXVECTOR2(0, 0);
	D3DXVECTOR2 trans = D3DXVECTOR2(0, 0);
	D3DXMatrixTransformation2D(&mat, NULL, 0.0, &scaling, &spriteCentre, (FLOAT)Rotation, &trans);

	SpriteInterface->SetTransform(&mat);
	SpriteInterface->Begin(D3DXSPRITE_ALPHABLEND);
	SpriteInterface->Draw(TextureInterface, NULL, NULL, &Vec, 0xFFFFFFFF);
	SpriteInterface->End();
}
开发者ID:JohnnyCrazy,项目名称:DX9-Overlay-API,代码行数:28,代码来源:Image.cpp

示例6: scaling

void ImportObjSetup::initPhysics()
{
	m_guiHelper->setUpAxis(2);
	this->createEmptyDynamicsWorld();
	m_guiHelper->createPhysicsDebugDrawer(m_dynamicsWorld);
	m_dynamicsWorld->getDebugDrawer()->setDebugMode(btIDebugDraw::DBG_DrawWireframe);


	btTransform trans;
    trans.setIdentity();
	trans.setRotation(btQuaternion(btVector3(1,0,0),SIMD_HALF_PI));
	btVector3 position = trans.getOrigin();
	btQuaternion orn = trans.getRotation();
		
    btVector3 scaling(1,1,1);
	btVector3 color(1,1,1);
		
   int shapeId = loadAndRegisterMeshFromFile2(m_fileName, m_guiHelper->getRenderInterface());    
   if (shapeId>=0)
   {
        //int id = 
        m_guiHelper->getRenderInterface()->registerGraphicsInstance(shapeId,position,orn,color,scaling);
   } 

}
开发者ID:Chandrayee,项目名称:OpenDS-changes-for-self-driving,代码行数:25,代码来源:ImportObjExample.cpp

示例7: scaling

		void Statistics::scaling(vector<vector<double> >& m)
		{
			for (unsigned int i = 0; i < m.size(); i++)
			{
				scaling(m[i]);
			}
		}
开发者ID:PierFio,项目名称:ball,代码行数:7,代码来源:statistics.C

示例8: scaling

    //-----------------------------------------------------------------------
    //                           s e t S c a l e
    //-----------------------------------------------------------------------
    void TCollisionShape::setScale(const TVector3& value)
    {
        btVector3 scaling(value.X, value.Y, value.Z);

        m_shape->setLocalScaling(scaling);

    }
开发者ID:bdbdonp,项目名称:tubras,代码行数:10,代码来源:TCollisionShapes.cpp

示例9: scaling

/* Given one set of values from one margin, do the actual scaling.
 On the first pass, this function takes notes on each margin's element list and total 
 in the original data. Later passes just read the notes and call the scaling() function above.
*/
static void one_set_of_values(mnode_t *const * const icon, const int ctr, void *in){
    rake_t *r = in;
    int size = r->indata->matrix->size1;
    static bool *t = NULL;
    if (!t) t = malloc(size * sizeof(bool));
	int first_pass = 0;
    double in_sum;
	if (ctr < r->ct)
		in_sum = gsl_vector_get(r->indata_values, ctr);
    else {
        r->ct++;
        if (ctr >= r->al) rakeinfo_grow(r);
   		index_get_element_list(icon, t);
        in_sum = 0;
        int n=0, al=0;
        r->elmtlist[ctr] = NULL;
        for(int m=0; m < size; m++)
            if (t[m]){
                in_sum += r->indata->weights->data[m];
                if (n >= al) {
                    al = (al+1)*2;
                    r->elmtlist[ctr] = realloc(r->elmtlist[ctr], al*sizeof(size_t));
                }
                r->elmtlist[ctr][n++] = m;
            }
        r->elmtlist_sizes[ctr] = n;
        r->indata_values->data[ctr] = in_sum;
		first_pass++;
	}
    if (!r->elmtlist_sizes[ctr]) return;
    if (!first_pass && !in_sum)  return;
    scaling(r->elmtlist[ctr], r->elmtlist_sizes[ctr], r->fit->weights, in_sum);
}
开发者ID:rlowrance,项目名称:Apophenia,代码行数:37,代码来源:apop_rake.c

示例10: setText

    void Checkbox::setSize(float width, float height)
    {
        // Don't do anything when the checkbox wasn't loaded correctly
        if (m_Loaded == false)
            return;

        // A negative size is not allowed for this widget
        if (width  < 0) width  = -width;
        if (height < 0) height = -height;

        // Set the size of the checkbox
        m_Size.x = width;
        m_Size.y = height;

        // If the text is auto sized then recalculate the size
        if (m_TextSize == 0)
            setText(m_Text.getString());

        sf::Vector2f scaling(m_Size.x / m_TextureUnchecked.getSize().x, m_Size.y / m_TextureUnchecked.getSize().y);
        m_TextureChecked.sprite.setScale(scaling);
        m_TextureUnchecked.sprite.setScale(scaling);
        m_TextureFocused.sprite.setScale(scaling);
        m_TextureHover.sprite.setScale(scaling);

        // Reposition the text
        setPosition(getPosition());
    }
开发者ID:IMACoconut,项目名称:ImaKart,代码行数:27,代码来源:Checkbox.cpp

示例11: localCreateRigidBody

	btRigidBody* localCreateRigidBody (btScalar mass, const btTransform& startTransform, btConvexShape* shape)
	{
		bool isDynamic = (mass != 0.f);

		btVector3 localInertia(0,0,0);
		if (isDynamic)
			shape->calculateLocalInertia(mass,localInertia);

		btDefaultMotionState* myMotionState = new btDefaultMotionState(startTransform);
		
		btRigidBody::btRigidBodyConstructionInfo rbInfo(mass,myMotionState,shape,localInertia);
		btRigidBody* body = new btRigidBody(rbInfo);

		m_ownerWorld->addRigidBody(body);
		
		btVector3 color(1,0,0);
		btVector3 scaling(1,1,1);
		
		btShapeHull* hull = new btShapeHull(shape);
		hull->buildHull(0.01);
		
		{
			int strideInBytes = 9*sizeof(float);
			int numVertices = hull->numVertices();
			int numIndices =hull->numIndices();
			
			btAlignedObjectArray<GraphicsVertex> gvertices;
			
			for (int i=0;i<numVertices;i++)
			{
				GraphicsVertex vtx;
				btVector3 pos =hull->getVertexPointer()[i];
				vtx.pos[0] = pos.x();
				vtx.pos[1] = pos.y();
				vtx.pos[2] = pos.z();
				vtx.pos[3] = 1.f;
				pos.normalize();
				vtx.normal[0] =pos.x();
				vtx.normal[1] =pos.y();
				vtx.normal[2] =pos.z();
				vtx.texcoord[0] = 0.5f;
				vtx.texcoord[1] = 0.5f;
				gvertices.push_back(vtx);
			}
			
			btAlignedObjectArray<int> indices;
			for (int i=0;i<numIndices;i++)
				indices.push_back(hull->getIndexPointer()[i]);
			
			int shapeId = m_app->m_instancingRenderer->registerShape(&gvertices[0].pos[0],numVertices,&indices[0],numIndices);
			
			m_app->m_instancingRenderer->registerGraphicsInstance(shapeId,body->getWorldTransform().getOrigin(),body->getWorldTransform().getRotation(),color,scaling);
			
		}
		delete hull;

		

		return body;
	}
开发者ID:DanielNappa,项目名称:bullet3,代码行数:60,代码来源:RagdollDemo.cpp

示例12: D3DXCOLOR

int OpticSprite::draw(LPD3DXSPRITE sprite, double time, D3DXCOLOR colour, double offsetX, double offsetY) {
	if(!this->animate) {
		sprite->Draw(texture, NULL, NULL, NULL, colour);
		return 1;
	}

	if(animation.lifetime() > time) {
		animation.updateState(aniState, time);
		colour = D3DXCOLOR(aniState.red, aniState.green, aniState.blue, colour.a < aniState.alpha? colour.a : aniState.alpha);
		float rotation = 6.28318531f * aniState.rotation;
		D3DXMATRIX mat, current;
		D3DXVECTOR2 scaling(aniState.scale_x, aniState.scale_y);
		D3DXVECTOR2 position(floor(((pResolution->width * aniState.position_x) - translateCentre.x) + offsetX),
							 floor(((pResolution->height * aniState.position_y) - translateCentre.y) + offsetY));
		D3DXMatrixTransformation2D(&mat, &transformCentre, 0.0f, &scaling, &transformCentre, rotation, &position);
		sprite->GetTransform(&current);
		mat *= current;
		sprite->SetTransform(&mat);
		
		HRESULT res;

		//Spritesheet rect calculations are slightly iffy thanks to the texture scaling (rounding errors)
		if(this->spritesheet) {
			int x = (width * currFrame) % surfaceDesc.Width;
			
			//Hacky workaround
			int diff = x - surfaceDesc.Width;

			if(abs(diff) <= 10) {
				x = 0;
			}
			//End of hacky workaround

			int y = height * currRow;
			RECT source;
			source.top = y;
			source.left = x;
			source.right = x + width;
			source.bottom = y + height;
			res = sprite->Draw(texture, &source, NULL, NULL, colour);
			sprite->SetTransform(&current);

			if(!advanceFrame(time, x, y)) {
				return 0;
			}
		} else {
			res = sprite->Draw(texture, NULL, NULL, NULL, colour);
			sprite->SetTransform(&current);
		}

		if(res != S_OK) {
			throw OpticSpriteException("Rendering sprite failed!");
		}

		return 1;
	}

	return 0;
}
开发者ID:ChurroV2,项目名称:ElDorito,代码行数:59,代码来源:OpticSprite.cpp

示例13: scaling

Transform& Transform::scale(float scaleX, float scaleY, float centerX, float centerY)
{
    Transform scaling(scaleX, 0,      centerX * (1 - scaleX),
                      0,      scaleY, centerY * (1 - scaleY),
                      0,      0,      1);

    return combine(scaling);
}
开发者ID:akadjoker,项目名称:waxe,代码行数:8,代码来源:Transform.cpp

示例14: drawaxis

void Experiment2D22::parallelPlot() {

	viewer->clear();
	drawaxis();
	scaling();
	drawPlot();
	viewer->refresh();
}
开发者ID:varshakirani,项目名称:visualization,代码行数:8,代码来源:Experiment2D22.cpp

示例15: scaling

Transform& Transform::Scale(float scaleX, float scaleY)
{
    Transform scaling(scaleX, 0,      0,
                      0,      scaleY, 0,
                      0,      0,      1);

    return *this = Combine(scaling);
}
开发者ID:ChrisJansson,项目名称:Graphics,代码行数:8,代码来源:Transform.cpp


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