Package wprover
Class Circle
- java.lang.Object
-
- wprover.CClass
-
- wprover.Circle
-
public class Circle extends CClass
Represents a geometric circle with various properties and methods.
-
-
Constructor Summary
Constructors Constructor Description Circle()This class represents a circle in geometric constructions.Circle(int type, CPoint O)Constructs a Circle object with the specified type and center.Circle(CPoint O, CPoint A)Constructs a Circle object with the specified center and one point on the circle.Circle(CPoint O, CPoint A, CPoint B)Constructs a Circle object with the specified center and two points on the circle.Circle(CPoint O, CPoint A, CPoint B, CPoint C)Create a circle using the four points O, A, B, and C.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddConstraint(Constraint cs)Adds a constraint to the circle.voidaddPoint(CPoint p)Adds a point to the circle.static java.util.VectorCommonPoints(Circle c1, Circle c2)Finds the common points between two circles.voiddraw(java.awt.Graphics2D g2)Draws the circle using the given Graphics2D object.voiddraw(java.awt.Graphics2D g2, boolean selected)Draws the circle using the given Graphics2D object.java.lang.StringgetAllPointName()Gets the names of all points on the circle.doublegetCenterOX()Gets the x-coordinate of the center of the circle.doublegetCenterOY()Gets the y-coordinate of the center of the circle.java.lang.StringgetDescription()Gets the description of the circle.CPointgetP(int i)Gets the point at the specified index.doublegetRadius()Gets the radius of the circle.CPoint[]getRadiusPoint()Gets the points that define the radius of the circle.CPointgetSidePoint()Gets the point on the circle with the least index.voidLoad(java.io.DataInputStream in, DrawProcess dp)Loads the circle from a data input stream.booleannearcircle(double x, double y, double eps)Checks if the given coordinates are near the circle within a specified tolerance.booleanon_circle(double x, double y)Checks if the given coordinates are on the circle.booleanp_on_circle(CPoint p)Checks if the given point is on the circle.voidpointStickToCircle(CPoint p)Adjusts the coordinates of the given point to lie on the circle.intpsize()Gets the number of points on the circle.voidSave(java.io.DataOutputStream out)Saves the circle to a data output stream.voidSavePS(java.io.FileOutputStream fp, int stype)Saves the circle to a PostScript file.booleanselect(double x, double y)Selects the circle if the given coordinates are within its range.voidsetType(int type)Sets the type of the circle.voidSmartPonc(CPoint p)Adjusts the coordinates of the given point to lie on the circle using a smart algorithm.booleanTangent(java.lang.Object obj)Checks if the given object is tangent to the circle.java.lang.StringTypeString()Gets the type string of the circle.-
Methods inherited from class wprover.CClass
copy, get_type, getColor, getColorIndex, getname, getPSLineString, hasNameSet, isdraw, saveSuper, saveSuperColor, setAttr, setAttrAux, setColor, setDash, setInFlashing, setWidth, stopFlash, toString, visible
-
-
-
-
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 circleA- Point on the circle lineB- Point on the circle lineC- 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 circleA- the first point on the circleB- 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 circleA- 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 circleO- 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 objectselected- true if the circle is selected, false otherwise
-
draw
public void draw(java.awt.Graphics2D g2)
Draws the circle using the given Graphics2D object.
-
TypeString
public java.lang.String TypeString()
Gets the type string of the circle.- Specified by:
TypeStringin classCClass- Returns:
- the type string of the circle
-
getDescription
public java.lang.String getDescription()
Gets the description of the circle.- Specified by:
getDescriptionin classCClass- 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-coordinatey- 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-coordinatey- 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-coordinatey- the y-coordinateeps- 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 circlec2- 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.IOExceptionSaves the circle to a PostScript file.
-
Save
public void Save(java.io.DataOutputStream out) throws java.io.IOExceptionSaves the circle to a data output stream.
-
Load
public void Load(java.io.DataInputStream in, DrawProcess dp) throws java.io.IOExceptionLoads the circle from a data input stream.
-
-