# Shape

Hi; what is the class or function to build the optimal envelope of a surface ! means that given a polygonal face haw can I get the envelope of this face ?
regards

What is an envelope (of a surface) ?
Having that explained would help to give a clue.

Hi roman,
When we have a polygonal surface, we need to put this face in a rectangular shape in order to surround it ! we call this shape envelope (in french contour). The rectangle which surround the face must be the smallest possible ... i dont know if you understand me !
Regards

If I get you correctly, in OCC this is called a bounding box. Use BRepBndLib::Add(). Note that it's axes aligned (i.e. parallel to the main axes X,Y,Z).

Roman

Hi roman
Thank s for help , but what shoulb the result of this function BRepBndLib::Add() when we have a planer face(2D) means z=0 ; normally it should be a rectangular box isn t it ? and then how should i do because i need that the result of the boundary box function return a face :/ ? . Here there is a little fucntion which i have done to built a box boundary of a shape ! and i need the same result using the new fucntion that you have given to me :

TopoDS_Face envelope(TopoDS_Shape shape);
TopoDS_Face envelope(TopoDS_Shape shape)
{
TopoDS_Face envel;
TopExp_Explorer ex;
TopoDS_Vertex v;
gp_Pnt a;
double xmin=10000,xmax=-100000,ymin=10000,ymax=-100000 ;

for (ex.Init(shape,TopAbs_VERTEX);ex.More();ex.Next())
{
v= TopoDS::Vertex(ex.Current());
a=BRep_Tool::Pnt(v);
xmin=Min(xmin,a.X());
ymin=Min(ymin,a.Y());
xmax=Max(xmax,a.X());
ymax=Max(ymax,a.Y());
}
gp_Pnt pl1(xmin,ymax,0);
gp_Pnt pl2(xmax,ymax,0);
gp_Pnt pl3(xmax,ymin,0);
gp_Pnt pl4(xmin,ymin,0);
BRepBuilderAPI_MakePolygon M1 ;