Salome HOME
bos #19068: Unable to quit Sketch because of conflicting constraint
[modules/shaper.git] / src / GeomAPI / GeomAPI_Solid.cpp
index f128d3d65cf894dbe57aa0097fd7a958062b7891..da5513119921a395c417638aa3833e04fff8867a 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2018-20xx  CEA/DEN, EDF R&D
+// Copyright (C) 2018-2020  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 //
 // You should have received a copy of the GNU Lesser General Public
 // License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
-// See http://www.salome-platform.org/ or
-// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
 #include "GeomAPI_Solid.h"
@@ -273,8 +272,8 @@ std::shared_ptr<GeomAPI_Cone> GeomAPI_Solid::getCone() const
         anApex->z() + aParam0 * anAxis->z()));
 
     // calculate radii of caps
-    aParam0 /= Cos(aSemiAngle);
-    aParam1 /= Cos(aSemiAngle);
+    aParam0 *= Tan(aSemiAngle);
+    aParam1 *= Tan(aSemiAngle);
 
     aCone = GeomConePtr(new GeomAPI_Cone(aLocation, anAxis, aSemiAngle, aParam0, aParam1));
   }
@@ -311,7 +310,7 @@ GeomPointPtr GeomAPI_Solid::middlePoint() const
     return anInnerPoint;
 
   GProp_GProps aProps;
-  BRepGProp::SurfaceProperties(aSolid, aProps, 1.e-4);
+  BRepGProp::VolumeProperties(aSolid, aProps, 1.e-4);
 
   gp_Pnt aPnt = aProps.CentreOfMass();
   anInnerPoint = GeomPointPtr(new GeomAPI_Pnt(aPnt.X(), aPnt.Y(), aPnt.Z()));