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


C++ B2_NOT_USED函数代码示例

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


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

示例1: ProcessThree

// Possible regions:
// - points[2]
// - edge points[0]-points[2]
// - edge points[1]-points[2]
// - inside the triangle
static int32 ProcessThree(b2Vec2* x1, b2Vec2* x2, b2Vec2* p1s, b2Vec2* p2s, b2Vec2* points)
{
	b2Vec2 a = points[0];
	b2Vec2 b = points[1];
	b2Vec2 c = points[2];

	b2Vec2 ab = b - a;
	b2Vec2 ac = c - a;
	b2Vec2 bc = c - b;

	float32 sn = -b2Dot(a, ab), sd = b2Dot(b, ab);
	float32 tn = -b2Dot(a, ac), td = b2Dot(c, ac);
	float32 un = -b2Dot(b, bc), ud = b2Dot(c, bc);

	// In vertex c region?
	if (td <= 0.0f && ud <= 0.0f)
	{
		// Single point
		*x1 = p1s[2];
		*x2 = p2s[2];
		p1s[0] = p1s[2];
		p2s[0] = p2s[2];
		points[0] = points[2];
		return 1;
	}

	// Should not be in vertex a or b region.
	B2_NOT_USED(sd);
	B2_NOT_USED(sn);
	b2Assert(sn > 0.0f || tn > 0.0f);
	b2Assert(sd > 0.0f || un > 0.0f);

	float32 n = b2Cross(ab, ac);

#ifdef TARGET_FLOAT32_IS_FIXED
	n = (n < 0.0)? -1.0 : ((n > 0.0)? 1.0 : 0.0);
#endif

	// Should not be in edge ab region.
	float32 vc = n * b2Cross(a, b);
	b2Assert(vc > 0.0f || sn > 0.0f || sd > 0.0f);

	// In edge bc region?
	float32 va = n * b2Cross(b, c);
	if (va <= 0.0f && un >= 0.0f && ud >= 0.0f && (un+ud) > 0.0f)
	{
		b2Assert(un + ud > 0.0f);
		float32 lambda = un / (un + ud);
		*x1 = p1s[1] + lambda * (p1s[2] - p1s[1]);
		*x2 = p2s[1] + lambda * (p2s[2] - p2s[1]);
		p1s[0] = p1s[2];
		p2s[0] = p2s[2];
		points[0] = points[2];
		return 2;
	}

	// In edge ac region?
	float32 vb = n * b2Cross(c, a);
	if (vb <= 0.0f && tn >= 0.0f && td >= 0.0f && (tn+td) > 0.0f)
	{
		b2Assert(tn + td > 0.0f);
		float32 lambda = tn / (tn + td);
		*x1 = p1s[0] + lambda * (p1s[2] - p1s[0]);
		*x2 = p2s[0] + lambda * (p2s[2] - p2s[0]);
		p1s[1] = p1s[2];
		p2s[1] = p2s[2];
		points[1] = points[2];
		return 2;
	}

	// Inside the triangle, compute barycentric coordinates
	float32 denom = va + vb + vc;
	b2Assert(denom > 0.0f);
	denom = 1.0f / denom;

#ifdef TARGET_FLOAT32_IS_FIXED
	*x1 = denom * (va * p1s[0] + vb * p1s[1] + vc * p1s[2]);
	*x2 = denom * (va * p2s[0] + vb * p2s[1] + vc * p2s[2]);
#else
	float32 u = va * denom;
	float32 v = vb * denom;
	float32 w = 1.0f - u - v;
	*x1 = u * p1s[0] + v * p1s[1] + w * p1s[2];
	*x2 = u * p2s[0] + v * p2s[1] + w * p2s[2];
#endif
	return 3;
}
开发者ID:6301158,项目名称:KinectHacks,代码行数:92,代码来源:b2Distance.cpp

示例2: B2_NOT_USED

bool b2PulleyJoint::SolvePositionConstraints(float32 baumgarte)
{
	B2_NOT_USED(baumgarte);

	b2Body* b1 = m_bodyA;
	b2Body* b2 = m_bodyB;

	b2Vec2 s1 = m_groundAnchor1;
	b2Vec2 s2 = m_groundAnchor2;

	b2Vec2 r1 = b2Mul(b1->m_xf.R, m_localAnchor1 - b1->GetLocalCenter());
	b2Vec2 r2 = b2Mul(b2->m_xf.R, m_localAnchor2 - b2->GetLocalCenter());

	b2Vec2 p1 = b1->m_sweep.c + r1;
	b2Vec2 p2 = b2->m_sweep.c + r2;

	// Get the pulley axes.
	b2Vec2 u1 = p1 - s1;
	b2Vec2 u2 = p2 - s2;

	float32 length1 = u1.Length();
	float32 length2 = u2.Length();

	if (length1 > 10.0f * b2_linearSlop)
	{
		u1 *= 1.0f / length1;
	}
	else
	{
		u1.SetZero();
	}

	if (length2 > 10.0f * b2_linearSlop)
	{
		u2 *= 1.0f / length2;
	}
	else
	{
		u2.SetZero();
	}

	// Compute effective mass.
	float32 cr1u1 = b2Cross(r1, u1);
	float32 cr2u2 = b2Cross(r2, u2);

	float32 m1 = b1->m_invMass + b1->m_invI * cr1u1 * cr1u1;
	float32 m2 = b2->m_invMass + b2->m_invI * cr2u2 * cr2u2;

	float32 mass = m1 + m_ratio * m_ratio * m2;

	if (mass > 0.0f)
	{
		mass = 1.0f / mass;
	}

	float32 C = m_constant - length1 - m_ratio * length2;
	float32 linearError = b2Abs(C);

	float32 impulse = -mass * C;

	b2Vec2 P1 = -impulse * u1;
	b2Vec2 P2 = -m_ratio * impulse * u2;

	b1->m_sweep.c += b1->m_invMass * P1;
	b1->m_sweep.a += b1->m_invI * b2Cross(r1, P1);
	b2->m_sweep.c += b2->m_invMass * P2;
	b2->m_sweep.a += b2->m_invI * b2Cross(r2, P2);

	b1->SynchronizeTransform();
	b2->SynchronizeTransform();

	return linearError < b2_linearSlop;
}
开发者ID:brigosx,项目名称:pybox2d-android,代码行数:73,代码来源:b2PulleyJoint.cpp

示例3: b2AllocDefault

// Default implementation of b2AllocFunction.
static void* b2AllocDefault(int32 size, void* callbackData)
{
	B2_NOT_USED(callbackData);
	return malloc(size);
}
开发者ID:SweedRaver,项目名称:FluidAnimations,代码行数:6,代码来源:b2Settings.cpp

示例4: post_solve

 virtual void post_solve(const b2Contact* contact, const b2ContactImpulse* impulse)
 {
   B2_NOT_USED(contact);
   B2_NOT_USED(impulse);
 }
开发者ID:navneetagarwal,项目名称:Box2d-Project,代码行数:5,代码来源:cs251_base.hpp

示例5: B2_NOT_USED

bool b2EdgeShape::TestPoint(const b2Transform& xf, const b2Vec2& p) const
{
	B2_NOT_USED(xf);
	B2_NOT_USED(p);
	return false;
}
开发者ID:AbePralle,项目名称:Plasmacore,代码行数:6,代码来源:b2EdgeShape.cpp

示例6: mouse_move

 void mouse_move(const b2Vec2& p) { B2_NOT_USED(p); }
开发者ID:navneetagarwal,项目名称:Box2d-Project,代码行数:1,代码来源:cs251_base.hpp

示例7: begin_contact

 // Callbacks for derived classes.
 virtual void begin_contact(b2Contact* contact) { B2_NOT_USED(contact); }
开发者ID:navneetagarwal,项目名称:Box2d-Project,代码行数:2,代码来源:cs251_base.hpp

示例8: B2_NOT_USED

float32 b2ElasticRopeJoint::GetReactionTorque(float32 inv_dt) const
{
    B2_NOT_USED(inv_dt);
    return 0.0f;
}
开发者ID:InPieces,项目名称:b2ElasticRopeJoint,代码行数:5,代码来源:b2ElasticRopeJoint.cpp

示例9: main

int main(int argc, char *argv[])
{
	
	QApplication a(argc, argv);
	
	// Set up the scene
	QGraphicsScene scene;
	QRect sceneRect(0,0,740,540);
	scene.setSceneRect(sceneRect);
	scene.setItemIndexMethod(QGraphicsScene::NoIndex);

	Team A(5,QColor(0,0,255));
	Team B(5,QColor(255,255,0),50);
	A.addToScene(scene);
	B.addToScene(scene);
	
	// Set up the view port
	MyGraphicsView v;
	v.setRenderHint(QPainter::Antialiasing);
	v.setCacheMode(QGraphicsView::CacheBackground);
	v.setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate);
	v.setDragMode(QGraphicsView::ScrollHandDrag);
    	v.setScene(&scene);
   	v.show();
   	
   	// Call circle advance for every time interval of 1000/33
	QTimer timer;
     	QObject::connect(&timer, SIGNAL(timeout()), &scene, SLOT(advance()));
     	timer.start(1000 / 33);

	a.exec();
	
#ifndef __NO_BOX2D__
	B2_NOT_USED(argc);
	B2_NOT_USED(argv);

    // Define the ground body.
    b2BodyDef groundBodyDef[4];
    groundBodyDef[0].position.Set(0.0f, 2.7f);      //top
    groundBodyDef[1].position.Set(0.0f, -2.7f);     //bottom
    groundBodyDef[2].position.Set(-3.7f, 0.0f);     //left
    groundBodyDef[3].position.Set(3.7f, 0.0f);      //right

    // Call the body factory which allocates memory for the ground body
    // from a pool and creates the ground box shape (also from a pool).
    // The body is also added to the world.
    b2Body* groundBody[4];
    for(unsigned int i = 0; i < 4; i += 1){
        groundBody[i] = m_world->CreateBody(&groundBodyDef[i]);
    }

    // Define the ground box shape.
    b2PolygonShape groundBox[4];

    // The extents are the half-widths of the box.
    groundBox[0].SetAsBox(3.7f, 0.003f);
    groundBox[1].SetAsBox(3.7f, 0.003f);
    groundBox[2].SetAsBox(0.003f, 2.7f);
    groundBox[3].SetAsBox(0.003f, 2.7f);

    // Add the ground fixture to the ground body.
    for(unsigned int i = 0; i < 4; i += 1){
        groundBody[i]->CreateFixture(&groundBox[i], 0.0f);
    }

    // Define the dynamic body. We set its position and call the body factory.
    b2BodyDef bodyDef[6];
    for(unsigned int i = 0; i < 6; i += 1){
        bodyDef[i].type = b2_dynamicBody;
    }

    bodyDef[0].position.Set(1.0f, 2.0f);
    bodyDef[1].position.Set(1.0f, 0.0f);
    bodyDef[2].position.Set(1.0f, -2.0f);
    bodyDef[3].position.Set(2.0f, 1.0f);
    bodyDef[4].position.Set(2.0f, -1.0f);
    bodyDef[5].position.Set(3.0f, 0.0f);

    b2Body* body[6];
    for(unsigned int i = 0; i < 6; i += 1){
        body[i] = m_world->CreateBody(&bodyDef[i]);
        b2Vec2 pos = body[i]->GetPosition();
        body[i]->SetTransform(pos, 90.0);
    }

    // Define another box shape for our dynamic body.
    b2PolygonShape dynamicBox;
    dynamicBox.SetAsBox(0.09f, 0.09f);
    
    b2Vec2 vertices[19];
    vertices[0].Set(-0.090000f, 0.000000f);
    vertices[1].Set(-0.087385f, -0.021538f);
    vertices[2].Set(-0.079691f, -0.041825f);
    vertices[3].Set(-0.067366f, -0.059681f);
    vertices[4].Set(-0.051126f, -0.074069f);
    vertices[5].Set(-0.031914f, -0.084151f);
    vertices[6].Set(-0.010848f, -0.089344f);
    vertices[7].Set(0.010848f, -0.089344f);
    vertices[8].Set(0.031914f, -0.084151f);
    vertices[9].Set(0.051126f, -0.074069f);
//.........这里部分代码省略.........
开发者ID:uWaterloo-IEEE-StudentBranch,项目名称:WarBots-SSL,代码行数:101,代码来源:main.cpp

示例10: B2_NOT_USED

qreal b2RopeJoint::GetReactionTorque(qreal inv_dt) const
{
	B2_NOT_USED(inv_dt);
	return 0.0f;
}
开发者ID:KDE,项目名称:kolf,代码行数:5,代码来源:b2RopeJoint.cpp

示例11: B2_NOT_USED

bool b2RevoluteJoint::SolvePositionConstraints(float32 baumgarte)
{
	// TODO_ERIN block solve with limit.

	B2_NOT_USED(baumgarte);

	b2Body* b1 = m_bodyA;
	b2Body* b2 = m_bodyB;

	float32 angularError = 0.0f;
	float32 positionError = 0.0f;

	// Solve angular limit constraint.
	if (m_enableLimit && m_limitState != e_inactiveLimit)
	{
		float32 angle = b2->m_sweep.a - b1->m_sweep.a - m_referenceAngle;
		float32 limitImpulse = 0.0f;

		if (m_limitState == e_equalLimits)
		{
			// Prevent large angular corrections
			float32 C = b2Clamp(angle - m_lowerAngle, -b2_maxAngularCorrection, b2_maxAngularCorrection);
			limitImpulse = -m_motorMass * C;
			angularError = b2Abs(C);
		}
		else if (m_limitState == e_atLowerLimit)
		{
			float32 C = angle - m_lowerAngle;
			angularError = -C;

			// Prevent large angular corrections and allow some slop.
			C = b2Clamp(C + b2_angularSlop, -b2_maxAngularCorrection, 0.0f);
			limitImpulse = -m_motorMass * C;
		}
		else if (m_limitState == e_atUpperLimit)
		{
			float32 C = angle - m_upperAngle;
			angularError = C;

			// Prevent large angular corrections and allow some slop.
			C = b2Clamp(C - b2_angularSlop, 0.0f, b2_maxAngularCorrection);
			limitImpulse = -m_motorMass * C;
		}

		b1->m_sweep.a -= b1->m_invI * limitImpulse;
		b2->m_sweep.a += b2->m_invI * limitImpulse;

		b1->SynchronizeTransform();
		b2->SynchronizeTransform();
	}

	// Solve point-to-point constraint.
	{
		b2Vec2 r1 = b2Mul(b1->GetTransform().R, m_localAnchor1 - b1->GetLocalCenter());
		b2Vec2 r2 = b2Mul(b2->GetTransform().R, m_localAnchor2 - b2->GetLocalCenter());

		b2Vec2 C = b2->m_sweep.c + r2 - b1->m_sweep.c - r1;
		positionError = C.Length();

		float32 invMass1 = b1->m_invMass, invMass2 = b2->m_invMass;
		float32 invI1 = b1->m_invI, invI2 = b2->m_invI;

		// Handle large detachment.
		const float32 k_allowedStretch = 10.0f * b2_linearSlop;
		if (C.LengthSquared() > k_allowedStretch * k_allowedStretch)
		{
			// Use a particle solution (no rotation).
			b2Vec2 u = C; u.Normalize();
			float32 k = invMass1 + invMass2;
			b2Assert(k > B2_FLT_EPSILON);
			float32 m = 1.0f / k;
			b2Vec2 impulse = m * (-C);
			const float32 k_beta = 0.5f;
			b1->m_sweep.c -= k_beta * invMass1 * impulse;
			b2->m_sweep.c += k_beta * invMass2 * impulse;

			C = b2->m_sweep.c + r2 - b1->m_sweep.c - r1;
		}

		b2Mat22 K1;
		K1.col1.x = invMass1 + invMass2;	K1.col2.x = 0.0f;
		K1.col1.y = 0.0f;					K1.col2.y = invMass1 + invMass2;

		b2Mat22 K2;
		K2.col1.x =  invI1 * r1.y * r1.y;	K2.col2.x = -invI1 * r1.x * r1.y;
		K2.col1.y = -invI1 * r1.x * r1.y;	K2.col2.y =  invI1 * r1.x * r1.x;

		b2Mat22 K3;
		K3.col1.x =  invI2 * r2.y * r2.y;	K3.col2.x = -invI2 * r2.x * r2.y;
		K3.col1.y = -invI2 * r2.x * r2.y;	K3.col2.y =  invI2 * r2.x * r2.x;

		b2Mat22 K = K1 + K2 + K3;
		b2Vec2 impulse = K.Solve(-C);

		b1->m_sweep.c -= b1->m_invMass * impulse;
		b1->m_sweep.a -= b1->m_invI * b2Cross(r1, impulse);

		b2->m_sweep.c += b2->m_invMass * impulse;
		b2->m_sweep.a += b2->m_invI * b2Cross(r2, impulse);

//.........这里部分代码省略.........
开发者ID:HieuLsw,项目名称:cocos-svg,代码行数:101,代码来源:b2RevoluteJoint.cpp

示例12: PreSolve

	virtual void PreSolve(b2Contact *contact, const b2Manifold *oldManifold)
	{
		B2_NOT_USED(contact);
		B2_NOT_USED(oldManifold);
	}
开发者ID:chengstory,项目名称:CocoStudioSamples,代码行数:5,代码来源:TestColliderDetector.cpp

示例13: EndContact

	virtual void EndContact(b2Contact *contact)
	{
        //! clear list at end
		contact_list.clear();
		B2_NOT_USED(contact);
	}
开发者ID:chengstory,项目名称:CocoStudioSamples,代码行数:6,代码来源:TestColliderDetector.cpp

示例14: main

// This is a simple example of building and running a simulation
// using Box2D. Here we create a large ground box and a small dynamic
// box.
int main(int argc, char** argv)
{
	B2_NOT_USED(argc);
	B2_NOT_USED(argv);

	// Define the size of the world. Simulation will still work
	// if bodies reach the end of the world, but it will be slower.
	b2AABB worldAABB;
	worldAABB.lowerBound.Set(-100.0f, -100.0f);
	worldAABB.upperBound.Set(100.0f, 100.0f);

	// Define the gravity vector.
	b2Vec2 gravity(0.0f, -10.0f);

	// Do we want to let bodies sleep?
	bool doSleep = true;

	// Construct a world object, which will hold and simulate the rigid bodies.
	b2World world(worldAABB, gravity, doSleep);

	// Define the ground body.
	b2BodyDef groundBodyDef;
	groundBodyDef.position.Set(0.0f, -10.0f);

	// Call the body factory which allocates memory for the ground body
	// from a pool and creates the ground box shape (also from a pool).
	// The body is also added to the world.
	b2Body* groundBody = world.CreateBody(&groundBodyDef);

	// Define the ground box shape.
	b2PolygonDef groundShapeDef;

	// The extents are the half-widths of the box.
	groundShapeDef.SetAsBox(50.0f, 10.0f);

	// Add the ground shape to the ground body.
	groundBody->CreateFixture(&groundShapeDef);

	// Define the dynamic body. We set its position and call the body factory.
	b2BodyDef bodyDef;
	bodyDef.position.Set(0.0f, 4.0f);
	b2Body* body = world.CreateBody(&bodyDef);

	// Define another box shape for our dynamic body.
	b2PolygonDef shapeDef;
	shapeDef.SetAsBox(1.0f, 1.0f);

	// Set the box density to be non-zero, so it will be dynamic.
	shapeDef.density = 1.0f;

	// Override the default friction.
	shapeDef.friction = 0.3f;

	// Add the shape to the body.
	body->CreateFixture(&shapeDef);

	// Now tell the dynamic body to compute it's mass properties base
	// on its shape.
	body->SetMassFromShapes();

	// Prepare for simulation. Typically we use a time step of 1/60 of a
	// second (60Hz) and 10 iterations. This provides a high quality simulation
	// in most game scenarios.
	float32 timeStep = 1.0f / 60.0f;
	int32 velocityIterations = 8;
	int32 positionIterations = 1;

	// This is our little game loop.
	for (int32 i = 0; i < 60; ++i)
	{
		// Instruct the world to perform a single step of simulation. It is
		// generally best to keep the time step and iterations fixed.
		world.Step(timeStep, velocityIterations, positionIterations);

		// Now print the position and angle of the body.
		b2Vec2 position = body->GetPosition();
		float32 angle = body->GetAngle();

		printf("%4.2f %4.2f %4.2f\n", position.x, position.y, angle);
	}

	// When the world destructor is called, all bodies and joints are freed. This can
	// create orphaned pointers, so be careful about your world management.

	return 0;
}
开发者ID:SoylentGraham,项目名称:Tootle,代码行数:89,代码来源:HelloWorld.cpp

示例15: shift_mouse_down

 void shift_mouse_down(const b2Vec2& p) { B2_NOT_USED(p); }
开发者ID:navneetagarwal,项目名称:Box2d-Project,代码行数:1,代码来源:cs251_base.hpp


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