From: vsr Date: Wed, 19 Jan 2011 12:43:12 +0000 (+0000) Subject: 0021147: EDF GEOM: Difference between compound of line and compound of edges X-Git-Tag: Start_BR_19998_21191~82 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=8f2d0b5697219b8b53289bd9c25a60ddc354ab53;p=modules%2Fgeom.git 0021147: EDF GEOM: Difference between compound of line and compound of edges --- diff --git a/src/GEOMImpl/GEOMImpl_LineDriver.cxx b/src/GEOMImpl/GEOMImpl_LineDriver.cxx index 63d1b4d24..8b953dbd3 100644 --- a/src/GEOMImpl/GEOMImpl_LineDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_LineDriver.cxx @@ -29,6 +29,7 @@ #include #include +#include #include #include #include @@ -89,12 +90,14 @@ Standard_Integer GEOMImpl_LineDriver::Execute(TFunction_Logbook& log) const if (aShape1.IsSame(aShape2)) { Standard_ConstructionError::Raise("The end points must be different"); } - gp_Pnt P1 = BRep_Tool::Pnt(TopoDS::Vertex(aShape1)); - gp_Pnt P2 = BRep_Tool::Pnt(TopoDS::Vertex(aShape2)); + TopoDS_Vertex V1 = TopoDS::Vertex(aShape1); + TopoDS_Vertex V2 = TopoDS::Vertex(aShape2); + gp_Pnt P1 = BRep_Tool::Pnt(V1); + gp_Pnt P2 = BRep_Tool::Pnt(V2); if (P1.Distance(P2) < Precision::Confusion()) { Standard_ConstructionError::Raise("The end points are too close"); } - aShape = BRepBuilderAPI_MakeEdge(P1, P2).Shape(); + aShape = BRepBuilderAPI_MakeEdge(V1, V2).Shape(); } else if (aType == LINE_TWO_FACES) { Handle(GEOM_Function) aRefFace1 = aPI.GetFace1(); @@ -144,7 +147,8 @@ Standard_Integer GEOMImpl_LineDriver::Execute(TFunction_Logbook& log) const if (aShape1.IsSame(aShape2)) { Standard_ConstructionError::Raise("The end points must be different"); } - gp_Pnt P1 = BRep_Tool::Pnt(TopoDS::Vertex(aShape1)); + TopoDS_Vertex Vstart = TopoDS::Vertex(aShape1); + gp_Pnt P1 = BRep_Tool::Pnt(Vstart); TopoDS_Edge anE = TopoDS::Edge(aShape2); TopoDS_Vertex V1, V2; @@ -157,9 +161,14 @@ Standard_Integer GEOMImpl_LineDriver::Execute(TFunction_Logbook& log) const if (PV1.Distance(PV2) < Precision::Confusion()) { Standard_ConstructionError::Raise("Vector with null magnitude"); } - - gp_Pnt P2 (P1.XYZ() + PV2.XYZ() - PV1.XYZ()); - aShape = BRepBuilderAPI_MakeEdge(P1, P2).Shape(); + TopoDS_Vertex Vend; + if ( V1.IsSame( Vstart ) ) + Vend = V2; + else if ( V2.IsSame( Vstart ) ) + Vend = V1; + else + Vend = BRepBuilderAPI_MakeVertex( gp_Pnt(P1.XYZ() + PV2.XYZ() - PV1.XYZ()) ); + aShape = BRepBuilderAPI_MakeEdge(Vstart, Vend).Shape(); } else { }