Package pointgon

Class Edge

java.lang.Object
pointgon.Edge
All Implemented Interfaces:
Serializable, Comparable<Edge>

public class Edge extends Object implements Comparable<Edge>, Serializable
Class for the edges of a triangulation of a pointgon.
Since:
2005.02.18 (Christian Borgelt)
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected Vertex
    destination vertex
    protected int
    edge identifier
    protected Vertex
    source vertex
    protected double
    weight/length of the edge
  • Constructor Summary

    Constructors
    Constructor
    Description
    Edge(Vertex src, Vertex dst)
    Create an edge.
    Edge(Vertex src, Vertex dst, double wgt)
    Create an edge.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Compare two edges by their weight.
    double
    distance(double x, double y)
    Compute the distance of the edge to a given vertex.
    double
    Compute the distance of the edge to a given vertex.
    boolean
    isects(Edge edge)
    Check whether the edge intersects a given edge.
    boolean
    isects(Vertex src, Vertex dst)
    Check whether the edge intersects the given edge.
    double
    Get the length of the edge.
    boolean
    meets(Edge edge)
    Check whether the edge meets a given edge.
    boolean
    meets(Vertex src, Vertex dst)
    Check whether the edge meets the given edge.
    Create a string description of an edge.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • id

      protected int id
      edge identifier
    • src

      protected Vertex src
      source vertex
    • dst

      protected Vertex dst
      destination vertex
    • wgt

      protected double wgt
      weight/length of the edge
  • Constructor Details

    • Edge

      public Edge(Vertex src, Vertex dst)
      Create an edge.
      Parameters:
      src - the source vertex
      dst - the destination vertex
      Since:
      2005.02.18 (Christian Borgelt)
    • Edge

      public Edge(Vertex src, Vertex dst, double wgt)
      Create an edge.
      Parameters:
      src - the source vertex
      dst - the destination vertex
      wgt - the weight / length of the edge
      Since:
      2005.02.18 (Christian Borgelt)
  • Method Details

    • length

      public double length()
      Get the length of the edge.
      Returns:
      the length of the edge
      Since:
      2005.02.18 (Christian Borgelt)
    • meets

      public boolean meets(Edge edge)
      Check whether the edge meets a given edge.
      Parameters:
      edge - the edge to check
      Returns:
      whether the edge meets the given edge
      Since:
      2005.02.18 (Christian Borgelt)
    • meets

      public boolean meets(Vertex src, Vertex dst)
      Check whether the edge meets the given edge.
      Parameters:
      src - the source vertex of the edge to check
      dst - the destination vertex of the edge to check
      Returns:
      whether the edge meets the given edge
      Since:
      2005.02.18 (Christian Borgelt)
    • isects

      public boolean isects(Edge edge)
      Check whether the edge intersects a given edge.
      Parameters:
      edge - the edge to check
      Returns:
      whether the edge intersects the given edge
      Since:
      2005.02.18 (Christian Borgelt)
    • isects

      public boolean isects(Vertex src, Vertex dst)
      Check whether the edge intersects the given edge.
      Parameters:
      src - the source vertex of the edge to check
      dst - the destination vertex of the edge to check
      Returns:
      whether the edge intersects the given edge
      Since:
      2005.02.18 (Christian Borgelt)
    • distance

      public double distance(Vertex v)
      Compute the distance of the edge to a given vertex.
      Parameters:
      v - the vertex to which to compute the distance
      Returns:
      the distance of the edge to a given vertex
      Since:
      2005.02.18 (Christian Borgelt)
    • distance

      public double distance(double x, double y)
      Compute the distance of the edge to a given vertex.
      Parameters:
      x - the x-coordinate of the vertex
      y - the y-coordinate of the vertex
      Returns:
      the distance of the edge to a given vertex
      Since:
      2005.02.18 (Christian Borgelt)
    • compareTo

      public int compareTo(Edge obj)
      Compare two edges by their weight.
      Specified by:
      compareTo in interface Comparable<Edge>
      Parameters:
      obj - the edge to compare to
      Since:
      2005.02.18 (Christian Borgelt)
    • toString

      public String toString()
      Create a string description of an edge.
      Overrides:
      toString in class Object
      Returns:
      a string description of the edge
      Since:
      2005.02.18 (Christian Borgelt)