#include <HYDROData_LandCoverMap.h>
#include <Bnd_Box2d.hxx>
#include <BRepTools.hxx>
+#include <BRepBndLib.hxx>
+#include <Bnd_Box.hxx>
#include <NCollection_UBTree.hxx>
#include <NCollection_UBTreeFiller.hxx>
#include <BRepTopAdaptor_FClass2d.hxx>
for (int i = 1; i <= NbF; i++)
{
- Bnd_Box2d B;
+ Bnd_Box b3d;
const TopoDS_Face& F = TopoDS::Face(aFaces(i));
- BRepTools::AddUVBounds(F, B);
-
- //convert 2d space of planar face to the 3d space of given points
- //this is more faster way then getting of bnd3d of faces and project them on plane...
- Handle(Geom_Plane) Pl = HYDROData_LCM_FaceClassifier::GetPlane(F);
- gp_Trsf RT;
- RT.SetTransformation(Pl->Position());
- RT.Invert();
- double xmin, ymin, xmax, ymax;
- B.Get(xmin, ymin, xmax, ymax);
- gp_Pnt MinP(xmin, ymin, 0), MaxP(xmax, ymax, 0);
- MinP.Transform(RT);
- MaxP.Transform(RT);
- gp_Pnt2d MinPT(MinP.X(), MinP.Y());
- gp_Pnt2d MaxPT(MaxP.X(), MaxP.Y());
+ BRepBndLib::Add(F, b3d);
Bnd_Box2d NB;
- NB.Update(MinPT.X(), MinPT.Y(), MaxPT.X(), MaxPT.Y() );
-
+ NB.Update(b3d.CornerMin().X(), b3d.CornerMin().Y(), b3d.CornerMax().X(), b3d.CornerMax().Y() );
aTreeFiller.Add(i, NB);
BRepTopAdaptor_FClass2d* aClass2d = new BRepTopAdaptor_FClass2d( F, 1E-7 );
aMapF2Class2d.Add(F, aClass2d);