static void InterProfilesAndHAX(const HYDROData_SequenceOfObjects& profiles,
const Handle(Geom2d_Curve)& Hax2d,
std::map<double, Handle(HYDROData_Profile)>& profToInterParam,
+ std::vector<bool>& paramToSwapFlag,
std::vector<std::string>* warnings)
{
for (int i=1;i<=profiles.Size();i++)
continue;
}
Handle(Geom2d_Line) lin2d = new Geom2d_Line(P1,gp_Dir2d(P2.XY()-P1.XY()));
+ gp_Dir2d prof_dir2d = lin2d->Direction();
Geom2dAdaptor_Curve linAd(lin2d, 0, d);
Geom2dAdaptor_Curve haxAd(Hax2d);
continue;
}
double param = isec.Point(1).ParamOnSecond();
+ gp_Pnt2d int_p2d;
+ gp_Vec2d vec_on_hax_intersec;
+ haxAd.D1(param, int_p2d, vec_on_hax_intersec);
+ gp_Dir2d d_hax(vec_on_hax_intersec);
+ double ang = d_hax.Angle(prof_dir2d);
+ if (ang>0)
+ paramToSwapFlag.push_back(true);
+ else
+ paramToSwapFlag.push_back(false);
profToInterParam[param] = aProfile;
}
}
}
}
+void reversePoints(std::vector<gp_Pnt2d>& points)
+{
+ std::reverse(points.begin(), points.end());
+}
+
void HYDROData_StreamLinearInterpolation::Perform(const HYDROData_SequenceOfObjects& profiles,
int pointsToInsert,
double stepOnHA,
}
std::map<double, Handle(HYDROData_Profile)> InterParamToProf;
+ std::vector<bool> paramToSwapFlag;
//profToInterParam is output param map: profile to intersection param on hydr.axis
- InterProfilesAndHAX(profiles, Hax2d, InterParamToProf, warnings);
+ InterProfilesAndHAX(profiles, Hax2d, InterParamToProf, paramToSwapFlag, warnings);
//
std::vector<std::vector<gp_Pnt2d>> profilesPoints;
profilesPoints.reserve(InterParamToProf.size());
InsertPoints(profilesPoints[i], nbPointsToInsert);
}
+ for (int i=0;i<profilesPoints.size();i++)
+ {
+ bool toSwap = paramToSwapFlag[i];
+ if (toSwap)
+ {
+ std::vector<gp_Pnt2d>& prof = profilesPoints[i];
+ reversePoints(prof);
+ }
+ }
+
TopoDS_Compound cmp2d;
if ( buildPresentationShapes)
{