From: dbv Date: Thu, 15 Sep 2016 14:16:28 +0000 (+0300) Subject: Fixed creation of plane by two parallel planes when the distance between them is... X-Git-Tag: V_2.5.1~16 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=9499645862c5f92b7bf5b74617b9be17ad099c33;p=modules%2Fshaper.git Fixed creation of plane by two parallel planes when the distance between them is very small. --- diff --git a/src/ConstructionPlugin/ConstructionPlugin_Plane.cpp b/src/ConstructionPlugin/ConstructionPlugin_Plane.cpp index 06653561f..7eced565d 100644 --- a/src/ConstructionPlugin/ConstructionPlugin_Plane.cpp +++ b/src/ConstructionPlugin/ConstructionPlugin_Plane.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -358,19 +359,13 @@ std::shared_ptr ConstructionPlugin_Plane::createByTwoParallelPlan std::shared_ptr aFace2(new GeomAPI_Face(aFaceShape2)); std::shared_ptr aPln2 = aFace2->getPlane(); - double aDist = aPln1->distance(aPln2) / 2.0; + std::shared_ptr anOrig1 = aPln1->location(); + std::shared_ptr aPntOnPln2 = aPln2->project(anOrig1); - std::shared_ptr aOrig1 = aPln1->location(); - std::shared_ptr aDir1 = aPln1->direction(); + std::shared_ptr aNewOrig(new GeomAPI_Pnt(anOrig1->xyz()->added( + aPntOnPln2->xyz())->multiplied(0.5))); - aOrig1->translate(aDir1, aDist); - std::shared_ptr aNewPln(new GeomAPI_Pln(aOrig1, aDir1)); - - if((aNewPln->distance(aPln2) - aDist) > 1.e-7) { - aDir1->reverse(); - aOrig1->translate(aDir1, 2.0 * aDist); - aNewPln.reset(new GeomAPI_Pln(aOrig1, aDir1)); - } + std::shared_ptr aNewPln(new GeomAPI_Pln(aNewOrig, aPln1->direction())); std::shared_ptr aRes = makeRectangularFace(aFace1, aNewPln);