30 #ifndef _LibPhysic_Body_H
31 #define _LibPhysic_Body_H
34 #include "GranOO3/Physic/ExtendedSetOf/Body.hpp"
58 GRANOO_ACCESS_GET(density ,
double ,
_density );
88 std::string
info()
const;
91 virtual std::ostream&
write_ascii (std::ostream& out)
const;
92 virtual std::istream&
read_ascii (std::istream& in);
104 template<
class Archive>
void save(Archive&,
const unsigned int )
const;
105 template<
class Archive>
void load(Archive&,
const unsigned int);
121 _volume_shape(shape),
124 _inertia_tensor(tensor),
125 _inverse_inertia_tensor(tensor.inverse()) {
131 Body(shape, p, Geom::global::quaternion, 0., Geom::global::tensor) {
136 Body(shape, Geom::global::center, Geom::global::quaternion, 0., Geom::global::tensor) {
157 torque() +=
Geom::Vector(get_center(),applicationPoint) ^ force;
186 return torque() + (
Geom::Vector(A, get_center())^force());
205 const double K = 0.5*(I.
xx()*w.
x()*w.
x() + I.
yy()*w.
y()*w.
y() + I.
zz()*w.
z()*w.
z());
206 const double V = get_linear_velocity().norm();
221 template<
class Archive>
void
223 ar << boost::serialization::base_object<Node>(*
this);
230 template<
class Archive>
void
232 ar >> boost::serialization::base_object<Node>(*
this);
242 #include <boost/serialization/version.hpp>
246 GRANOO_CLASS_DECLARE_TPL(Physic::Body);
BOOST_CLASS_VERSION(GranOO3::Physic::Body, 0) namespace GranOO3
Definition: Body.hpp:243
Definition: PropClass.hpp:47
Definition: SetOf.hpp:346
Definition: Quaternion.hpp:54
Quaternion conjugate() const
Definition: Tensor.hpp:62
Definition: Vector.hpp:75
a class that represents a body
Definition: Body.hpp:43
double get_kinetic_energy() const
Definition: Body.hpp:200
double get_mass() const
get the current mass value of the body
Definition: Body.cpp:58
virtual std::ostream & export_to_povray(std::ostream &out) const
exporting to povray format
Definition: Body.cpp:85
Geom::Vector compute_torque_at(const Geom::Point &A) const
Definition: Body.hpp:185
BOOST_SERIALIZATION_SPLIT_MEMBER()
AABB aabb() const
get the aabb tree the body
Definition: Body.hpp:161
void apply_force_at(const Geom::Vector &, const Geom::Point &)
Definition: Body.hpp:155
double _density
the density value of the body
Definition: Body.hpp:112
void set_density(double density)
set the density value
Definition: Body.hpp:177
void save(Archive &, const unsigned int) const
complete serializing of the element in the *.gdd format
Definition: Body.hpp:222
double get_volume() const
get the current volume of the body
Definition: Body.hpp:190
Geom::Tensor _inertia_tensor
the inertia tensor of the body
Definition: Body.hpp:114
bool collide(const Body &other, Collision::Data &col)
collision detection with another body
Definition: Body.hpp:211
void make_equal_to(const Body &other)
for equalizing two bodies
Definition: Body.cpp:47
void set_inertia_tensor(const Geom::Tensor &inertia)
set the inertia tensor value
Definition: Body.hpp:171
Body & operator=(const Body &)=delete
Geom::Tensor _inverse_inertia_tensor
the inverse of the inertia tensor of the body
Definition: Body.hpp:115
Body(Shape::Volume &shape, const Geom::Point &p, const Geom::Quaternion &q, double mass, const Geom::Tensor &inertia)
constructor
Definition: Body.hpp:119
double get_bounding_radius() const
get the current bounding radius of the body
Definition: Body.hpp:195
double _mass
the mass value of the body
Definition: Body.hpp:113
friend class boost::serialization::access
Definition: Body.hpp:103
void load(Archive &, const unsigned int)
complete serializing of the element in the *.gdd format
Definition: Body.hpp:231
virtual std::istream & read_ascii(std::istream &in)
update the current state of the body from an ascii file format *.lgdd
Definition: Body.cpp:79
virtual ~Body()=0
destructor
Definition: Body.hpp:140
std::string info() const
Display some useful info in the terminal
Definition: Body.cpp:63
virtual std::ostream & write_ascii(std::ostream &out) const
dump the current state of the bodyt in a ascii file (standard *.lgdd format)
Definition: Body.cpp:72
void update_inverse_inertia_tensor()
update the current value of Body::_inverse_inertia_tensor from the Body::_inertia_tensor value
Definition: Body.hpp:166
Body(const Body &)=delete
Shape::Volume & _volume_shape
Definition: Body.hpp:109
const Shape::Volume & to_volume_shape() const
cast the current object to Shape::Volume
Definition: Body.hpp:144
void apply_force(const Geom::Vector &)
Definition: Node.hpp:462
Definition: Volume.hpp:103
virtual AABB aabb() const =0
virtual bool collide(const Volume &, Collision::Data &) const =0
virtual double get_volume() const =0
virtual void compute_inertia_tensor(double density, Geom::Tensor &) const =0
Definition: Common.hpp:198
x y t t *t x y t t t x y t t t x *y t *t t x *y t *t t x y t t t x y t t t t(t+t)") define_sfop3(16
Definition: StaticAABBTree.hpp:38
static Data main
Definition: Data.hpp:45