37 template <
typename TPo
intType>
59 BoundingBox(TPointType
const& MinPoint, TPointType
const& MaxPoint)
67 mMinMaxPoints(Other.mMinMaxPoints) {}
71 template<
typename TIteratorType>
72 BoundingBox(TIteratorType
const& itPointsBegin, TIteratorType
const& itPointsEnd)
74 Set(itPointsBegin, itPointsEnd);
107 template<
typename TIteratorType>
108 void Set(TIteratorType
const& itPointsBegin, TIteratorType
const& itPointsEnd)
110 if (itPointsBegin == itPointsEnd) {
119 const auto& r_coordinates = itPointsBegin->Coordinates();
120 for (
unsigned int i = 0;
i < Dimension;
i++) {
121 r_min_point[
i] = r_coordinates[
i];
122 r_max_point[
i] = r_coordinates[
i];
125 Extend(itPointsBegin, itPointsEnd);
138 template<
typename TIteratorType>
139 void Extend(TIteratorType
const& itPointsBegin, TIteratorType
const& itPointsEnd)
144 for (TIteratorType it_point = itPointsBegin; it_point != itPointsEnd; it_point++){
145 for (
unsigned int i = 0;
i < Dimension;
i++) {
146 if ((*it_point)[
i] < r_min_point[
i]) r_min_point[
i] = (*it_point)[
i];
147 if ((*it_point)[
i] > r_max_point[
i]) r_max_point[
i] = (*it_point)[
i];
164 for (
unsigned int i = 0;
i < Dimension;
i++){
165 r_min_point[
i] -= Margin;
166 r_max_point[
i] += Margin;
181 return mMinMaxPoints[0];
191 return mMinMaxPoints[0];
201 return mMinMaxPoints[1];
211 return mMinMaxPoints[1];
223 virtual std::string
Info()
const
225 std::stringstream buffer;
226 buffer <<
"BoundingBox" ;
231 virtual void PrintInfo(std::ostream& rOStream)
const {rOStream <<
"BoundingBox";}
248 static constexpr
unsigned int Dimension = 3;
254 std::array<TPointType, 2> mMinMaxPoints;
269 template <
typename TPo
intType>
276 template <
typename TPo
intType>
281 rOStream << std::endl;
Representing a bounding box by storing the min and max points.
Definition: bounding_box.h:39
KRATOS_CLASS_POINTER_DEFINITION(BoundingBox)
Pointer definition of BoundingBox.
TPointType const & GetMinPoint() const
Gets a constant reference to the minimum point (read-only).
Definition: bounding_box.h:189
BoundingBox()
Default constructor.
Definition: bounding_box.h:52
void Extend(const double Margin)
Extends the bounding box by adding a margin to its dimensions.
Definition: bounding_box.h:159
virtual ~BoundingBox()
Destructor.
Definition: bounding_box.h:78
BoundingBox & operator=(BoundingBox const &rOther)
Assignment operator.
Definition: bounding_box.h:85
TPointType const & GetMaxPoint() const
Gets a constant reference to the maximum point (read-only).
Definition: bounding_box.h:209
BoundingBox(TIteratorType const &itPointsBegin, TIteratorType const &itPointsEnd)
Construction with container of points.
Definition: bounding_box.h:72
TPointType & GetMinPoint()
Gets a reference to the minimum point.
Definition: bounding_box.h:179
BoundingBox(const BoundingBox &Other)
Copy constructor.
Definition: bounding_box.h:66
virtual void PrintInfo(std::ostream &rOStream) const
Print information about this object.
Definition: bounding_box.h:231
virtual void PrintData(std::ostream &rOStream) const
Print object's data.
Definition: bounding_box.h:234
virtual std::string Info() const
Turn back information as a string.
Definition: bounding_box.h:223
BoundingBox(TPointType const &MinPoint, TPointType const &MaxPoint)
Constructor with min and max points.
Definition: bounding_box.h:59
void Set(TIteratorType const &itPointsBegin, TIteratorType const &itPointsEnd)
Sets the minimum and maximum points based on a range of input points.
Definition: bounding_box.h:108
void Extend(TIteratorType const &itPointsBegin, TIteratorType const &itPointsEnd)
Extends the bounding box to include a range of input points.
Definition: bounding_box.h:139
TPointType & GetMaxPoint()
Gets a reference to the maximum point.
Definition: bounding_box.h:199
end
Definition: DEM_benchmarks.py:180
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
std::istream & operator>>(std::istream &rIStream, LinearMasterSlaveConstraint &rThis)
input stream function
T & noalias(T &TheMatrix)
Definition: amatrix_interface.h:484
std::ostream & operator<<(std::ostream &rOStream, const LinearMasterSlaveConstraint &rThis)
output stream function
Definition: linear_master_slave_constraint.h:432
integer i
Definition: TensorModule.f:17