diff --git a/amibe/python/remesh.py b/amibe/python/remesh.py index 2a46ffcd7..01d8a031e 100644 --- a/amibe/python/remesh.py +++ b/amibe/python/remesh.py @@ -260,7 +260,7 @@ def __remesh(options): if options.forced_bounds: BeamInsertion(liaison.mesh, point_metric).insert( options.forced_bounds[0], options.forced_bounds[1]) - RemeshSkeleton(liaison, options.boundary_angle, options.size / 100.0, point_metric).compute() + RemeshSkeleton(liaison, options.boundary_angle, point_metric, 0.01).compute() else: RemeshSkeleton(liaison, options.boundary_angle, options.size / 100.0, options.size).compute() if options.forced_bounds: diff --git a/amibe/python/remeshSingularity.py b/amibe/python/remeshSingularity.py index b24a36286..7d08016df 100644 --- a/amibe/python/remeshSingularity.py +++ b/amibe/python/remeshSingularity.py @@ -88,7 +88,7 @@ def remesh(**kwargs): # Remesh Skeleton if kwargs['skeleton']: - RemeshSkeleton(liaison, 1.66, kwargs['sizeinf']/100.0, metric).compute() + RemeshSkeleton(liaison, 1.66, metric, 0.01).compute() # Remesh refineOptions = HashMap() diff --git a/amibe/src/org/jcae/mesh/amibe/algos3d/RemeshSkeleton.java b/amibe/src/org/jcae/mesh/amibe/algos3d/RemeshSkeleton.java index 423f96718..066e21e1e 100644 --- a/amibe/src/org/jcae/mesh/amibe/algos3d/RemeshSkeleton.java +++ b/amibe/src/org/jcae/mesh/amibe/algos3d/RemeshSkeleton.java @@ -41,8 +41,11 @@ public class RemeshSkeleton { private final Mesh mesh; private final double angle; - /** tolerance for point insertion */ - private final double tolerance; + /** + * Factor to apply to the square of distance metric to get the square of the + * distance tolerance for point insertion + */ + private final double toleranceFactor; private final AnalyticMetricInterface metric; private final MeshLiaison liaison; private final VertexSwapper vertexSwapper; @@ -50,7 +53,7 @@ public class RemeshSkeleton { public RemeshSkeleton(MeshLiaison liaison, double angle, double tolerance, final double size) { - this(liaison, angle, tolerance, new AnalyticMetricInterface() { + this(liaison, angle, new AnalyticMetricInterface() { public double getTargetSize(double x, double y, double z, int groupId) { return size; @@ -59,15 +62,15 @@ public double getTargetSize(double x, double y, double z, int groupId) { public double getTargetSizeTopo(Mesh mesh, Vertex v) { return size; } - }); + }, tolerance / size); } - public RemeshSkeleton(MeshLiaison liaison, double angle, double tolerance, - AnalyticMetricInterface metric) { + public RemeshSkeleton(MeshLiaison liaison, double angle, + AnalyticMetricInterface metric, double toleranceFactor) { this.liaison = liaison; this.mesh = liaison.getMesh(); this.angle = angle; - this.tolerance = tolerance * tolerance; + this.toleranceFactor = toleranceFactor * toleranceFactor; this.metric = metric; vertexSwapper = new VertexSwapper(liaison) { @@ -138,6 +141,8 @@ public void compute() for(int k = 0; k < toInsert.size(); k++) { Vertex v = toInsert.get(k); + double m2 = metric.getTargetSize(v.getX(), v.getY(), v.getZ(), -1); + double tolerance = m2 * m2 * toleranceFactor; int segId = bgLink.get(k); AbstractHalfEdge toSplit = edgeIndex.get(segId); double od = v.sqrDistance3D(toSplit.origin()); @@ -160,7 +165,6 @@ else if(dd <= tolerance) liaison.move(v, v, true); AbstractHalfEdge e = getEdge(v, oldDestination); edgeIndex.set(segId, e); - double m2 = metric.getTargetSizeTopo(mesh, v); swapVolume = m2 * m2 * m2 / 64; vertexSwapper.swap(v); }