+ aLoc.ChangeCoord() += aDir.XYZ() * aVMin;
+ GeomPointPtr aLocation(new GeomAPI_Pnt(aLoc.X(), aLoc.Y(), aLoc.Z()));
+ GeomDirPtr aDirection(new GeomAPI_Dir(aDir.X(), aDir.Y(), aDir.Z()));
+ aCylinder = GeomCylinderPtr(new GeomAPI_Cylinder(aLocation, aDirection, aRadius, aHeight));
+ }
+ return aCylinder;
+}
+
+std::shared_ptr<GeomAPI_Cone> GeomAPI_Face::getCone() const
+{
+ GeomConePtr aCone;
+
+ const TopoDS_Face& aFace = TopoDS::Face(impl<TopoDS_Shape>());
+ Handle(Geom_Surface) aSurf = BRep_Tool::Surface(aFace);
+ if (aSurf->IsKind(STANDARD_TYPE(Geom_ConicalSurface))) {
+ gp_Cone aCon = Handle(Geom_ConicalSurface)::DownCast(aSurf)->Cone();
+ gp_Pnt aLoc = aCon.Location();
+ gp_Dir aDir = aCon.Position().Direction();
+
+ double aUMin, aUMax, aVMin, aVMax;
+ BRepTools::UVBounds(aFace, aUMin, aUMax, aVMin, aVMax);
+
+ double aSemiAngle = Abs(aCon.SemiAngle());
+ double aRadius1 = aCon.RefRadius() + aVMin * Sin(aCon.SemiAngle());
+ double aRadius2 = aCon.RefRadius() + aVMax * Sin(aCon.SemiAngle());
+
+ aLoc.ChangeCoord() += aDir.XYZ() * aVMin * Cos(aCon.SemiAngle());
+
+ GeomPointPtr aLocation(new GeomAPI_Pnt(aLoc.X(), aLoc.Y(), aLoc.Z()));
+ GeomDirPtr aDirection(new GeomAPI_Dir(aDir.X(), aDir.Y(), aDir.Z()));
+ aCone = GeomConePtr(new GeomAPI_Cone(aLocation, aDirection, aSemiAngle, aRadius1, aRadius2));
+ }
+ return aCone;
+}
+
+std::shared_ptr<GeomAPI_Torus> GeomAPI_Face::getTorus() const
+{
+ GeomTorusPtr aTorus;
+
+ const TopoDS_Face& aFace = TopoDS::Face(impl<TopoDS_Shape>());
+ Handle(Geom_Surface) aSurf = BRep_Tool::Surface(aFace);
+ if (aSurf->IsKind(STANDARD_TYPE(Geom_ToroidalSurface))) {
+ gp_Torus aTor = Handle(Geom_ToroidalSurface)::DownCast(aSurf)->Torus();
+ const gp_Pnt& aLoc = aTor.Location();
+ const gp_Dir& aDir = aTor.Position().Direction();
+ double aMajorRadius = aTor.MajorRadius();
+ double aMinorRadius = aTor.MinorRadius();
+
+ GeomPointPtr aCenter(new GeomAPI_Pnt(aLoc.X(), aLoc.Y(), aLoc.Z()));
+ GeomDirPtr aDirection(new GeomAPI_Dir(aDir.X(), aDir.Y(), aDir.Z()));
+ aTorus = GeomTorusPtr(new GeomAPI_Torus(aCenter, aDirection, aMajorRadius, aMinorRadius));
+ }
+ return aTorus;
+}
+
+GeomPointPtr GeomAPI_Face::middlePoint() const
+{
+ GeomPointPtr anInnerPoint;
+
+ const TopoDS_Face& aFace = impl<TopoDS_Face>();
+ if (aFace.IsNull())
+ return anInnerPoint;
+
+ BRepGProp_Face aProp(aFace);