Commit 8cf3f89d authored by Benedikt Zoennchen's avatar Benedikt Zoennchen
Browse files

add adpative triangulation implementation

parent c6db7472
package org.vadere.util.delaunay; package org.vadere.util.delaunay;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.ImmutableTriple; import org.apache.commons.lang3.tuple.ImmutableTriple;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.commons.lang3.tuple.Triple; import org.apache.commons.lang3.tuple.Triple;
import org.vadere.util.geometry.LinkedCellsGrid;
import org.vadere.util.geometry.shapes.VCircle; import org.vadere.util.geometry.shapes.VCircle;
import org.vadere.util.geometry.shapes.VLine; import org.vadere.util.geometry.shapes.VLine;
import org.vadere.util.geometry.shapes.VPoint; import org.vadere.util.geometry.shapes.VPoint;
...@@ -81,7 +79,6 @@ public class BowyerWatson<P extends VPoint> { ...@@ -81,7 +79,6 @@ public class BowyerWatson<P extends VPoint> {
private void handle(final P point) { private void handle(final P point) {
HashSet<Line> edges = new HashSet<>(); HashSet<Line> edges = new HashSet<>();
// This is way to expensive O(n) instead of O(log(n))
Map<Boolean, List<Triple<P, P, P>>> partition = triangles.parallelStream().collect(Collectors.partitioningBy(t -> pointsToTriangle(t).isInCircumscribedCycle(point))); Map<Boolean, List<Triple<P, P, P>>> partition = triangles.parallelStream().collect(Collectors.partitioningBy(t -> pointsToTriangle(t).isInCircumscribedCycle(point)));
List<Triple<P, P, P>> badTriangles = partition.get(true); List<Triple<P, P, P>> badTriangles = partition.get(true);
...@@ -173,7 +170,8 @@ public class BowyerWatson<P extends VPoint> { ...@@ -173,7 +170,8 @@ public class BowyerWatson<P extends VPoint> {
points.add(new VPoint(80,70));*/ points.add(new VPoint(80,70));*/
Random r = new Random(); Random r = new Random();
for(int i=0; i<100; i++) {
for(int i=0; i<10000; i++) {
VPoint point = new VPoint(width*r.nextDouble(), height*r.nextDouble()); VPoint point = new VPoint(width*r.nextDouble(), height*r.nextDouble());
points.add(point); points.add(point);
} }
......
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