Class Voronoi.Triangle

java.lang.Object
squidpony.squidmath.Voronoi.Triangle
All Implemented Interfaces:
Serializable
Enclosing class:
Voronoi

public static class Voronoi.Triangle
extends Object
implements Serializable
See Also:
Serialized Form
  • Field Details

  • Constructor Details

    • Triangle

      Constructor of the 2D triangle class used to create a new triangle instance from three 2D vectors describing the triangle's vertices.
      Parameters:
      a - The first vertex of the triangle
      b - The second vertex of the triangle
      c - The third vertex of the triangle
  • Method Details

    • contains

      public boolean contains​(CoordDouble point)
      Tests if a 2D point lies inside this 2D triangle. See Real-Time Collision Detection, chap. 5, p. 206.
      Parameters:
      point - The point to be tested
      Returns:
      Returns true iff the point lies inside this 2D triangle
    • isPointInCircumcircle

      public boolean isPointInCircumcircle​(CoordDouble point)
      Tests if a given point lies in the circumcircle of this triangle. Let the triangle ABC appear in counterclockwise (CCW) order. Then when det > 0, the point lies inside the circumcircle through the three points a, b and c. If instead det < 0, the point lies outside the circumcircle. When det = 0, the four points are cocircular. If the triangle is oriented clockwise (CW) the result is reversed. See Real-Time Collision Detection, chap. 3, p. 34.
      Parameters:
      point - The point to be tested
      Returns:
      Returns true iff the point lies inside the circumcircle through the three points a, b, and c of the triangle
    • isOrientedCCW

      public boolean isOrientedCCW()
      Test if this triangle is oriented counterclockwise (CCW). Let A, B and C be three 2D points. If det > 0, C lies to the left of the directed line AB. Equivalently the triangle ABC is oriented counterclockwise. When det < 0, C lies to the right of the directed line AB, and the triangle ABC is oriented clockwise. When det = 0, the three points are colinear. See Real-Time Collision Detection, chap. 3, p. 32
      Returns:
      Returns true iff the triangle ABC is oriented counterclockwise (CCW)
    • isNeighbor

      public boolean isNeighbor​(Voronoi.Edge edge)
      Returns true if this triangle contains the given edge.
      Parameters:
      edge - The edge to be tested
      Returns:
      Returns true if this triangle contains the edge
    • isNeighbor

      public boolean isNeighbor​(CoordDouble ea, CoordDouble eb)
    • getNonEdgeVertex

      Returns the vertex of this triangle that is not part of the given edge.
      Parameters:
      edge - The edge
      Returns:
      The vertex of this triangle that is not part of the edge
    • getNonEdgeVertex

    • hasVertex

      public boolean hasVertex​(CoordDouble vertex)
      Returns true if the given vertex is one of the vertices describing this triangle.
      Parameters:
      vertex - The vertex to be tested
      Returns:
      Returns true if the Vertex is one of the vertices describing this triangle
    • toString

      public String toString()
      Overrides:
      toString in class Object