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

implement a first simple point location algorithm

parent f57323a6
......@@ -2,7 +2,6 @@ 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;
......@@ -12,7 +11,6 @@ import java.util.List;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;
public class Face implements Iterable<HalfEdge> {
/**
......@@ -62,13 +60,11 @@ 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);
......
......@@ -4,7 +4,7 @@ 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.
......@@ -38,9 +38,7 @@ public class HalfEdge {
private Face face;
public HalfEdge (final VPoint end, final Face face) {
public HalfEdge (@NotNull final VPoint end, @NotNull final Face face) {
this.end = end;
this.face = face;
}
......@@ -66,14 +64,14 @@ public class HalfEdge {
}
public HalfEdge getTwin() {
return twin;
public Optional<HalfEdge> getTwin() {
return Optional.ofNullable(twin);
}
public void setTwin(final @NotNull HalfEdge twin) {
this.twin = twin;
if(twin.getTwin() != this) {
if(!twin.getTwin().isPresent() || twin.getTwin().get() != 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