Class Horizon


  • public class Horizon
    extends Object
    A Horizon is the result of n neighboring TriangularFacet which are merged. The horizon is a polygon of all outer edges/vertices of the merged TriangularFacet.
    Author:
    Tim-Oliver Buchholz (University of Konstanz)
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected List<T> neighbors
      The neighboring facets of this facet.
      protected List<Vertex> vertices
      The vertices of this facet in counter clock wise orientation.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void complexMerge​(TriangularFacet f)
      Merges another facet to this facet.
      boolean containsAll​(List<Vertex> vertexList)
      Returns true if all vertices are part of this polygon
      Vertex getLastVertex()
      Get the last vertex.
      T getNeighbor​(int position)
      Get the neighbor at position.
      List<T> getNeighbors()
      Get all neighbors.
      Vertex getVertex​(int i)
      Get the vertex at index i.
      List<Vertex> getVertices()
      The list of vertices.
      boolean hasEdge​(Vertex tail, Vertex head)
      Returns true if this facet has the edge from tail to head.
      int indexOfNeighbor​(T facet)
      Get index of a neighbor.
      int indexOfVertex​(Vertex vertex)
      Returns the index of the first occurrence of vertex.
      void replaceNeighbor​(int i, T f)
      Replaces a neighbor.
      void setNeighbor​(int position, T n)
      Sets the n-th neighbor of this facet.
      void simpleMerge​(TriangularFacet f)
      Merges another facet to this facet.
      int size()
      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() to TriangularFacet#getVertex(0).

    • 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.
      • getVertices

        public List<Vertex> getVertices()
        The list of vertices.
        Returns:
        all vertices
      • 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 edge
        head - 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 neighbor
        n - 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 replace
        f - 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