X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGeomAPI%2FGeomAPI_Face.cpp;h=ba111a67d1936924af2049b606c934f33b45f4f9;hb=71cf58ac99d209975c4dc6d25d2fc9705eab3908;hp=a455a0aaa8b89cfa6f24fdfe7038b63d5ca27905;hpb=c852965b2300f81aea972fe2a8013f495c61cba3;p=modules%2Fshaper.git diff --git a/src/GeomAPI/GeomAPI_Face.cpp b/src/GeomAPI/GeomAPI_Face.cpp index a455a0aaa..ba111a67d 100644 --- a/src/GeomAPI/GeomAPI_Face.cpp +++ b/src/GeomAPI/GeomAPI_Face.cpp @@ -11,6 +11,7 @@ #include #include #include +#include #include #include @@ -69,17 +70,20 @@ bool GeomAPI_Face::isPlanar() const std::shared_ptr GeomAPI_Face::getPlane() const { const TopoDS_Shape& aShape = const_cast(this)->impl(); - Handle(Geom_Surface) aSurf = BRep_Tool::Surface(TopoDS::Face(aShape)); + BRepAdaptor_Surface aSurfAdapt(TopoDS::Face(aShape)); - if (!aSurf->IsKind(STANDARD_TYPE(Geom_Plane))) + if (aSurfAdapt.GetType() != GeomAbs_Plane) return std::shared_ptr(); // Obtain central point double aUMin, aUMax, aVMin, aVMax; - aSurf->Bounds(aUMin, aUMax, aVMin, aVMax); + aUMin = aSurfAdapt.FirstUParameter(); + aUMax = aSurfAdapt.LastUParameter(); + aVMin = aSurfAdapt.FirstVParameter(); + aVMax = aSurfAdapt.LastVParameter(); gp_Pnt aCentralPnt; gp_Vec aDU, aDV; - aSurf->D1((aUMin+aUMax)*0.5, (aVMin+aVMax)*0.5, aCentralPnt, aDU, aDV); + aSurfAdapt.D1((aUMin+aUMax)*0.5, (aVMin+aVMax)*0.5, aCentralPnt, aDU, aDV); std::shared_ptr aCenter( new GeomAPI_Pnt(aCentralPnt.X(), aCentralPnt.Y(), aCentralPnt.Z()));