1 // File: GeomAlgoAPI_FaceBuilder.cpp
2 // Created: 23 Apr 2014
3 // Author: Mikhail PONIKAROV
5 #include <GeomAlgoAPI_FaceBuilder.h>
7 #include <BRepBuilderAPI_MakeFace.hxx>
8 #include <TopoDS_Face.hxx>
10 std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_FaceBuilder::square(
11 std::shared_ptr<GeomAPI_Pnt> theCenter, std::shared_ptr<GeomAPI_Dir> theNormal,
14 gp_Pnt* aCenter = static_cast<gp_Pnt*>(theCenter->implementation());
15 gp_Dir* aDir = static_cast<gp_Dir*>(theNormal->implementation());
16 gp_Pln aPlane(*aCenter, *aDir);
17 // half of the size in each direction from the center
18 BRepBuilderAPI_MakeFace aFaceBuilder(aPlane,
19 -theSize / 2., theSize / 2., -theSize / 2., theSize / 2.);
20 std::shared_ptr<GeomAPI_Shape> aRes(new GeomAPI_Shape);
21 aRes->setImplementation(new TopoDS_Shape(aFaceBuilder.Face()));