@@ -817,26 +817,71 @@ gp_Trsf BoatModel::set_current_position(const double &sink)
817817 TopLoc_Location prev_L = reference_loc;
818818 gp_Trsf prev_Transf = prev_L.Transformation ();
819819
820- // here we prepare the translation of the boat of the requested sink
820+ // here we prepare the translation of the boat of the requested sink
821821 gp_Trsf translation;
822822 gp_Vec vrt_displ (0.0 ,0.0 ,sink);
823823 translation.SetTranslation (vrt_displ);
824824
825825
826826 gp_Trsf this_transf = translation;
827827
828- // the rotation and translation are combined in a single transformation
828+ // the rotation and translation are combined in a single transformation
829829 gp_Trsf new_Transf = this_transf*prev_Transf;
830830 TopLoc_Location new_L (new_Transf);
831831
832- // the transformation is applied to the two sides of the boat
832+ // the transformation is applied to the two sides of the boat
833833 sh.Location (new_L);
834834 refl_sh.Location (new_L);
835835 right_transom_edge.Location (new_L);
836836 left_transom_edge.Location (new_L);
837837 keel_edge.Location (new_L);
838838 current_loc = new_L;
839839
840+
841+ if (is_transom)
842+ {
843+ // we now want to compute the intersection of the transom edges with the
844+ // hull in the current configurations
845+ Handle (Geom_Plane) xyPlane = new Geom_Plane (0 .,0 .,1 .,0 .);
846+
847+ xyPlane->Transform (current_loc.Inverted ());
848+
849+
850+ // cout<<First<<" "<<Last<<endl;
851+ gp_Pnt pntCtrTrsm;
852+ if (left_transom_bspline->Value (left_transom_bspline->FirstParameter ()).Z () >
853+ left_transom_bspline->Value (left_transom_bspline->LastParameter ()).Z ())
854+ pntCtrTrsm = left_transom_bspline->Value (left_transom_bspline->LastParameter ());
855+ else
856+ pntCtrTrsm = left_transom_bspline->Value (left_transom_bspline->FirstParameter ());
857+ pntCtrTrsm.Transform (current_loc);
858+ CurrentPointCenterTransom = Pnt (pntCtrTrsm);
859+
860+ gp_Pnt transomLeft (0.0 ,0.0 ,0.0 );
861+ gp_Pnt transomRight (0.0 ,0.0 ,0.0 );
862+
863+ GeomAPI_IntCS IntersectorLeft (left_transom_bspline, xyPlane);
864+ GeomAPI_IntCS IntersectorRight (right_transom_bspline, xyPlane);
865+ if ( (IntersectorLeft.NbPoints () != 1 ) || (IntersectorRight.NbPoints () != 1 ))
866+ AssertThrow ((IntersectorLeft.NbPoints () == 1 ) && (IntersectorRight.NbPoints () == 1 ),
867+ ExcMessage (" Transom edges don't possess a single intersection with horizontal plane: is transom not immersed any more?" ));
868+ transomLeft = IntersectorLeft.Point (1 );
869+ transomRight = IntersectorRight.Point (1 );
870+ transomLeft.Transform (current_loc);
871+ transomRight.Transform (current_loc);
872+ CurrentPointLeftTransom = Pnt (transomLeft);
873+ CurrentPointRightTransom = Pnt (transomRight);
874+
875+ cout<<" Curent Hull Transformation Transom Point Left: " <<CurrentPointLeftTransom<<endl;
876+ cout<<" Curent Hull Transformation Transom Point Right: " <<CurrentPointRightTransom<<endl;
877+ cout<<" Curent Hull Transformation Transom Point Center: " <<CurrentPointCenterTransom<<endl;
878+
879+ }
880+
881+
882+
883+
884+
840885 return current_loc.Transformation ();
841886}
842887
0 commit comments