~robot3d-team/robot3d/trunk

« back to all changes in this revision

Viewing changes to src/srCore/body/cylinder.cpp

  • Committer: Anne van Rossum
  • Date: 2010-08-10 15:58:55 UTC
  • Revision ID: anne@gamix-20100810155855-kve7x2vwouagdij9
Initial import

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//! General cylinder class.
 
2
 
 
3
/*!
 
4
 *
 
5
 * Describes general properties of a cylinder.
 
6
 *
 
7
 * @author Lutz Winkler
 
8
 *
 
9
 */
 
10
 
 
11
#include <srCore/body/cylinder.h>
 
12
 
 
13
namespace srCore {
 
14
 
 
15
Cylinder::Cylinder()
 
16
{
 
17
}
 
18
 
 
19
Cylinder::~Cylinder()
 
20
{
 
21
}
 
22
 
 
23
//! sets the collision parameter of the cylinder.
 
24
void Cylinder::setCollisionCylinder(float radius, float length)
 
25
{
 
26
        this->collisionLength   =       length;
 
27
        this->collisionRadius   =       radius;
 
28
 
 
29
        this->SetCollisionCylinder(radius, length);
 
30
}
 
31
 
 
32
 
 
33
//! sets the mass with a equal mass distribution within the parameters defined in setCollisionCylinder.
 
34
void Cylinder::setMass(float mass)
 
35
{
 
36
        dMass myMass;
 
37
 
 
38
        float bodyLength, bodyRadius;
 
39
 
 
40
        bodyLength      = this->collisionLength;// * this->scaleX;
 
41
        bodyRadius      = this->collisionRadius;//      * this->scaleY;
 
42
 
 
43
        dMassSetCylinderTotal(&myMass, mass, 1, bodyRadius, bodyLength);
 
44
 
 
45
        SetMass(&myMass);
 
46
}
 
47
 
 
48
//! sets the mass with a equal mass distribution in a cylinder with the given parameters
 
49
void Cylinder::setMass(float mass, float radius, float length)
 
50
{
 
51
        dMass myMass;
 
52
        dMassSetCylinderTotal(&myMass, mass, 1, radius, length);
 
53
        SetMass(&myMass);
 
54
 
 
55
}
 
56
 
 
57
}