The expiration time for new job artifacts in CI/CD pipelines is now 30 days (GitLab default). Previously generated artifacts in already completed jobs will not be affected by the change. The latest artifacts for all jobs in the latest successful pipelines will be kept. More information: https://gitlab.lrz.de/help/user/admin_area/settings/continuous_integration.html#default-artifacts-expiration

Commit f57323a6 authored by Benedikt Zoennchen's avatar Benedikt Zoennchen
Browse files

construction of a new half-edge datastructure to solve the point location problem

parent 8cf3f89d
......@@ -2,7 +2,6 @@ package org.vadere.util.delaunay;
import org.apache.commons.lang3.tuple.ImmutableTriple;
import org.apache.commons.lang3.tuple.Triple;
import org.vadere.util.geometry.shapes.VCircle;
import org.vadere.util.geometry.shapes.VLine;
import org.vadere.util.geometry.shapes.VPoint;
......@@ -79,6 +78,7 @@ public class BowyerWatson<P extends VPoint> {
private void handle(final P point) {
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)));
List<Triple<P, P, P>> badTriangles = partition.get(true);
......@@ -170,7 +170,6 @@ public class BowyerWatson<P extends VPoint> {
points.add(new VPoint(80,70));*/
Random r = new Random();
for(int i=0; i<10000; i++) {
VPoint point = new VPoint(width*r.nextDouble(), height*r.nextDouble());
points.add(point);
......
......@@ -2,6 +2,7 @@ package org.vadere.util.delaunay;
import org.jetbrains.annotations.NotNull;
import org.vadere.util.geometry.shapes.VPoint;
import org.vadere.util.geometry.shapes.VPolygon;
import java.awt.geom.Path2D;
......@@ -11,6 +12,7 @@ import java.util.List;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;
public class Face implements Iterable<HalfEdge> {
/**
......@@ -60,11 +62,13 @@ public class Face implements Iterable<HalfEdge> {
return new VPolygon(path2D);
}
@Override
public Iterator<HalfEdge> iterator() {
return new HalfEdgeIterator();
}
public Stream<HalfEdge> stream () {
Iterable<HalfEdge> iterable = () -> iterator();
return StreamSupport.stream(iterable.spliterator(), false);
......
package org.vadere.util.delaunay;
import org.jetbrains.annotations.NotNull;
import org.vadere.util.geometry.shapes.VLine;
import org.vadere.util.geometry.shapes.VPoint;
import java.util.Optional;
/**
* Created by bzoennchen on 13.11.16.
*/
public class HalfEdge {
/**
......@@ -36,7 +39,8 @@ public class HalfEdge {
public HalfEdge (@NotNull final VPoint end, @NotNull final Face face) {
public HalfEdge (final VPoint end, final Face face) {
this.end = end;
this.face = face;
}
......@@ -61,13 +65,15 @@ public class HalfEdge {
return previous;
}
public Optional<HalfEdge> getTwin() {
return Optional.ofNullable(twin);
public HalfEdge getTwin() {
return twin;
}
public void setTwin(final @NotNull HalfEdge twin) {
this.twin = twin;
if(!twin.getTwin().isPresent() || twin.getTwin().get() != this) {
if(twin.getTwin() != this) {
twin.setTwin(this);
}
}
......
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