Package wprover

Class Circle


  • public class Circle
    extends CClass
    Represents a geometric circle with various properties and methods.
    • Field Detail

      • PCircle

        public static int PCircle
      • RCircle

        public static int RCircle
      • SCircle

        public static int SCircle
    • Constructor Detail

      • Circle

        public Circle()
        This class represents a circle in geometric constructions.
      • Circle

        public Circle​(CPoint O,
                      CPoint A,
                      CPoint B,
                      CPoint C)
        Create a circle using the four points O, A, B, and C.
        Parameters:
        O - Center of the circle
        A - Point on the circle line
        B - Point on the circle line
        C - Point on the circle line
      • Circle

        public Circle​(CPoint O,
                      CPoint A,
                      CPoint B)
        Constructs a Circle object with the specified center and two points on the circle.
        Parameters:
        O - the center of the circle
        A - the first point on the circle
        B - the second point on the circle
      • Circle

        public Circle​(CPoint O,
                      CPoint A)
        Constructs a Circle object with the specified center and one point on the circle.
        Parameters:
        O - the center of the circle
        A - the point on the circle
      • Circle

        public Circle​(int type,
                      CPoint O)
        Constructs a Circle object with the specified type and center.
        Parameters:
        type - the type of the circle
        O - the center of the circle
    • Method Detail

      • psize

        public int psize()
        Gets the number of points on the circle.
        Returns:
        the number of points on the circle
      • getP

        public CPoint getP​(int i)
        Gets the point at the specified index.
        Parameters:
        i - the index of the point
        Returns:
        the point at the specified index
      • p_on_circle

        public boolean p_on_circle​(CPoint p)
        Checks if the given point is on the circle.
        Parameters:
        p - the point to check
        Returns:
        true if the point is on the circle, false otherwise
      • draw

        public void draw​(java.awt.Graphics2D g2,
                         boolean selected)
        Draws the circle using the given Graphics2D object.
        Parameters:
        g2 - the Graphics2D object
        selected - true if the circle is selected, false otherwise
      • draw

        public void draw​(java.awt.Graphics2D g2)
        Draws the circle using the given Graphics2D object.
        Overrides:
        draw in class CClass
        Parameters:
        g2 - the Graphics2D object
      • TypeString

        public java.lang.String TypeString()
        Gets the type string of the circle.
        Specified by:
        TypeString in class CClass
        Returns:
        the type string of the circle
      • getDescription

        public java.lang.String getDescription()
        Gets the description of the circle.
        Specified by:
        getDescription in class CClass
        Returns:
        the description of the circle
      • select

        public boolean select​(double x,
                              double y)
        Selects the circle if the given coordinates are within its range.
        Parameters:
        x - the x-coordinate
        y - the y-coordinate
        Returns:
        true if the circle is selected, false otherwise
      • setType

        public void setType​(int type)
        Sets the type of the circle.
        Parameters:
        type - the type to set
      • getAllPointName

        public java.lang.String getAllPointName()
        Gets the names of all points on the circle.
        Returns:
        a string containing the names of all points on the circle
      • getSidePoint

        public CPoint getSidePoint()
        Gets the point on the circle with the least index.
        Returns:
        the point on the circle with the least index
      • getCenterOX

        public double getCenterOX()
        Gets the x-coordinate of the center of the circle.
        Returns:
        the x-coordinate of the center
      • getCenterOY

        public double getCenterOY()
        Gets the y-coordinate of the center of the circle.
        Returns:
        the y-coordinate of the center
      • getRadius

        public double getRadius()
        Gets the radius of the circle.
        Returns:
        the radius of the circle
      • getRadiusPoint

        public CPoint[] getRadiusPoint()
        Gets the points that define the radius of the circle.
        Returns:
        an array containing the points that define the radius
      • addConstraint

        public void addConstraint​(Constraint cs)
        Adds a constraint to the circle.
        Parameters:
        cs - the constraint to add
      • addPoint

        public void addPoint​(CPoint p)
        Adds a point to the circle.
        Parameters:
        p - the point to add
      • pointStickToCircle

        public void pointStickToCircle​(CPoint p)
        Adjusts the coordinates of the given point to lie on the circle.
        Parameters:
        p - the point to adjust
      • on_circle

        public boolean on_circle​(double x,
                                 double y)
        Checks if the given coordinates are on the circle.
        Parameters:
        x - the x-coordinate
        y - the y-coordinate
        Returns:
        true if the coordinates are on the circle, false otherwise
      • nearcircle

        public boolean nearcircle​(double x,
                                  double y,
                                  double eps)
        Checks if the given coordinates are near the circle within a specified tolerance.
        Parameters:
        x - the x-coordinate
        y - the y-coordinate
        eps - the tolerance
        Returns:
        true if the coordinates are near the circle, false otherwise
      • SmartPonc

        public void SmartPonc​(CPoint p)
        Adjusts the coordinates of the given point to lie on the circle using a smart algorithm.
        Parameters:
        p - the point to adjust
      • CommonPoints

        public static java.util.Vector CommonPoints​(Circle c1,
                                                    Circle c2)
        Finds the common points between two circles.
        Parameters:
        c1 - the first circle
        c2 - the second circle
        Returns:
        a vector of common points
      • Tangent

        public boolean Tangent​(java.lang.Object obj)
        Checks if the given object is tangent to the circle.
        Parameters:
        obj - the object to check
        Returns:
        true if the object is tangent to the circle, false otherwise
      • SavePS

        public void SavePS​(java.io.FileOutputStream fp,
                           int stype)
                    throws java.io.IOException
        Saves the circle to a PostScript file.
        Specified by:
        SavePS in class CClass
        Parameters:
        fp - the file output stream
        stype - the style type
        Throws:
        java.io.IOException - if an I/O error occurs
      • Save

        public void Save​(java.io.DataOutputStream out)
                  throws java.io.IOException
        Saves the circle to a data output stream.
        Overrides:
        Save in class CClass
        Parameters:
        out - the data output stream
        Throws:
        java.io.IOException - if an I/O error occurs
      • Load

        public void Load​(java.io.DataInputStream in,
                         DrawProcess dp)
                  throws java.io.IOException
        Loads the circle from a data input stream.
        Overrides:
        Load in class CClass
        Parameters:
        in - the data input stream
        dp - the draw process
        Throws:
        java.io.IOException - if an I/O error occurs