8484#include < GeomConvert.hxx>
8585#include < Geom_BSplineSurface.hxx>
8686#include < BRepAdaptor_Curve.hxx>
87+ #include < gp_Quaternion.hxx>
8788
8889#include < deal.II/grid/grid_reordering.h>
8990#include < deal.II/grid/grid_tools.h>
@@ -805,15 +806,15 @@ cout<<"UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU"<<endl;
805806 return hydrostatic_force;
806807}
807808
808- gp_Trsf BoatModel::set_current_position (const Point<3 > &translation_vect, const double &trim)
809+ gp_Trsf BoatModel::set_current_position (const Point<3 > &translation_vect,
810+ const double &quaternion_scalar,
811+ const Point<3 > &quaternion_vect)
809812{
810813
811- // here we prepare the rotation of the boat of the requested trim angle
812- gp_Pnt rot_center (0.0 ,0.0 ,0.0 );
813- gp_Dir rot_dir (0.0 ,1.0 ,0.0 );
814- gp_Ax1 rot_axis (rot_center, rot_dir);
814+ // here we prepare the rotation of the boat of the requested trim angle
815+ gp_Quaternion rot_quaternion (quaternion_vect (0 ), quaternion_vect (1 ), quaternion_vect (2 ), quaternion_scalar);
815816 gp_Trsf rotation;
816- rotation.SetRotation (rot_axis,trim );
817+ rotation.SetRotation (rot_quaternion );
817818 // we first get the full transformation currently applied to the shape
818819 TopLoc_Location prev_L = reference_loc;
819820 gp_Trsf prev_Transf = prev_L.Transformation ();
@@ -838,6 +839,14 @@ gp_Trsf BoatModel::set_current_position(const Point<3> &translation_vect, const
838839 keel_edge.Location (new_L);
839840 current_loc = new_L;
840841
842+ // SHOULD WE PRINT THE EULER ANGLES UP HERE? IS THE FACT WE HAVE A X AXIS
843+ // DIRECTED BOW TO STERN GOING TO CHANGE SOMETHING?
844+ double yaw_angle, pitch_angle, roll_angle;
845+ rot_quaternion.GetEulerAngles (gp_YawPitchRoll, yaw_angle, pitch_angle, roll_angle);
846+ cout<<" Current Yaw Angle: " <<yaw_angle<<endl;
847+ cout<<" Current Pitch Angle: " <<pitch_angle<<endl;
848+ cout<<" Current Roll Angle: " <<roll_angle<<endl;
849+
841850
842851 if (is_transom)
843852 {
@@ -904,7 +913,7 @@ gp_Trsf BoatModel::set_current_position(const Point<3> &translation_vect, const
904913
905914
906915
907- return current_loc.Transformation ();
916+ return this_transf; // current_loc.Transformation();
908917}
909918
910919
0 commit comments