<html><body>
<div style="font-size: 13.3333px; font-family: tahoma; color: rgb(0, 0, 0);
font-weight: 400; font-style: normal;">
Dear all,</div>
<div style="font-size: 13.3333px; font-family: tahoma; color: rgb(0, 0, 0);
font-weight: 400; font-style: normal;">
</div>
<div style="font-size: 13.3333px; font-family: tahoma; color: rgb(0, 0, 0);
font-weight: 400; font-style: normal;">
I do not really understand why the BoundingBox command does not give the
expected results for "complex" volumes. I developped a small
workaround consisting in looping over the volume boundary faces and each
time evaluating the BoundingBox of the surface.</div>
<div style="font-size: 13.3333px; font-family: tahoma; color: rgb(0, 0, 0);
font-weight: 400; font-style: normal;">
</div>
<div style="font-size: 13.3333px; font-family: tahoma; color: rgb(0, 0, 0);
font-weight: 400; font-style: normal;">
In case other might be interested I post the small piece of code
below.</div>
<div style="font-size: 13.3333px; font-family: tahoma; color: rgb(0, 0, 0);
font-weight: 400; font-style: normal;">
</div>
<div style="font-size: 13.3333px; font-family: tahoma; color: rgb(0, 0, 0);
font-weight: 400; font-style: normal;">
Kindly,</div>
<div style="font-size: 13.3333px; font-family: tahoma; color: rgb(0, 0, 0);
font-weight: 400; font-style: normal;">
</div>
<div style="font-size: 13.3333px; font-family: tahoma; color: rgb(0, 0, 0);
font-weight: 400; font-style: normal;">
Lionel</div>
<div style="font-size: 13.3333px; font-family: tahoma; color: rgb(0, 0, 0);
font-weight: 400; font-style: normal;">
</div>
<div style="font-size: 13.3333px; font-family: tahoma; color: rgb(0, 0, 0);
font-weight: 400; font-style: normal;">
Macro VolumeBB<br />
//Piece of script that gives the bounding box of a volume<br />
//-----------------------------------------------<br />
//Inputs : vol volume ID number <br />
//Output : out list with xmin,ymin,zmin,xmax,ymax,zmax<br />
//<br />
//Reserved variable names : q_iterate<br />
//
j_iter<br />
//
b<br />
//
tmp <br />
/* --------------------------------------------*/<br />
out = {};<br />
out[5]=0;<br />
b() = Unique(Abs(Boundary {Volume {vol};} ));<br />
// loop over the boundary surfaces of the volume<br />
For q_iterate In {0:#b[]-1}<br />
tmp() = BoundingBox Surface{b[q_iterate]};<br />
If(q_iterate == 0)<br />
out[] = tmp [];<br />
Else<br />
// loop over Xmin, ymin, zmin<br />
For j_iter In {0:2}<br />
//out[j] = min(out[j],
tmp[j])<br />
out[j_iter] = (out[j_iter] <
tmp[j_iter]) ? out[j_iter] : tmp[j_iter];<br />
EndFor<br />
// loop over xmax, ymax, zmax<br />
For j_iter In {3:5}<br />
out[j_iter] = (out[j_iter] >
tmp[j_iter]) ? out[j_iter] : tmp[j_iter];<br />
EndFor<br />
EndIf<br />
Delete tmp;<br />
EndFor<br />
Delete b;<br />
//Printf("vol has bounds : ", out());<br />
// ----------------------------------------------<br />
// End of piece of script<br />
Return</div>
<blockquote style="padding-right: 0px; padding-left: 5px; margin-left: 5px;
border-left: 2px solid rgb(0, 0, 0); margin-right: 0px;">
-----Original Message-----<br />
From: Lionel Wilhelm <wilhelm@ycoorsystems.com><br />
To: David.Colignon@uliege.be, gmsh@onelab.info<br />
Date: Mon, 27 Nov 2017 12:01:07 +0100<br />
Subject: Re: [Gmsh] BooleanFragments output identification<br />
<br />
<div style="font-family: monospace, courier new, courier">
Hi David,<br />
<br />
Thank you for your reply. Unfortunatly, the BoundingBox does not seem
to<br />
work. At least not as I expected...<br />
As far as I understood, the BoundingBox command returns a list with<br />
[Xmin,Ymin,Zmin,Xmax,Ymax,Zmax]. I can then build a Box (volume) with<br />
the command Box{Xmin,Ymin,Zmin,Xmax-Xmin,Ymax-Ymin,Zmax-Zmin}.<br />
<br />
I attach a screenshot with the original volume and its computed
bounding<br />
box [see VolumeOfInterest_withBB.png]. I also noticed that the yellow<br />
point representing the volume in the GUI is not even close to the
center<br />
of the volume (which is supposed to be the case)[see
VolumeOfInterest.png].<br />
<br />
Does anybody have a hint ?<br />
<br />
Regards,<br />
<br />
Lionel<br />
<br />
<br />
On 26.11.2017 19:46, David Colignon wrote:<br />
><br />
> Hi Lionel,<br />
><br />
> You could try:<br />
><br />
> <a
href="http://gmsh.info//doc/texinfo/gmsh.html#Floating-point-expressions"
target="_blank">
http://gmsh.info//doc/texinfo/gmsh.html#Floating-point-expressions</a><br />
><br />
> BoundingBox Point|Line|Surface|Volume { expression }<br />
><br />
> Regards,<br />
><br />
> Dave<br />
><br />
</div>
</blockquote>
</body></html>