Skip to content

Commit 9bf7f8a

Browse files
committed
other improvement for moving boat simulations: now the pressure patch applied in the wet transom stern case accounts for the current boat position
git-svn-id: svn://svn.sissa.it/openship@559 958231e9-8e66-0410-a4a0-f664109d2741
1 parent 7994811 commit 9bf7f8a

4 files changed

Lines changed: 442 additions & 84 deletions

File tree

include/boat_model.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,15 @@ class BoatModel{
6464
// this point is intersection of right transom edge with undisturbed free surface
6565
Point<3> PointRightTransom;
6666
// this point is the base point of the transom edge (intersection with symmetry plane)
67+
Point<3> CurrentPointCenterTransom;
68+
// this point is intersection of left transom edge with undisturbed free surface
69+
// in current hull configuration
70+
Point<3> CurrentPointLeftTransom;
71+
// this point is intersection of right transom edge with undisturbed free surface
72+
// in current hull configuration
73+
Point<3> CurrentPointRightTransom;
74+
// this point is the base point of the transom edge (intersection with symmetry plane)
75+
// in current hull configuration
6776
Point<3> PointCenterTransom;
6877
// this is the wet length of the boat
6978
double boatWetLength;

source/boat_model.cc

Lines changed: 48 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)