1 // Copyright (C) 2014-2016 CEA/DEN, EDF R&D
3 // File: GeomAlgoAPI_ShapeAPI.h
4 // Created: 17 Mar 2016
5 // Author: Clarisse Genrault (CEA)
7 #ifndef GEOMALGOAPI_SHAPEAPI_H
8 #define GEOMALGOAPI_SHAPEAPI_H
10 #include <GeomAPI_Ax1.h>
11 #include <GeomAPI_Ax2.h>
12 #include <GeomAPI_Edge.h>
13 #include <GeomAPI_Pnt.h>
14 #include <GeomAPI_Shape.h>
16 #include <GeomAlgoAPI_Exception.h>
18 namespace GeomAlgoAPI_ShapeAPI
20 /**\class GeomAlgoAPI_ShapeAPI
22 * \brief Allows to access the direct API
24 class GEOMALGOAPI_EXPORT GeomAlgoAPI_ShapeAPI
27 /// Creates a box using the dimensions.
28 /// \param theDx The dimension on X
29 /// \param theDy The dimension on Y
30 /// \param theDz The dimension on Z
32 static std::shared_ptr<GeomAPI_Shape> makeBox(const double theDx, const double theDy,
33 const double theDz) throw (GeomAlgoAPI_Exception);
35 /// Creates a box using the two points that defined a diagonal.
36 /// \param theFirstPoint One extermity of the diagonal
37 /// \param theSecondPoint The other extremity of the diagonal
39 static std::shared_ptr<GeomAPI_Shape> makeBox(std::shared_ptr<GeomAPI_Pnt> theFirstPoint,
40 std::shared_ptr<GeomAPI_Pnt> theSecondPoint) throw (GeomAlgoAPI_Exception);
42 /// Creates a cylinder using a center, an axis, a radius and a height.
43 /// \param theBasePoint The center of the lower base of the cylinder
44 /// \param theEdge The axis of the cylinder
45 /// \param theRadius The radius of the cylinder
46 /// \param theHeight The heigth of the cylinder
47 static std::shared_ptr<GeomAPI_Shape> makeCylinder(std::shared_ptr<GeomAPI_Pnt> theBasePoint,
48 std::shared_ptr<GeomAPI_Edge> theEdge, double theRadius, double theHeight)
49 throw (GeomAlgoAPI_Exception);
51 /// Creates a portion of cylinder using a center, an axis, a radius, a height and an angle.
52 /// \param theBasePoint The center of the lower base of the cylinder
53 /// \param theEdge The axis of the cylinder
54 /// \param theRadius The radius of the cylinder
55 /// \param theHeight The heigth of the cylinder
56 /// \param theAngle The angle defining the portion
57 static std::shared_ptr<GeomAPI_Shape> makeCylinder(std::shared_ptr<GeomAPI_Pnt> theBasePoint,
58 std::shared_ptr<GeomAPI_Edge> theEdge, double theRadius, double theHeight,
59 double theAngle) throw (GeomAlgoAPI_Exception);
61 /// Creates a cylinder using the origin, the OZ axis, a radius and a height.
62 /// \param theRadius The radius of the cylinder
63 /// \param theHeight The heigth of the cylinder
64 static std::shared_ptr<GeomAPI_Shape> makeCylinder(double theRadius, double theHeight)
65 throw (GeomAlgoAPI_Exception);
67 /// Creates a portion of cylinder using the origin, the OZ axis, a radius, a height and an angle.
68 /// \param theRadius The radius of the cylinder
69 /// \param theHeight The heigth of the cylinder
70 /// \param theAngle The angle defining the portion
71 static std::shared_ptr<GeomAPI_Shape> makeCylinder(double theRadius, double theHeight,
72 double theAngle) throw (GeomAlgoAPI_Exception);
74 /// Performs a translation from an axis and a distance.
75 /// \param theSourceShape Shape to be moved
76 /// \param theAxis Movement axis
77 /// \param theDistance Movement distance
79 static std::shared_ptr<GeomAPI_Shape> makeTranslation(
80 std::shared_ptr<GeomAPI_Shape> theSourceShape,
81 std::shared_ptr<GeomAPI_Ax1> theAxis,
82 const double theDistance) throw (GeomAlgoAPI_Exception);
84 /// Performs a translation from dimensions.
85 /// \param theSourceShape Shape to be moved
86 /// \param theDx Movement dimension on X
87 /// \param theDy Movement dimension on Y
88 /// \param theDz Movement dimension on Z
90 static std::shared_ptr<GeomAPI_Shape> makeTranslation(
91 std::shared_ptr<GeomAPI_Shape> theSourceShape,
94 const double theDz) throw (GeomAlgoAPI_Exception);
96 /// Performs a translation from two points.
97 /// \param theSourceShape Shape to be moved
98 /// \param theStartPoint Movement start point
99 /// \param theEndPoint Movement end point
101 static std::shared_ptr<GeomAPI_Shape> makeTranslation(
102 std::shared_ptr<GeomAPI_Shape> theSourceShape,
103 std::shared_ptr<GeomAPI_Pnt> theStartPoint,
104 std::shared_ptr<GeomAPI_Pnt> theEndPoint) throw (GeomAlgoAPI_Exception);
106 /// Performs a symmetry by a point.
107 /// \param theSourceShape Shape be symmetrized
108 /// \param thePoint Point of symmetry
109 static std::shared_ptr<GeomAPI_Shape> makeSymmetry(
110 std::shared_ptr<GeomAPI_Shape> theSourceShape,
111 std::shared_ptr<GeomAPI_Pnt> thePoint) throw (GeomAlgoAPI_Exception);
113 /// Performs a symmetry by an axis.
114 /// \param theSourceShape Shape be symmetrized
115 /// \param theAxis Axis of symmetry
116 static std::shared_ptr<GeomAPI_Shape> makeSymmetry(
117 std::shared_ptr<GeomAPI_Shape> theSourceShape,
118 std::shared_ptr<GeomAPI_Ax1> theAxis) throw (GeomAlgoAPI_Exception);
120 /// Performs a symmetry by a plane.
121 /// \param theSourceShape Shape be symmetrized
122 /// \param thePlane Plane of symmetry
123 static std::shared_ptr<GeomAPI_Shape> makeSymmetry(
124 std::shared_ptr<GeomAPI_Shape> theSourceShape,
125 std::shared_ptr<GeomAPI_Ax2> thePlane) throw (GeomAlgoAPI_Exception);
127 /// Performs a scale by a scale factor.
128 /// \param theSourceShape Shape be scaled
129 /// \param theCenterPoint Point of scale
130 /// \param theScaleFactor Factor of scale
131 static std::shared_ptr<GeomAPI_Shape> makeScale(
132 std::shared_ptr<GeomAPI_Shape> theSourceShape,
133 std::shared_ptr<GeomAPI_Pnt> theCenterPoint,
134 const double theScaleFactor) throw (GeomAlgoAPI_Exception);
136 /// Performs a scale by dimensions.
137 /// \param theSourceShape Shape be scaled
138 /// \param theCenterPoint Point of scale
139 /// \param theScaleFactorX Factor of scale in X
140 /// \param theScaleFactorY Factor of scale in Y
141 /// \param theScaleFactorZ Factor of scale in Z
142 static std::shared_ptr<GeomAPI_Shape> makeScale(
143 std::shared_ptr<GeomAPI_Shape> theSourceShape,
144 std::shared_ptr<GeomAPI_Pnt> theCenterPoint,
145 const double theScaleFactorX,
146 const double theScaleFactorY,
147 const double theScaleFactorZ) throw (GeomAlgoAPI_Exception);
149 /// Performs a multi translation along one axis, at a distance and a number of times
150 /// \param theSourceShape Shape to be moved
151 /// \param theAxis Movement axis
152 /// \param theStep Movement step
153 /// \param theNumber Movement number
155 static std::shared_ptr<GeomAPI_Shape> makeMultiTranslation(
156 std::shared_ptr<GeomAPI_Shape> theSourceShape,
157 std::shared_ptr<GeomAPI_Ax1> theAxis,
158 const double theStep,
159 const int theNumber) throw (GeomAlgoAPI_Exception);
161 /// Performs a multi translation along two axis : a different distance on each axis
162 /// and a different number of times for each axis
163 /// \param theSourceShape Shape to be moved
164 /// \param theFirstAxis First movement axis
165 /// \param theFirstStep First movement step
166 /// \param theFirstNumber First movement number
167 /// \param theSecondAxis First movement axis
168 /// \param theSecondStep First movement step
169 /// \param theSecondNumber First movement number
171 static std::shared_ptr<GeomAPI_Shape> makeMultiTranslation(
172 std::shared_ptr<GeomAPI_Shape> theSourceShape,
173 std::shared_ptr<GeomAPI_Ax1> theFirstAxis,
174 const double theFirstStep,
175 const int theFirstNumber,
176 std::shared_ptr<GeomAPI_Ax1> theSecondAxis,
177 const double theSecondStep,
178 const int theSecondNumber) throw (GeomAlgoAPI_Exception);
180 /// Creates a cone segment using standard GDML parameters.
181 /// \param theRMin1 Inner radius at base of cone
182 /// \param theRMax1 Outer radius at base of cone
183 /// \param theRMin2 Inner radius at top of cone
184 /// \param theRMax2 Outer radius at top of cone
185 /// \param theZ Height of cone segment
186 /// \param theStartPhi Start angle of the segment
187 /// \param theDeltaPhi Angle of the segment
188 static std::shared_ptr<GeomAPI_Shape> makeConeSegment(
189 const double theRMin1,
190 const double theRMax1,
191 const double theRMin2,
192 const double theRMax2,
194 const double theStartPhi,
195 const double theDeltaPhi) throw (GeomAlgoAPI_Exception);