[Gmsh] BooleanFragments output identification
Lionel Wilhelm
wilhelm at ycoorsystems.com
Tue Nov 28 09:23:56 CET 2017
Dear all,
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.
In case other might be interested I post the small piece of code below.
Kindly,
Lionel
Macro VolumeBB
//Piece of script that gives the bounding box of a volume
//-----------------------------------------------
//Inputs : vol volume ID number
//Output : out list with xmin,ymin,zmin,xmax,ymax,zmax
//
//Reserved variable names : q_iterate
// j_iter
// b
// tmp
/* --------------------------------------------*/
out = {};
out[5]=0;
b() = Unique(Abs(Boundary {Volume {vol};} ));
// loop over the boundary surfaces of the volume
For q_iterate In {0:#b[]-1}
tmp() = BoundingBox Surface{b[q_iterate]};
If(q_iterate == 0)
out[] = tmp [];
Else
// loop over Xmin, ymin, zmin
For j_iter In {0:2}
//out[j] = min(out[j], tmp[j])
out[j_iter] = (out[j_iter] < tmp[j_iter]) ? out[j_iter] :
tmp[j_iter];
EndFor
// loop over xmax, ymax, zmax
For j_iter In {3:5}
out[j_iter] = (out[j_iter] > tmp[j_iter]) ? out[j_iter] :
tmp[j_iter];
EndFor
EndIf
Delete tmp;
EndFor
Delete b;
//Printf("vol has bounds : ", out());
// ----------------------------------------------
// End of piece of script
Return
-----Original Message-----
From: Lionel Wilhelm <wilhelm at ycoorsystems.com>
To: David.Colignon at uliege.be, gmsh at onelab.info
Date: Mon, 27 Nov 2017 12:01:07 +0100
Subject: Re: [Gmsh] BooleanFragments output identification
Hi David,
Thank you for your reply. Unfortunatly, the BoundingBox does not seem to
work. At least not as I expected...
As far as I understood, the BoundingBox command returns a list with
[Xmin,Ymin,Zmin,Xmax,Ymax,Zmax]. I can then build a Box (volume) with
the command Box{Xmin,Ymin,Zmin,Xmax-Xmin,Ymax-Ymin,Zmax-Zmin}.
I attach a screenshot with the original volume and its computed bounding
box [see VolumeOfInterest_withBB.png]. I also noticed that the yellow
point representing the volume in the GUI is not even close to the center
of the volume (which is supposed to be the case)[see VolumeOfInterest.png].
Does anybody have a hint ?
Regards,
Lionel
On 26.11.2017 19:46, David Colignon wrote:
>
> Hi Lionel,
>
> You could try:
>
> http://gmsh.info//doc/texinfo/gmsh.html#Floating-point-expressions
[http://gmsh.info//doc/texinfo/gmsh.html#Floating-point-expressions]
>
> BoundingBox Point|Line|Surface|Volume { expression }
>
> Regards,
>
> Dave
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://onelab.info/pipermail/gmsh/attachments/20171128/b3e58b7f/attachment-0001.html>
More information about the gmsh
mailing list