00001
00002
00003
00004
00005
00006
00007 #ifndef _BOX_H
00008 #define _BOX_H
00009
00010 #include <Physsim/Triangle.h>
00011 #include <Physsim/Matrix3.h>
00012 #include <Physsim/Primitive.h>
00013
00014 namespace Physsim {
00015
00017 class Box : public Primitive
00018 {
00019 public:
00020 Box();
00021 Box(Real xlen, Real ylen, Real zlen);
00022 Box(Real xlen, Real ylen, Real zlen, const Matrix4& T);
00023 Box(const Matrix4& T);
00024 virtual Vector3 calc_com() const { return _T.get_translation(); }
00025 void set_size(Real xlen, Real ylen, Real zlen);
00026 virtual void load_from_xml(XMLTreeConstPtr node, std::map<std::string, BasePtr>& id_map);
00027 virtual void save_to_xml(XMLTreePtr node, std::list<BaseConstPtr>& shared_objects) const;
00028 virtual Real calc_mass();
00029 virtual Matrix3 calc_inertia();
00030 virtual SoNode* create_visualization();
00031
00032 private:
00033 void recompute_mesh();
00034
00035 Real _xlen, _ylen, _zlen;
00036 };
00037 }
00038
00039 #endif