From a89cf0089ad2615a1256e4e938c1e5600a2c97d9 Mon Sep 17 00:00:00 2001 From: Matthias Hochsteger Date: Tue, 6 Jul 2021 14:46:58 +0200 Subject: [PATCH] Scaling of bounding box (instead of increasing size in all directions) --- libsrc/gprim/geomobjects.hpp | 7 +++++++ libsrc/meshing/meshclass.cpp | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/libsrc/gprim/geomobjects.hpp b/libsrc/gprim/geomobjects.hpp index 765565f0..f0f8edb4 100644 --- a/libsrc/gprim/geomobjects.hpp +++ b/libsrc/gprim/geomobjects.hpp @@ -406,6 +406,13 @@ namespace netgen } } + void Scale (double factor) + { + auto center = Center(); + pmin = center + factor*(pmin-center); + pmax = center + factor*(pmax-center); + } + void DoArchive(Archive& archive) { archive & pmin & pmax; } }; diff --git a/libsrc/meshing/meshclass.cpp b/libsrc/meshing/meshclass.cpp index d678cc75..ca403d32 100644 --- a/libsrc/meshing/meshclass.cpp +++ b/libsrc/meshing/meshclass.cpp @@ -4881,8 +4881,8 @@ namespace netgen box.Add (points[pi]); auto & el = volelements[ei]; - if(el.IsCurved()) - box.Increase(1.2*box.Diam()); + if(el.IsCurved() && curvedelems->IsElementCurved(ei)) + box.Scale(1.2); elementsearchtree -> Insert (box, ei+1);