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);
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);
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);
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);
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);
}
//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");
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");
/*!
* \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.