Class Circumcircle


  • public class Circumcircle
    extends Object
    Provides center coordinates and radius for a circumcircle.
    • Constructor Detail

      • Circumcircle

        public Circumcircle()
        Standard constructor.
    • Method Detail

      • getRadiusSq

        public double getRadiusSq()
        Gets the square of the radius of the circumcircle.
        Returns:
        for a non-degenerate triangle, a positive floating point value (potentially Infinity for a ghost triangle).
      • getRadius

        public double getRadius()
        Gets the radius of the circumcircle
        Returns:
        for a non-degenerate triangle, a positive floating point value
      • getX

        public double getX()
        Gets the x coordinate of the center of the circumcircle.
        Returns:
        a valid floating point value.
      • getY

        public double getY()
        Gets the y coordinate of the center of the circumcircle.
        Returns:
        a valid floating point value.
      • getCircumcenter

        public Vertex getCircumcenter()
        Gets a vertex representing the center of this circumcircle.
        Returns:
        a valid vertex (with z coordinate set to NaN).
      • copy

        public void copy​(Circumcircle c)
        Copies the content of the specified circumcircle instance.
        Parameters:
        c - a valid circumcircle instance.
      • computeCircumcircle

        public static Circumcircle computeCircumcircle​(Vertex a,
                                                       Vertex b,
                                                       Vertex c)
        Computes the circumcircle for the specified vertices. Vertices are assumed to be given in counterclockwise order. Any null inputs for the vertices results in an infinite circumcircle. Vertices resulting in a degenerate (nearly zero area) triangle result in an infinite circumcircle.
        Parameters:
        a - the initial vertex.
        b - the second vertex.
        c - the third vertex.
        Returns:
        a valid circumcircle.
      • compute

        public boolean compute​(Vertex a,
                               Vertex b,
                               Vertex c)
        Computes the circumcircle for the specified vertices and stores results in elements of this instance. Vertices are assumed to be given in counterclockwise order. Any null inputs for the vertices results in an infinite circumcircle. Vertices resulting in a degenerate (nearly zero area) triangle result in an infinite circumcircle.
        Parameters:
        a - the initial vertex.
        b - the second vertex.
        c - the third vertex.
        Returns:
        true if the computation successfully yields a circle of finite radius; otherwise, false.
      • compute

        public void compute​(double x0,
                            double y0,
                            double x1,
                            double y1,
                            double x2,
                            double y2)
        Computes the circumcircle for the specified vertices and stores results in elements of this instance. Vertices are assumed to be given in counterclockwise order. Any null inputs for the vertices results in an infinite circumcircle. Vertices resulting in a degenerate (nearly zero area) triangle result in an infinite circumcircle.
        Parameters:
        x0 - the x coordinate of the first vertex
        y0 - the y coordinate of the first vertex
        x1 - the x coordinate of the second vertex
        y1 - the y coordinate of the second vertex
        x2 - the x coordinate of the third vertex
        y2 - the y coordinate of the third vertex
      • setCircumcenter

        public void setCircumcenter​(double x,
                                    double y,
                                    double r2)
        Sets the coordinate for the circumcenter and radius for this instance.
        Parameters:
        x - the x coordinate for the circumcenter
        y - the y coordinate for the circumcenter
        r2 - the square of the radius for the circumcircle
      • getBounds

        public Rectangle2D getBounds()
        Gets the bounds of the circumcircle.
        Returns:
        a valid rectangle instance.