Class SweepHullDelaunay2D.Triangle

  • Enclosing class:
    SweepHullDelaunay2D

    public static class SweepHullDelaunay2D.Triangle
    extends java.lang.Object
    Class representing a triangle, by referencing points in a list.
    Author:
    Erich Schubert
    • Field Summary

      Fields 
      Modifier and Type Field Description
      int a
      References to points in Delaunay2D.points
      int ab
      References to neighbor triangles
      int b
      References to points in Delaunay2D.points
      int bc
      References to neighbor triangles
      int c
      References to points in Delaunay2D.points
      int ca
      References to neighbor triangles
      double[] m
      Center double[]
      double r2
      Circumcircle parameters
    • Constructor Summary

      Constructors 
      Constructor Description
      Triangle​(int x, int y, int z)
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) void copyFrom​(SweepHullDelaunay2D.Triangle o)
      Copy the values from another triangle.
      (package private) SweepHullDelaunay2D.Orientation findOrientation​(SweepHullDelaunay2D.Triangle oth)
      Find the orientation of the triangles to each other.
      boolean inCircle​(double[] opp)
      Test whether a point is within the circumference circle.
      (package private) boolean isClockwise​(java.util.List<double[]> points)
      Verify that the triangle is clockwise
      (package private) void makeClockwise​(java.util.List<double[]> points)
      Make the triangle clockwise
      (package private) void replaceEdge​(int a, int b, int ol, int ne)
      Replace an edge
      (package private) void set​(int a, int ab, int b, int bc, int c, int ca)
      Update the triangle.
      java.lang.String toString()  
      private boolean updateCircumcircle​(java.util.List<double[]> points)
      Recompute the location and squared radius of circumcircle.
      • Methods inherited from class java.lang.Object

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

      • a

        public int a
        References to points in Delaunay2D.points
      • b

        public int b
        References to points in Delaunay2D.points
      • c

        public int c
        References to points in Delaunay2D.points
      • ab

        public int ab
        References to neighbor triangles
      • ca

        public int ca
        References to neighbor triangles
      • bc

        public int bc
        References to neighbor triangles
      • r2

        public double r2
        Circumcircle parameters
      • m

        public double[] m
        Center double[]
    • Constructor Detail

      • Triangle

        public Triangle​(int x,
                        int y,
                        int z)
        Constructor.
        Parameters:
        x -
        y -
        z -
    • Method Detail

      • replaceEdge

        void replaceEdge​(int a,
                         int b,
                         int ol,
                         int ne)
        Replace an edge
        Parameters:
        a - First point
        b - Second point
        ol - Previous value
        ne - New value
      • set

        void set​(int a,
                 int ab,
                 int b,
                 int bc,
                 int c,
                 int ca)
        Update the triangle.
        Parameters:
        a - First point
        ab - Edge
        b - Second point
        bc - Edge
        c - Third point
        ca - Edge
      • inCircle

        public boolean inCircle​(double[] opp)
        Test whether a point is within the circumference circle.
        Parameters:
        opp - Test double[]
        Returns:
        true when contained
      • makeClockwise

        void makeClockwise​(java.util.List<double[]> points)
        Make the triangle clockwise
      • isClockwise

        boolean isClockwise​(java.util.List<double[]> points)
        Verify that the triangle is clockwise
      • updateCircumcircle

        private boolean updateCircumcircle​(java.util.List<double[]> points)
        Recompute the location and squared radius of circumcircle.

        Note: numerical stability is important; and this is not entirely robust to degenerate cases.

        Careful: the midpoint of the circumcircle is not the average of the corners!

        Returns:
        success
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object