Panda3D
odeMass.cxx
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file odeMass.cxx
10  * @author joswilso
11  * @date 2006-12-27
12  */
13 
14 #include "config_ode.h"
15 #include "odeMass.h"
16 
17 TypeHandle OdeMass::_type_handle;
18 
19 OdeMass::
20 OdeMass() :
21  _mass() {
22  dMassSetZero(&_mass);
23 }
24 
25 OdeMass::
26 OdeMass(const OdeMass &copy) :
27  _mass() {
28  _mass.setParameters(copy._mass.mass,
29  copy._mass.c[0], copy._mass.c[1], copy._mass.c[2],
30  copy._mass.I[0], copy._mass.I[5], copy._mass.I[10],
31  copy._mass.I[1], copy._mass.I[2], copy._mass.I[4]);
32 }
33 
34 OdeMass::
35 ~OdeMass() {
36 }
37 
38 dMass* OdeMass::
39 get_mass_ptr() {
40  return &_mass;
41 }
42 
43 void OdeMass::
44 operator = (const OdeMass &copy) {
45  _mass.setParameters(copy._mass.mass,
46  copy._mass.c[0], copy._mass.c[1], copy._mass.c[2],
47  copy._mass.I[0], copy._mass.I[5], copy._mass.I[10],
48  copy._mass.I[1], copy._mass.I[2], copy._mass.I[4]);
49 
50 }
51 
52 
53 void OdeMass::
54 write(std::ostream &out, unsigned int indent) const {
55  out.width(indent);
56  out << get_type() \
57  << "(mag = " << get_magnitude() \
58  << ", center = " << get_center() \
59  << ", inertia = " << get_inertial_tensor() \
60  << ")";
61 }
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
std::ostream & indent(std::ostream &out, int indent_level)
A handy function for doing text formatting.
Definition: indent.cxx:20
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81