Caricamento v4
This commit is contained in:
@@ -29,16 +29,18 @@ sf::Shape* Caviglia::draw(ReferencePlane plane){
|
||||
case ReferencePlane::XZ:
|
||||
{
|
||||
sf::Shape* shape = shapeXZ;
|
||||
shape->setRotation(sf::Angle(sf::radians(tmpRot[2])));
|
||||
shape->setRotation(sf::Angle(sf::radians(tmpRot[1])));
|
||||
shape->setPosition({tmpPos[0]+globalPos[0],tmpPos[2]+globalPos[2]});
|
||||
shape->setScale({1,cos(float(tmpRot[0]))});
|
||||
return shape;}
|
||||
break;
|
||||
|
||||
case ReferencePlane::YZ:
|
||||
{
|
||||
sf::Shape* shape = shapeYZ;
|
||||
shape->setRotation(sf::Angle(sf::radians(tmpRot[1])));
|
||||
shape->setRotation(sf::Angle(sf::radians(tmpRot[0])));
|
||||
shape->setPosition({tmpPos[1]+globalPos[1],tmpPos[2]+globalPos[2]});
|
||||
shape->setScale({1,cos(float(tmpRot[1]))});
|
||||
return shape;}
|
||||
break;
|
||||
|
||||
|
||||
@@ -28,16 +28,26 @@ sf::Shape* Coscia::draw(ReferencePlane plane){
|
||||
case ReferencePlane::XZ:
|
||||
{
|
||||
sf::Shape* shape = shapeXZ;
|
||||
shape->setRotation(sf::Angle(sf::radians(tmpRot[2])));
|
||||
shape->setRotation(sf::Angle(sf::radians(tmpRot[1])));
|
||||
shape->setPosition({tmpPos[0]+globalPos[0],tmpPos[2]+globalPos[2]});
|
||||
|
||||
//calcolo ridimensionamento dato da cos(x)-> questo per definire l'ancoraggio corretto del pivot
|
||||
shape->setScale({1,cos(float(tmpRot[0]))});
|
||||
//shape->setScale({1,(0.5* cos(float(tmpRot[0]*2)))+0.5});
|
||||
|
||||
|
||||
return shape;}
|
||||
break;
|
||||
|
||||
case ReferencePlane::YZ:
|
||||
{
|
||||
sf::Shape* shape = shapeYZ;
|
||||
shape->setRotation(sf::Angle(sf::radians(tmpRot[1])));
|
||||
shape->setRotation(sf::Angle(sf::radians(tmpRot[0])));
|
||||
shape->setPosition({tmpPos[1]+globalPos[1],tmpPos[2]+globalPos[2]});
|
||||
|
||||
//calcolo ridimensionamento dato da cos(x) -> questo per definire l'ancoraggio corretto del pivot
|
||||
shape->setScale({1,cos(float(tmpRot[1]))});
|
||||
//shape->setScale({1,(0.5* cos(float(tmpRot[1]*2)))+0.5});
|
||||
return shape;}
|
||||
break;
|
||||
|
||||
|
||||
@@ -33,6 +33,9 @@ void Sensore::initCSV(std::vector<std::vector<float>> data){
|
||||
std::vector<float> tmpA = {row[5],row[6],row[4]};
|
||||
std::vector<float> tmpG = {-row[8],-row[9],-row[7]};
|
||||
|
||||
/////// DA CAMBIARE QUI ///////////
|
||||
|
||||
|
||||
rotData.push_back(tmpR);
|
||||
accData.push_back(tmpA);
|
||||
gData.push_back(tmpG);
|
||||
@@ -66,7 +69,7 @@ sf::Shape* Sensore::draw(ReferencePlane plane){
|
||||
case ReferencePlane::XZ:
|
||||
{
|
||||
sf::Shape* shape = shapeXZ;
|
||||
shape->setRotation(sf::Angle(sf::radians(tmpRot[2])));
|
||||
shape->setRotation(sf::Angle(sf::radians(tmpRot[1])));
|
||||
shape->setPosition({tmpPos[0]+globalPos[0],tmpPos[2]+globalPos[2]});
|
||||
return shape;}
|
||||
break;
|
||||
@@ -74,7 +77,7 @@ sf::Shape* Sensore::draw(ReferencePlane plane){
|
||||
case ReferencePlane::YZ:
|
||||
{
|
||||
sf::Shape* shape = shapeYZ;
|
||||
shape->setRotation(sf::Angle(sf::radians(tmpRot[1])));
|
||||
shape->setRotation(sf::Angle(sf::radians(tmpRot[0])));
|
||||
shape->setPosition({tmpPos[1]+globalPos[1],tmpPos[2]+globalPos[2]});
|
||||
return shape;}
|
||||
break;
|
||||
@@ -98,11 +101,11 @@ void Sensore::calcRotWithG(unsigned int index){ // calcolo rotazione con valori
|
||||
float tmpSinY = -grav[1] / modG;
|
||||
float tmpSinZ = -grav[2] / modG;
|
||||
|
||||
float tmpAX = acos(tmpSinY);
|
||||
float tmpAY = acos(tmpSinZ);
|
||||
float tmpAZ = acos(tmpSinX);
|
||||
float tmpAX = acos(tmpSinX);
|
||||
float tmpAY = acos(tmpSinY);
|
||||
float tmpAZ = acos(tmpSinZ);
|
||||
|
||||
body.setRot(rb::Vector3_s{_Float16( tmpAX),_Float16( tmpAY),_Float16( tmpAZ) });
|
||||
body.setRot(rb::Vector3_s{_Float16( tmpAY),_Float16( tmpAX),_Float16( tmpAZ) });
|
||||
|
||||
}
|
||||
/*
|
||||
|
||||
@@ -29,7 +29,7 @@ sf::Shape* Torso::draw(ReferencePlane plane){
|
||||
case ReferencePlane::XZ:
|
||||
{
|
||||
sf::Shape* shape = shapeXZ;
|
||||
shape->setRotation(sf::Angle(sf::radians(tmpRot[2])));
|
||||
shape->setRotation(sf::Angle(sf::radians(tmpRot[1])));
|
||||
shape->setPosition({tmpPos[0]+globalPos[0],tmpPos[2]+globalPos[2]});
|
||||
return shape;}
|
||||
break;
|
||||
@@ -37,7 +37,7 @@ sf::Shape* Torso::draw(ReferencePlane plane){
|
||||
case ReferencePlane::YZ:
|
||||
{
|
||||
sf::Shape* shape = shapeYZ;
|
||||
shape->setRotation(sf::Angle(sf::radians(tmpRot[1])));
|
||||
shape->setRotation(sf::Angle(sf::radians(tmpRot[0])));
|
||||
shape->setPosition({tmpPos[1]+globalPos[1],tmpPos[2]+globalPos[2]});
|
||||
return shape;}
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user