From d41db14ddc7990cc69456ff9d3d2e59a99777ae9 Mon Sep 17 00:00:00 2001 From: dbv Date: Thu, 3 Sep 2015 15:39:05 +0300 Subject: [PATCH] Fix for extrusion creation --- src/GeomAlgoAPI/GeomAlgoAPI_Prism.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Prism.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Prism.cpp index 36c644f39..8c142cb3a 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Prism.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Prism.cpp @@ -33,6 +33,8 @@ #include #include #include +#include +#include #include #include #include @@ -175,20 +177,19 @@ void GeomAlgoAPI_Prism::build(const std::shared_ptr& theBasis, } // Project points to bounding planes. Search max distance to them. - const TopoDS_Shape& aBndToShape = aBoundingToShape->impl(); - const TopoDS_Shape& aBndFromShape = aBoundingFromShape->impl(); + IntAna_Quadric aBndToQuadric(gp_Pln(aToPnt->impl(), aToDir->impl())); + IntAna_Quadric aBndFromQuadric(gp_Pln(aFromPnt->impl(), aFromDir->impl())); Standard_Real aMaxToDist = 0, aMaxFromDist = 0; gp_Vec aNormal(aBaseDir->impl()); for(int i = 0; i < 8; i++) { gp_Lin aLine(aPoints[i], aNormal); - TopoDS_Edge anEdge = BRepBuilderAPI_MakeEdge(aLine).Edge(); - BRepExtrema_ExtCF aToExt(anEdge, TopoDS::Face(aBndToShape)); - BRepExtrema_ExtCF aFromExt(anEdge, TopoDS::Face(aBndFromShape)); - if(aToExt.NbExt() == 0 || aFromExt.NbExt() == 0) { + IntAna_IntConicQuad aToIntAna(aLine, aBndToQuadric); + IntAna_IntConicQuad aFromIntAna(aLine, aBndFromQuadric); + if(aToIntAna.NbPoints() == 0 || aFromIntAna.NbPoints() == 0) { return; } - const gp_Pnt& aPntOnToFace = aToExt.PointOnFace(1); - const gp_Pnt& aPntOnFromFace = aFromExt.PointOnFace(1); + const gp_Pnt& aPntOnToFace = aToIntAna.Point(1); + const gp_Pnt& aPntOnFromFace = aFromIntAna.Point(1); if(aPoints[i].Distance(aPntOnToFace) > aMaxToDist) { aMaxToDist = aPoints[i].Distance(aPntOnToFace); } @@ -223,11 +224,10 @@ void GeomAlgoAPI_Prism::build(const std::shared_ptr& theBasis, // Orienting bounding planes. gp_Lin aLine(aCentrePnt, aNormal); - TopoDS_Edge anEdge = BRepBuilderAPI_MakeEdge(aLine).Edge(); - BRepExtrema_ExtCF aToExt(anEdge, TopoDS::Face(aBndToShape)); - BRepExtrema_ExtCF aFromExt(anEdge, TopoDS::Face(aBndFromShape)); - Standard_Real aToParameter = aToExt.ParameterOnEdge(1); - Standard_Real aFromParameter = aFromExt.ParameterOnEdge(1); + IntAna_IntConicQuad aToIntAna(aLine, aBndToQuadric); + IntAna_IntConicQuad aFromIntAna(aLine, aBndFromQuadric); + Standard_Real aToParameter = aToIntAna.ParamOnConic(1); + Standard_Real aFromParameter = aFromIntAna.ParamOnConic(1); if(aToParameter > aFromParameter) { gp_Vec aVec = aToDir->impl(); if((aVec * aNormal) > 0) { -- 2.39.2