Bullet Collision Detection & Physics Library: btGearConstraint.cpp Source File

Bullet Collision Detection & Physics Library

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

btGearConstraint.cpp
Go to the documentation of this file.
1 /*
2 Bullet Continuous Collision Detection and Physics Library
3 Copyright (c) 2012 Advanced Micro Devices, Inc. http://bulletphysics.org
4
5 This software is provided 'as-is', without any express or implied warranty.
6 In no event will the authors be held liable for any damages arising from the use of this software.
7 Permission is granted to anyone to use this software for any purpose,
8 including commercial applications, and to alter it and redistribute it freely,
9 subject to the following restrictions:
10
11 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
12 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
13 3. This notice may not be removed or altered from any source distribution.
14 */
15
17
18 #include "btGearConstraint.h"
19
20 btGearConstraint::btGearConstraint(btRigidBody& rbA, btRigidBody& rbB, const btVector3& axisInA,const btVector3& axisInB, btScalar ratio)
21 :btTypedConstraint(GEAR_CONSTRAINT_TYPE,rbA,rbB),
22 m_axisInA(axisInA),
23 m_axisInB(axisInB),
24 m_ratio(ratio)
25 {
26 }
27
28 btGearConstraint::~btGearConstraint ()
29 {
30 }
31
32 void btGearConstraint::getInfo1 (btConstraintInfo1* info)
33 {
34 info->m_numConstraintRows = 1;
35 info->nub = 1;
36 }
37
38 void btGearConstraint::getInfo2 (btConstraintInfo2* info)
39 {
40 btVector3 globalAxisA, globalAxisB;
41
42 globalAxisA = m_rbA.getWorldTransform().getBasis()*this->m_axisInA;
43 globalAxisB = m_rbB.getWorldTransform().getBasis()*this->m_axisInB;
44
45 info->m_J1angularAxis[0] = globalAxisA[0];
46 info->m_J1angularAxis[1] = globalAxisA[1];
47 info->m_J1angularAxis[2] = globalAxisA[2];
48
49 info->m_J2angularAxis[0] = m_ratio*globalAxisB[0];
50 info->m_J2angularAxis[1] = m_ratio*globalAxisB[1];
51 info->m_J2angularAxis[2] = m_ratio*globalAxisB[2];
52
53 }
54
btTypedConstraint::btConstraintInfo2::m_J2angularAxis
btScalar * m_J2angularAxis
Definition: btTypedConstraint.h:135
btTypedConstraint::m_rbA
btRigidBody & m_rbA
Definition: btTypedConstraint.h:102
btTypedConstraint::btConstraintInfo2
Definition: btTypedConstraint.h:126
btTypedConstraint::btConstraintInfo1::m_numConstraintRows
int m_numConstraintRows
Definition: btTypedConstraint.h:121
btGearConstraint::getInfo1
virtual void getInfo1(btConstraintInfo1 *info)
internal method used by the constraint solver, don&#39;t use them directly
Definition: btGearConstraint.cpp:32
btTypedConstraint::btConstraintInfo2::m_J1angularAxis
btScalar * m_J1angularAxis
Definition: btTypedConstraint.h:135
GEAR_CONSTRAINT_TYPE
Definition: btTypedConstraint.h:45
btGearConstraint::getInfo2
virtual void getInfo2(btConstraintInfo2 *info)
internal method used by the constraint solver, don&#39;t use them directly
Definition: btGearConstraint.cpp:38
btCollisionObject::getWorldTransform
btTransform & getWorldTransform()
Definition: btCollisionObject.h:327
btGearConstraint::~btGearConstraint
virtual ~btGearConstraint()
Definition: btGearConstraint.cpp:28
btGearConstraint.h
btTransform::getBasis
btMatrix3x3 & getBasis()
Return the basis matrix for the rotation.
Definition: btTransform.h:112
btRigidBody
The btRigidBody is the main class for rigid body objects.
Definition: btRigidBody.h:62
btGearConstraint::m_ratio
btScalar m_ratio
Definition: btGearConstraint.h:42
btVector3
btVector3 can be used to represent 3D points and vectors.
Definition: btVector3.h:83
btTypedConstraint::m_rbB
btRigidBody & m_rbB
Definition: btTypedConstraint.h:103
btTypedConstraint
TypedConstraint is the baseclass for Bullet constraints and vehicles.
Definition: btTypedConstraint.h:78
btTypedConstraint::btConstraintInfo1::nub
int nub
Definition: btTypedConstraint.h:121
btGearConstraint::m_axisInA
btVector3 m_axisInA
Definition: btGearConstraint.h:39
btTypedConstraint::btConstraintInfo1
Definition: btTypedConstraint.h:120
btGearConstraint::btGearConstraint
btGearConstraint(btRigidBody &rbA, btRigidBody &rbB, const btVector3 &axisInA, const btVector3 &axisInB, btScalar ratio=1.f)
Implemented by Erwin Coumans. The idea for the constraint comes from Dimitris Papavasiliou.
Definition: btGearConstraint.cpp:20
btScalar
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
Definition: btScalar.h:278
btGearConstraint::m_axisInB
btVector3 m_axisInB
Definition: btGearConstraint.h:40