]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/GeomAlgoAPI/GeomAlgoAPI_FaceBuilder.cpp
Salome HOME
Default planes and origin initialization
[modules/shaper.git] / src / GeomAlgoAPI / GeomAlgoAPI_FaceBuilder.cpp
index 6f262f536531617248435a95f8b60710a3072650..a00f8d8c0972a2b00a6dd60c83e5a451071df0db 100644 (file)
@@ -12,6 +12,7 @@
 #include <BRep_Tool.hxx>
 #include <Geom_Plane.hxx>
 
+
 std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_FaceBuilder::square(
     std::shared_ptr<GeomAPI_Pnt> theCenter, std::shared_ptr<GeomAPI_Dir> theNormal,
     const double theSize)
@@ -27,6 +28,19 @@ std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_FaceBuilder::square(
   return aRes;
 }
 
+std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_FaceBuilder::square(
+    std::shared_ptr<GeomAPI_Pln> thePlane,
+    const double theSize)
+{
+  // half of the size in each direction from the center
+  BRepBuilderAPI_MakeFace aFaceBuilder(thePlane->impl<gp_Pln>(),
+                                       -theSize / 2., theSize / 2.,
+                                       -theSize / 2., theSize / 2.);
+  std::shared_ptr<GeomAPI_Shape> aRes(new GeomAPI_Shape);
+  aRes->setImpl(new TopoDS_Shape(aFaceBuilder.Face()));
+  return aRes;
+}
+
 std::shared_ptr<GeomAPI_Pln> GeomAlgoAPI_FaceBuilder::plane(
     std::shared_ptr<GeomAPI_Shape> theFace)
 {
@@ -53,9 +67,7 @@ std::shared_ptr<GeomAPI_Pln> GeomAlgoAPI_FaceBuilder::plane(
   return aResult;
 }
 
-
-std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_FaceBuilder::
-  planarFace(std::shared_ptr<GeomAPI_Pln> thePlane,
+std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_FaceBuilder::planarFace(std::shared_ptr<GeomAPI_Pln> thePlane,
              double theX, double theY,
              double theWidth, double theHeight)
 {