Commit 07dfc7c0 by Christophe Geuzaine

new command "BoundingBox GeoEntity { tag }" to retrieve the bbox of an entity

parent 56c18b6d
Pipeline #365 passed with stage
in 10 minutes 59 seconds
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -496,7 +496,7 @@
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
#line 164 "Gmsh.y"
#line 165 "Gmsh.y"
{
char *c;
int i;
......
......@@ -129,6 +129,7 @@ void getAllPhysicalTags(int dim, List_T *in);
void getElementaryTagsForPhysicalGroups(int dim, List_T *in, List_T *out);
void getElementaryTagsInBoundingBox(int dim, double x1, double y1, double z1,
double x2, double y2, double z2, List_T *out);
void getBoundingBox(int dim, int tag, List_T *out);
void setVisibility(int dim, int visible, bool recursive);
void setVisibility(const std::vector<std::pair<int, int> > &dimTags, int visible,
bool recursive);
......@@ -5355,12 +5356,17 @@ FExpr_Multi :
List_Delete($3);
}
}
| GeoEntity tIn tBoundingBox
| GeoEntity tIn tBoundingBox
'{' FExpr ',' FExpr ',' FExpr ',' FExpr ',' FExpr ',' FExpr '}'
{
$$ = List_Create(10, 10, sizeof(double));
getElementaryTagsInBoundingBox($1, $5, $7, $9, $11, $13, $15, $$);
}
| tBoundingBox GeoEntity '{' FExpr '}'
{
$$ = List_Create(10, 10, sizeof(double));
getBoundingBox($2, (int)$4, $$);
}
| Transform
{
$$ = List_Create(List_Nbr($1), 1, sizeof(double));
......@@ -6651,6 +6657,25 @@ void getElementaryTagsInBoundingBox(int dim, double x1, double y1, double z1,
}
}
void getBoundingBox(int dim, int tag, List_T *out)
{
if(GModel::current()->getOCCInternals() &&
GModel::current()->getOCCInternals()->getChanged())
GModel::current()->getOCCInternals()->synchronize(GModel::current());
if(GModel::current()->getGEOInternals()->getChanged())
GModel::current()->getGEOInternals()->synchronize(GModel::current());
GEntity *ge = GModel::current()->getEntityByTag(dim, tag);
SBoundingBox3d box;
if(ge) box = ge->bounds();
if(!box.empty()){
double b[6] = {box.min().x(), box.min().y(), box.min().z(),
box.max().x(), box.max().y(), box.max().z()};
for(int i = 0; i < 6; i++)
List_Add(out, &b[i]);
}
}
void setVisibility(int dim, int visible, bool recursive)
{
if(GModel::current()->getOCCInternals() &&
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment