Commit 875c7cb7 authored by Benedikt Zoennchen's avatar Benedikt Zoennchen

ffm bug fix, add some mesh iterators

parent 8938a8ec
......@@ -10,6 +10,7 @@ import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import java.util.stream.Stream;
......@@ -270,11 +271,6 @@ public class PMesh<P extends IPoint> implements IMesh<P, PVertex<P>, PHalfEdge<P
vertex.destroy();
}
@Override
public Stream<PFace<P>> streamFaces() {
return faces.stream();
}
@Override
public Stream<PHalfEdge<P>> streamEdges() {
return edges.stream();
......@@ -297,4 +293,14 @@ public class PMesh<P extends IPoint> implements IMesh<P, PVertex<P>, PHalfEdge<P
public List<PHalfEdge<P>> getBoundaryEdges() {
return streamEdges().filter(edge -> edge.isBoundary()).filter(edge -> !edge.isDestroyed()).collect(Collectors.toList());
}
@Override
public List<PVertex<P>> getBoundaryVertices() {
return streamEdges().filter(edge -> edge.isBoundary()).filter(edge -> !edge.isDestroyed()).map(edge -> getVertex(edge)).collect(Collectors.toList());
}
@Override
public Stream<PFace<P>> streamFaces(@NotNull Predicate<PFace<P>> predicate) {
return faces.stream().filter(predicate);
}
}
......@@ -279,7 +279,6 @@ public interface IPolyConnectivity<P extends IPoint, V extends IVertex<P>, E ext
}
default boolean contains(final double x1, final double y1, final F face) {
assert !getMesh().isBoundary(face);
return getMesh().streamEdges(face).noneMatch(edge -> isRightOf(x1, y1, edge));
}
......
......@@ -28,6 +28,12 @@ public class EdgeIterator<P extends IPoint, V extends IVertex<P>, E extends IHal
this.mesh = mesh;
}
public EdgeIterator(final IMesh<P, V, E, F> mesh, final E edge){
this.edge = edge;
this.currentHalfEdge = edge;
this.mesh = mesh;
}
@Override
public boolean hasNext() {
return currentHalfEdge != null && (!started || !currentHalfEdge.equals(edge));
......
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