Package wprover
Class CAngle
- java.lang.Object
-
- wprover.CClass
-
- wprover.CAngle
-
public class CAngle extends CClass
Class representing an angle in a geometric construction.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static CPointcanEqual(CAngle ag1, CAngle ag2)Checks if two angles can be considered equal based on their common points and lines.voiddraw(java.awt.Graphics2D g2)Draws the angle using the given Graphics2D object.voiddraw(java.awt.Graphics2D g2, boolean isSelected)Draws the angle with the option to highlight if selected.voiddrawauxLine(double x, double y, java.awt.Graphics2D g2)Draws an auxiliary line for the angle.voiddrawauxLine1(double x, double y, CPoint p, CPoint p1, CPoint p2, java.awt.Graphics2D g2)Draws an auxiliary line from a point to the perimeter of the angle.static doubleget3pAngle(double x1, double y1, double x2, double y2, double x3, double y3)Calculates the angle between three points.static doubleget4pAngle(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4)Calculates the angle between four points.java.lang.StringgetAngleName()Gets the name of the angle based on its defining points and lines.intgetAngleType()Get the type of the angle.static doublegetAngleValue(CPoint pa, CPoint pb, CPoint pc)Calculates the angle value between three points.static doublegetAngleValue(CPoint p1, CPoint p2, CPoint p3, CPoint p4)Calculates the angle value between four points.java.lang.StringgetDescription()Gets the description of the angle.intgetRadius()Gets the radius of the angle.CTextgetText()Gets the text associated with the angle.intgetTextType()Get the type of text to display for the angle.intgetValue1()Get the value of the angle.CPointgetVertex()Gets the vertex point of the angle.doublegetxForString()Gets the x-coordinate for the angle's string representation.doublegetyForString()Gets the y-coordinate for the angle's string representation.booleanisSame(CPoint p1, CPoint p2, CPoint p3, CPoint p4)Check if two angles are the same.voidLoad(java.io.DataInputStream in, DrawProcess dp)Loads the angle data from an input stream.voidmove(double dx, double dy)Moves the angle by adjusting its radius based on the given coordinates.floatround(float r)Rounds the given angle to be within the range of -180 to 180 degrees.floatroundValue(double r)Rounds the given value to one decimal place.voidSave(java.io.DataOutputStream out)Saves the angle data to an output stream.voidSavePS(java.io.FileOutputStream fp, int stype)Saves the angle to a PostScript file.booleanselect(double x, double y)Selects the angle if the given coordinates are within the angle's range.voidsetAngleText(java.lang.String s)Sets the text of the angle.voidsetAngleType(int n)Set the type of the angle.voidsetRadius(int v)Sets the radius of the angle.voidsetShowType(int n)Sets the show type of the angle.voidsetTextType(int n)Set the type of text to display for the angle.voidsetValue1(int c)Set the value for the angle.java.lang.StringTypeString()Gets the type string of the angle.-
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
-
CAngle
public CAngle()
Constructor for CAngle.
-
CAngle
public CAngle(CLine l1, CLine l2, CPoint p1, CPoint p2, CPoint p3, CPoint p4)
Constructs a CAngle object with specified lines and points.- Parameters:
l1- The first line.l2- The second line.p1- The first point.p2- The second point.p3- The third point.p4- The fourth point.
-
-
Method Detail
-
setValue1
public void setValue1(int c)
Set the value for the angle.- Parameters:
c- The value to set.
-
getTextType
public int getTextType()
Get the type of text to display for the angle.- Returns:
- The type of text.
-
setTextType
public void setTextType(int n)
Set the type of text to display for the angle.- Parameters:
n- The type of text to set.
-
getValue1
public int getValue1()
Get the value of the angle.- Returns:
- The value of the angle.
-
setAngleType
public void setAngleType(int n)
Set the type of the angle.- Parameters:
n- The type of the angle to set.
-
getAngleType
public int getAngleType()
Get the type of the angle.- Returns:
- The type of the angle.
-
isSame
public boolean isSame(CPoint p1, CPoint p2, CPoint p3, CPoint p4)
Check if two angles are the same.- Parameters:
p1- Point 1 of angle 1.p2- Point 2 of angle 1.p3- Point 1 of angle 2.p4- Point 2 of angle 2.- Returns:
- True if the angles are the same, false otherwise.
-
setAngleText
public void setAngleText(java.lang.String s)
Sets the text of the angle.- Parameters:
s- The text to set.
-
getAngleName
public java.lang.String getAngleName()
Gets the name of the angle based on its defining points and lines.- Returns:
- The name of the angle.
-
setRadius
public void setRadius(int v)
Sets the radius of the angle.- Parameters:
v- the radius value
-
getRadius
public int getRadius()
Gets the radius of the angle.- Returns:
- the radius value
-
getText
public CText getText()
Gets the text associated with the angle.- Returns:
- the CText object representing the text
-
getxForString
public double getxForString()
Gets the x-coordinate for the angle's string representation.- Returns:
- the x-coordinate
-
getyForString
public double getyForString()
Gets the y-coordinate for the angle's string representation.- Returns:
- the y-coordinate
-
TypeString
public java.lang.String TypeString()
Gets the type string of the angle.- Specified by:
TypeStringin classCClass- Returns:
- the type string
-
getDescription
public java.lang.String getDescription()
Gets the description of the angle.- Specified by:
getDescriptionin classCClass- Returns:
- the description string
-
getVertex
public CPoint getVertex()
Gets the vertex point of the angle.- Returns:
- the vertex point
-
canEqual
public static CPoint canEqual(CAngle ag1, CAngle ag2)
Checks if two angles can be considered equal based on their common points and lines.- Parameters:
ag1- the first angleag2- the second angle- Returns:
- the common point, or null if they are not equal
-
select
public boolean select(double x, double y)Selects the angle if the given coordinates are within the angle's range.- Parameters:
x- the x-coordinatey- the y-coordinate- Returns:
- true if the angle is selected, false otherwise
-
move
public void move(double dx, double dy)Moves the angle by adjusting its radius based on the given coordinates.- Parameters:
dx- the x-coordinatedy- the y-coordinate
-
draw
public void draw(java.awt.Graphics2D g2)
Draws the angle using the given Graphics2D object.
-
drawauxLine1
public void drawauxLine1(double x, double y, CPoint p, CPoint p1, CPoint p2, java.awt.Graphics2D g2)Draws an auxiliary line from a point to the perimeter of the angle.- Parameters:
x- the x-coordinatey- the y-coordinatep- the first pointp1- the second pointp2- the third pointg2- the Graphics2D object
-
drawauxLine
public void drawauxLine(double x, double y, java.awt.Graphics2D g2)Draws an auxiliary line for the angle.- Parameters:
x- the x-coordinatey- the y-coordinateg2- the Graphics2D object
-
setShowType
public void setShowType(int n)
Sets the show type of the angle.- Parameters:
n- the show type
-
draw
public void draw(java.awt.Graphics2D g2, boolean isSelected)Draws the angle with the option to highlight if selected.- Parameters:
g2- the Graphics2D objectisSelected- true if the angle is selected, false otherwise
-
roundValue
public float roundValue(double r)
Rounds the given value to one decimal place.- Parameters:
r- the value to round- Returns:
- the rounded value
-
SavePS
public void SavePS(java.io.FileOutputStream fp, int stype) throws java.io.IOExceptionSaves the angle to a PostScript file.
-
round
public float round(float r)
Rounds the given angle to be within the range of -180 to 180 degrees.- Parameters:
r- the angle to round- Returns:
- the rounded angle
-
get3pAngle
public static double get3pAngle(double x1, double y1, double x2, double y2, double x3, double y3)Calculates the angle between three points.- Parameters:
x1- the x-coordinate of the first pointy1- the y-coordinate of the first pointx2- the x-coordinate of the second pointy2- the y-coordinate of the second pointx3- the x-coordinate of the third pointy3- the y-coordinate of the third point- Returns:
- the angle in radians
-
get4pAngle
public static double get4pAngle(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4)Calculates the angle between four points.- Parameters:
x1- the x-coordinate of the first pointy1- the y-coordinate of the first pointx2- the x-coordinate of the second pointy2- the y-coordinate of the second pointx3- the x-coordinate of the third pointy3- the y-coordinate of the third pointx4- the x-coordinate of the fourth pointy4- the y-coordinate of the fourth point- Returns:
- the angle in radians
-
getAngleValue
public static double getAngleValue(CPoint pa, CPoint pb, CPoint pc)
Calculates the angle value between three points.- Parameters:
pa- the first pointpb- the second pointpc- the third point- Returns:
- the angle value in radians
-
getAngleValue
public static double getAngleValue(CPoint p1, CPoint p2, CPoint p3, CPoint p4)
Calculates the angle value between four points.- Parameters:
p1- the first pointp2- the second pointp3- the third pointp4- the fourth point- Returns:
- the angle value in radians
-
Save
public void Save(java.io.DataOutputStream out) throws java.io.IOExceptionSaves the angle data to an output stream.
-
Load
public void Load(java.io.DataInputStream in, DrawProcess dp) throws java.io.IOExceptionLoads the angle data from an input stream.
-
-