diff --git a/README.md b/README.md index c7e9691..8252575 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ Per spostare l'intera scena si tiene premuto il tasto centrale del mouse. - Aggiunta selettore sulla posizione dei dati - Refactoring classe sensore e state per gestire posizione dati da gui -# Per compliare: +# Per compilare: cmake --build diff --git a/build/bin/mainV6 b/build/bin/mainV6 deleted file mode 100755 index c288124..0000000 Binary files a/build/bin/mainV6 and /dev/null differ diff --git a/src/collections/headers/collection_interface.hpp b/src/collections/headers/collection_interface.hpp index 538e346..4aa5ada 100644 --- a/src/collections/headers/collection_interface.hpp +++ b/src/collections/headers/collection_interface.hpp @@ -17,4 +17,15 @@ class CollectionInterface{ }; -#endif \ No newline at end of file +#endif + +inline collection operator+(collection c1, collection c2){ + collection res; + for (PieceInterface* i : c1.pieces){ + res.pieces.push_back(i); + } + for (JointInterface* i : c1.joints){ + res.joints.push_back(i); + } + return res; +} \ No newline at end of file diff --git a/src/collections/headers/gamba.hpp b/src/collections/headers/gamba.hpp index c9f1fda..92a3092 100644 --- a/src/collections/headers/gamba.hpp +++ b/src/collections/headers/gamba.hpp @@ -12,6 +12,7 @@ class Gamba : public CollectionInterface { public: Gamba(rb::Vector3 pos, unsigned int* dataPos, std::string cosciaData, std::string cavigliaData); collection create(ReferencePlane plane) override; + PieceInterface* getJointPiece(); }; #endif \ No newline at end of file diff --git a/src/collections/headers/lower_body.hpp b/src/collections/headers/lower_body.hpp index 707b4cd..9fb5b8e 100644 --- a/src/collections/headers/lower_body.hpp +++ b/src/collections/headers/lower_body.hpp @@ -4,23 +4,30 @@ #define LOWER_BODY_H struct gamba_data{ - rb::Vector3 pos; unsigned int* dataPos; std::string cosciaData; std::string cavigliaData; }; -class lower_body -{ +class Lower_Body : CollectionInterface{ protected: - Gamba sx; - Gamba dx; - Torso t; + Gamba* sx; + Gamba* dx; + Torso* t; + + PivotJoint* jsx; + PivotJoint* jdx; + + bool visible = true; + float alpha = 1; public: - lower_body(std::vector data); - ~lower_body(); + Lower_Body(std::vector data); + ~Lower_Body(); + + void setVisibility(bool c); + collection create(ReferencePlane plane) override; }; diff --git a/src/collections/methods/gamba.cpp b/src/collections/methods/gamba.cpp index 460e77b..e2dedb1 100644 --- a/src/collections/methods/gamba.cpp +++ b/src/collections/methods/gamba.cpp @@ -43,4 +43,8 @@ collection Gamba::create(ReferencePlane plane){ } return coll; +} + +PieceInterface* Gamba::getJointPiece(){ + return sensori[0]; } \ No newline at end of file diff --git a/src/collections/methods/lower_body.cpp b/src/collections/methods/lower_body.cpp new file mode 100644 index 0000000..266cd86 --- /dev/null +++ b/src/collections/methods/lower_body.cpp @@ -0,0 +1,23 @@ +#include "../headers/lower_body.hpp" + +Lower_Body::Lower_Body(std::vector data){ + if (data.size() != 2) throw "Lower_Body_Error: data vector size must be 2"; + sx = new Gamba({0,0,150},data[0].dataPos,data[0].cosciaData,data[0].cavigliaData); + dx = new Gamba({0,0,150},data[1].dataPos,data[1].cosciaData,data[1].cavigliaData); + t = new Torso({0,100,0},_Float16(3.0)); + + PieceInterface* psx = sx->getJointPiece(); + PieceInterface* pdx = dx->getJointPiece(); + + jsx = new PivotJoint(t, {psx}, rb::Vector3{0,-100,50}); + jdx = new PivotJoint(t, {pdx}, rb::Vector3{0,100,50}); +} + + +collection Lower_Body::create(ReferencePlane plane){ + collection coll; + coll = coll + sx->create(plane); + coll = coll + dx->create(plane); + + +} \ No newline at end of file diff --git a/src/pieces/headers/sensore.hpp b/src/pieces/headers/sensore.hpp index 4eabb53..99a661b 100644 --- a/src/pieces/headers/sensore.hpp +++ b/src/pieces/headers/sensore.hpp @@ -34,7 +34,6 @@ class Sensore : public PieceInterface{ void initCSV(std::vector> data); void setIntervall(int min, int max); void setPos(int &pos); - }; #endif \ No newline at end of file