X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGeomAPI%2FGeomAPI_Face.cpp;h=c6b76d2bd62a286ac34917d5ee2497afafab7941;hb=a211165b993cec59888b300199b44b525c0daf69;hp=4af6f9fb10db5a3749e0c9242a87c7bf34be3d87;hpb=3c987a8d1b88765224e3ac1388afb91eae17e4d3;p=modules%2Fshaper.git diff --git a/src/GeomAPI/GeomAPI_Face.cpp b/src/GeomAPI/GeomAPI_Face.cpp index 4af6f9fb1..c6b76d2bd 100644 --- a/src/GeomAPI/GeomAPI_Face.cpp +++ b/src/GeomAPI/GeomAPI_Face.cpp @@ -23,6 +23,7 @@ #include "GeomAPI_Pln.h" #include "GeomAPI_Pnt.h" #include "GeomAPI_Sphere.h" +#include "GeomAPI_Curve.h" #include "GeomAPI_Cylinder.h" #include "GeomAPI_Cone.h" #include "GeomAPI_Torus.h" @@ -40,9 +41,12 @@ #include #include #include +#include +#include #include #include #include +#include #include #include #include @@ -174,7 +178,28 @@ bool GeomAPI_Face::isSameGeometry(const std::shared_ptr theShape) { GeomCylinderPtr anOwnCyl = getCylinder(); GeomCylinderPtr anOtherCyl = anOther->getCylinder(); - return anOwnCyl && anOtherCyl && anOwnCyl->isCoincident(anOtherCyl); + if (anOwnCyl && anOtherCyl) + return anOwnCyl->isCoincident(anOtherCyl); + + // compare two swept surfaces of the same type + if ((anOwnSurf->IsKind(STANDARD_TYPE(Geom_SurfaceOfLinearExtrusion)) && + anOtherSurf->IsKind(STANDARD_TYPE(Geom_SurfaceOfLinearExtrusion))) || + (anOwnSurf->IsKind(STANDARD_TYPE(Geom_SurfaceOfRevolution)) && + anOtherSurf->IsKind(STANDARD_TYPE(Geom_SurfaceOfRevolution)))) { + Handle(Geom_SweptSurface) anOwnSwept = Handle(Geom_SweptSurface)::DownCast(anOwnSurf); + Handle(Geom_SweptSurface) anOtherSwept = Handle(Geom_SweptSurface)::DownCast(anOtherSurf); + + const gp_Dir& anOwnDir = anOwnSwept->Direction(); + const gp_Dir& anOtherDir = anOtherSwept->Direction(); + + if (anOwnDir.IsParallel(anOtherDir, Precision::Angular())) { + Handle(Geom_Curve) anOwnCurve = anOwnSwept->BasisCurve(); + Handle(Geom_Curve) anOtherCurve = anOtherSwept->BasisCurve(); + GeomAPI_ExtremaCurveCurve anExtrema(anOwnCurve, anOtherCurve); + return anExtrema.Extrema().IsParallel() && + anExtrema.TotalLowerDistance() < Precision::Confusion(); + } + } } return false;