[Gmsh] Reading BoundingBox coordinates

Christophe Geuzaine cgeuzaine at ulg.ac.be
Wed Jul 1 20:47:40 CEST 2009


Mike B. wrote:
> Dear Christophe,
> 
> --- On *Mon, 6/29/09, Christophe Geuzaine /<cgeuzaine at ulg.ac.be>/* wrote:
> 
> 
>     From: Christophe Geuzaine <cgeuzaine at ulg.ac.be>
>     Subject: Re: [Gmsh] Reading BoundingBox coordinates
>     To: "Mike B." <mb78aa at yahoo.com>
>     Cc: "Gmsh mai. lis." <gmsh at geuz.org>
>     Date: Monday, June 29, 2009, 2:06 AM
> 
>     Mike B. wrote:
>      > Dear Gmsh users,
>      >
>      > Is there a way to read the coordinates found by the BoundingBox
>     commmand?. This fails (syntax error):
>      > t[] = BoundingBox;
>      >
> 
>     Hi Mike - Try:
> 
>     xmin = General.MinX;
>     xmax = General.MaxX;
>     ymin = General.MinY;
>     ymax = General.MaxY;
>     zmin = General.MinZ;
>     zmax = General.MaxZ;
> 
> Thanks for your reply. I define a square and print the variables you've 
> mentioned:
> 
> Point(1) = {-5000, -5000 ,-5000};
> Point(2) = {-5000, 5000, -5000};
> Point(3) = {5000 ,5000 ,-5000};
> Point(4) = {5000 ,-5000, -5000};
> 
> Printf( "Min.X %g  Min.Y %g  Min.Z %g", General.MinX, General.MinY, 
> General.MinZ );
> Printf( "Max.X %g  Max.Y %g  Max.Z %g", General.MaxX, General.MaxY, 
> General.MaxZ );
> 
> However, this gives in the message window:
> Min.X 0 Min.Y 0 Min.Z 0
> Max.X 0 Max.Y 0 Max.Z 0
> 

Indeed, I forgot that starting with version 2.0 the bounding box is only
computed *after* a file is parsed... I've added a workaround, which
should be available in tomorrow's snapshot: you can now add

   BoundingBox;

anywhere in the .geo file to force the re-computation of the bounding box.

(It's a bit ugly but it's necessary until we find the time to suppress 
the 2-step model creation we use in the parser at the moment :-()



> Shouldn't it gives the bounding box enclosing the square?.
> 
> Thanks,
> Mike.
> 
> 


-- 
Prof. Christophe Geuzaine
University of Liege, Electrical Engineering and Computer Science
http://www.montefiore.ulg.ac.be/~geuzaine