From: jfa Date: Fri, 29 Mar 2013 09:02:17 +0000 (+0000) Subject: 0022181: EDF GEOM: Issue with MakeRotation. Fix a regression. X-Git-Tag: V6_main_FINAL~8 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=bd787897e999291ac0de8143393e3c94b1457b07;p=modules%2Fgeom.git 0022181: EDF GEOM: Issue with MakeRotation. Fix a regression. --- diff --git a/src/GEOMImpl/GEOMImpl_CircleDriver.cxx b/src/GEOMImpl/GEOMImpl_CircleDriver.cxx index d6130be42..0cf7a12c3 100644 --- a/src/GEOMImpl/GEOMImpl_CircleDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_CircleDriver.cxx @@ -98,7 +98,8 @@ Standard_Integer GEOMImpl_CircleDriver::Execute(TFunction_Logbook& log) const Handle(GEOM_Function) aRefVector = aCI.GetVector(); if (!aRefVector.IsNull()) { TopoDS_Shape aShapeVec = aRefVector->GetValue(); - aV = GEOMUtils::GetVector(aShapeVec); + // take orientation of edge into account to avoid regressions, as it was implemented so + aV = GEOMUtils::GetVector(aShapeVec, Standard_True); } // Axes gp_Ax2 anAxes (aP, aV); diff --git a/src/GEOMImpl/GEOMImpl_RotateDriver.cxx b/src/GEOMImpl/GEOMImpl_RotateDriver.cxx index ac656ca55..fc6c7ebda 100644 --- a/src/GEOMImpl/GEOMImpl_RotateDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_RotateDriver.cxx @@ -99,7 +99,8 @@ Standard_Integer GEOMImpl_RotateDriver::Execute(TFunction_Logbook& log) const Handle(GEOM_Function) anAxis = RI.GetAxis(); if (anAxis.IsNull()) return 0; TopoDS_Shape A = anAxis->GetValue(); - gp_Vec aV = GEOMUtils::GetVector(A); + // do not take into account edge orientation (it is correct) + gp_Vec aV = GEOMUtils::GetVector(A, Standard_False); TopoDS_Edge anEdge = TopoDS::Edge(A); gp_Pnt aP1 = BRep_Tool::Pnt(TopExp::FirstVertex(anEdge)); gp_Dir aDir (aV); @@ -161,7 +162,8 @@ Standard_Integer GEOMImpl_RotateDriver::Execute(TFunction_Logbook& log) const Handle(GEOM_Function) anAxis = RI.GetAxis(); if (!anAxis.IsNull()) { TopoDS_Shape A = anAxis->GetValue(); - gp_Vec aV = GEOMUtils::GetVector(A); + // do not take into account edge orientation (it is correct) + gp_Vec aV = GEOMUtils::GetVector(A, Standard_False); TopoDS_Edge anEdge = TopoDS::Edge(A); aP1 = BRep_Tool::Pnt(TopExp::FirstVertex(anEdge)); D = gp_Dir(aV); @@ -207,7 +209,8 @@ Standard_Integer GEOMImpl_RotateDriver::Execute(TFunction_Logbook& log) const Handle(GEOM_Function) anAxis = RI.GetAxis(); if (!anAxis.IsNull()) { TopoDS_Shape A = anAxis->GetValue(); - gp_Vec aV = GEOMUtils::GetVector(A); + // do not take into account edge orientation (it is correct) + gp_Vec aV = GEOMUtils::GetVector(A, Standard_False); TopoDS_Edge anEdge = TopoDS::Edge(A); aP1 = BRep_Tool::Pnt(TopExp::FirstVertex(anEdge)); D = gp_Dir(aV); diff --git a/src/GEOMImpl/GEOMImpl_SplineDriver.cxx b/src/GEOMImpl/GEOMImpl_SplineDriver.cxx index f54cc4988..af164fe7f 100644 --- a/src/GEOMImpl/GEOMImpl_SplineDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_SplineDriver.cxx @@ -242,8 +242,9 @@ Standard_Integer GEOMImpl_SplineDriver::Execute(TFunction_Logbook& log) const TopoDS_Shape aVec1Sh = aVec1Ref->GetValue(); TopoDS_Shape aVec2Sh = aVec2Ref->GetValue(); - gp_Vec aV1 = GEOMUtils::GetVector(aVec1Sh); - gp_Vec aV2 = GEOMUtils::GetVector(aVec2Sh); + // take orientation of edge into account to avoid regressions, as it was implemented so + gp_Vec aV1 = GEOMUtils::GetVector(aVec1Sh, Standard_True); + gp_Vec aV2 = GEOMUtils::GetVector(aVec2Sh, Standard_True); GBC.Load(aV1, aV2, /*Scale*/Standard_True); } diff --git a/src/GEOMUtils/GEOMUtils.cxx b/src/GEOMUtils/GEOMUtils.cxx index d7e2de141..f2c53523f 100644 --- a/src/GEOMUtils/GEOMUtils.cxx +++ b/src/GEOMUtils/GEOMUtils.cxx @@ -144,7 +144,8 @@ gp_Ax3 GEOMUtils::GetPosition (const TopoDS_Shape& theShape) //function : GetVector //purpose : //======================================================================= -gp_Vec GEOMUtils::GetVector (const TopoDS_Shape& theShape) +gp_Vec GEOMUtils::GetVector (const TopoDS_Shape& theShape, + Standard_Boolean doConsiderOrientation) { if (theShape.IsNull()) Standard_NullObject::Raise("Null shape is given for a vector"); @@ -155,7 +156,7 @@ gp_Vec GEOMUtils::GetVector (const TopoDS_Shape& theShape) TopoDS_Edge anE = TopoDS::Edge(theShape); TopoDS_Vertex V1, V2; - TopExp::Vertices(anE, V1, V2, Standard_True); + TopExp::Vertices(anE, V1, V2, doConsiderOrientation); if (V1.IsNull() || V2.IsNull()) Standard_NullObject::Raise("Invalid edge is given, it must have two points"); diff --git a/src/GEOMUtils/GEOMUtils.hxx b/src/GEOMUtils/GEOMUtils.hxx index 7e888a71b..64c34bd85 100644 --- a/src/GEOMUtils/GEOMUtils.hxx +++ b/src/GEOMUtils/GEOMUtils.hxx @@ -56,8 +56,14 @@ class GEOMUtils { /*! * \brief Get vector, defined by the given edge. + * \param theShape The edge. + * \param doConsiderOrientation If True, take into account the edge orientation. + * \note It is recommended to use doConsiderOrientation=Standard_False, because + * the same edge can have different orientation depending on the way it was + * extracted from a shape. */ - Standard_EXPORT static gp_Vec GetVector (const TopoDS_Shape& theShape); + Standard_EXPORT static gp_Vec GetVector (const TopoDS_Shape& theShape, + Standard_Boolean doConsiderOrientation); /*! * \brief Sort shapes in the list by their coordinates.