Salome HOME
High level objects history implementation for BuildPlugin features.
[modules/shaper.git] / src / GeomAPI / GeomAPI_Cone.cpp
index e18d4d333e6cb87f05f8ed034a083e00ec945e41..c8344c3acf960bc4a0465d57bb69f87863d8fb0a 100644 (file)
@@ -61,11 +61,19 @@ GeomAPI_Cone::GeomAPI_Cone(const std::shared_ptr<GeomAPI_Pnt>& theLocation,
                            const double theSemiAngle,
                            const double theRadius1,
                            const double theRadius2)
-  : GeomAPI_Interface(
-      newCone(theLocation->impl<gp_Pnt>(), theAxis->impl<gp_Dir>(), theSemiAngle, theRadius1)),
-    myRadius1(theRadius1),
+  : myRadius1(theRadius1),
     myRadius2(theRadius2)
 {
+  gp_Pnt aLoc = theLocation->impl<gp_Pnt>();
+  gp_Dir aDir = theAxis->impl<gp_Dir>();
+  if (theRadius1 > theRadius2) {
+    aLoc.ChangeCoord() += aDir.XYZ() * (theRadius1 - theRadius2) / Tan(theSemiAngle);
+    aDir.Reverse();
+    myRadius1 = theRadius2;
+    myRadius2 = theRadius1;
+  }
+
+  setImpl(newCone(aLoc, aDir, theSemiAngle, myRadius1));
 }
 
 //=================================================================================================