mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
extent also ensures 3Dness
This commit is contained in:
@ -314,6 +314,7 @@ public:
|
|||||||
|
|
||||||
//- Return slightly wider bounding box
|
//- Return slightly wider bounding box
|
||||||
// Extends all dimensions with s*span*Random::scalar01()
|
// Extends all dimensions with s*span*Random::scalar01()
|
||||||
|
// and guarantees in any direction s*mag(span) minimum width
|
||||||
inline treeBoundBox extend(Random&, const scalar s) const;
|
inline treeBoundBox extend(Random&, const scalar s) const;
|
||||||
|
|
||||||
// Friend Operators
|
// Friend Operators
|
||||||
|
|||||||
@ -437,7 +437,15 @@ inline treeBoundBox treeBoundBox::extend(Random& rndGen, const scalar s) const
|
|||||||
{
|
{
|
||||||
treeBoundBox bb(*this);
|
treeBoundBox bb(*this);
|
||||||
|
|
||||||
const vector span(bb.max() - bb.min());
|
vector span(bb.max() - bb.min());
|
||||||
|
|
||||||
|
// Make 3D
|
||||||
|
scalar magSpan = Foam::mag(span);
|
||||||
|
|
||||||
|
for (direction dir = 0; dir < vector::nComponents; dir++)
|
||||||
|
{
|
||||||
|
span[dir] = Foam::max(s*magSpan, span[dir]);
|
||||||
|
}
|
||||||
|
|
||||||
bb.min() -= cmptMultiply(s*rndGen.vector01(), span);
|
bb.min() -= cmptMultiply(s*rndGen.vector01(), span);
|
||||||
bb.max() += cmptMultiply(s*rndGen.vector01(), span);
|
bb.max() += cmptMultiply(s*rndGen.vector01(), span);
|
||||||
|
|||||||
Reference in New Issue
Block a user