- java.lang.Object
-
- org.scijava.ops.image.geom.geom3d.Horizon
-
public class Horizon extends Object
A Horizon is the result of n neighboringTriangularFacetwhich are merged. The horizon is a polygon of all outer edges/vertices of the mergedTriangularFacet.- Author:
- Tim-Oliver Buchholz (University of Konstanz)
-
-
Constructor Summary
Constructors Constructor Description Horizon(TriangularFacet f)Create a newHorizonfrom aTriangularFacet
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcomplexMerge(TriangularFacet f)Merges another facet to this facet.booleancontainsAll(List<Vertex> vertexList)Returns true if all vertices are part of this polygonVertexgetLastVertex()Get the last vertex.TgetNeighbor(int position)Get the neighbor at position.List<T>getNeighbors()Get all neighbors.VertexgetVertex(int i)Get the vertex at index i.List<Vertex>getVertices()The list of vertices.booleanhasEdge(Vertex tail, Vertex head)Returns true if this facet has the edge from tail to head.intindexOfNeighbor(T facet)Get index of a neighbor.intindexOfVertex(Vertex vertex)Returns the index of the first occurrence of vertex.voidreplaceNeighbor(int i, T f)Replaces a neighbor.voidsetNeighbor(int position, T n)Sets the n-th neighbor of this facet.voidsimpleMerge(TriangularFacet f)Merges another facet to this facet.intsize()Get the number of vertices.
-
-
-
Field Detail
-
vertices
protected List<Vertex> vertices
The vertices of this facet in counter clock wise orientation.
-
neighbors
protected List<T> neighbors
The neighboring facets of this facet.Neighbor 0 is the neighbor which is adjacent to this facet at the edge from
UpdateablePointSet.getLastVertex()toTriangularFacet#getVertex(0).
-
-
Constructor Detail
-
Horizon
public Horizon(TriangularFacet f)
Create a newHorizonfrom aTriangularFacet- Parameters:
f- the facet
-
-
Method Detail
-
simpleMerge
public void simpleMerge(TriangularFacet f)
Merges another facet to this facet. The facet has to be connected to this facet by only one edge and only the tail and head vertex of this edge are part of this facet. Note: The neighbors of f pointing to f have to be updated manually.- Parameters:
f- the facet to merge into this facet.
-
complexMerge
public void complexMerge(TriangularFacet f)
Merges another facet to this facet. The facet has to be connected to this facet by only two consecutive edges and only the tail and head vertices of these edges are part of this facet. Note: The neighbors of f pointing to f have to be updated manually.- Parameters:
f- the facet to merge into this facet.
-
indexOfVertex
public int indexOfVertex(Vertex vertex)
Returns the index of the first occurrence of vertex.- Parameters:
vertex- the vertex- Returns:
- index of vertex or -1 if this vertex is not contained
-
getVertex
public Vertex getVertex(int i)
Get the vertex at index i.- Parameters:
i- the position- Returns:
- the vertex
-
size
public int size()
Get the number of vertices.- Returns:
- number of vertices
-
getLastVertex
public Vertex getLastVertex()
Get the last vertex.- Returns:
- the last vertex
-
containsAll
public boolean containsAll(List<Vertex> vertexList)
Returns true if all vertices are part of this polygon- Parameters:
vertexList- to check- Returns:
- true if all vertices are contained
-
hasEdge
public boolean hasEdge(Vertex tail, Vertex head)
Returns true if this facet has the edge from tail to head.- Parameters:
tail- vertex of the edgehead- vertex of the edge- Returns:
- has edge tail to head
-
setNeighbor
public void setNeighbor(int position, T n)Sets the n-th neighbor of this facet.- Parameters:
position- of the neighborn- the neighbor
-
getNeighbor
public T getNeighbor(int position)
Get the neighbor at position.- Parameters:
position- the position- Returns:
- the neighbor
-
getNeighbors
public List<T> getNeighbors()
Get all neighbors.- Returns:
- all neighbors
-
replaceNeighbor
public void replaceNeighbor(int i, T f)Replaces a neighbor.- Parameters:
i- index of the neighbor to replacef- the new neighbor
-
indexOfNeighbor
public int indexOfNeighbor(T facet)
Get index of a neighbor.- Parameters:
facet- the neighboring facet- Returns:
- the index or -1 if facet is not a neighbor
-
-