Package wprover
Class DrawBase
- java.lang.Object
-
- wprover.DrawBase
-
- Direct Known Subclasses:
DrawProcess
public class DrawBase extends java.lang.ObjectDrawBase is a class that provides methods for drawing geometric objects and handling user interactions. It includes methods for drawing points, lines, circles, polygons, and other geometric shapes. It also provides methods for handling mouse events and managing the drawing environment.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Vectorangleliststatic intBARYCENTERprotected java.util.VectorCatchListprotected CPointCatchPointprotected intCatchTypeprotected doublecatchXprotected doublecatchYstatic intCCTANGENTprotected static CharSetcharsetprotected java.util.Vectorcircleliststatic intCIRCUMCENTERprotected java.util.Vectorconstraintlistprotected intCurrentActionstatic intD_3PCIRCLEstatic intD_ABLINEstatic intD_ALINEstatic intD_ANGLEstatic intD_BLINEstatic intD_CCLINEstatic intD_CIR_BY_DIMstatic intD_CIRCLEstatic intD_CIRCLEBYRADIUSstatic intD_IOSTRIstatic intD_LINEstatic intD_MIDPOINTstatic intD_PARELINEstatic intD_PERPLINEstatic intD_PFOOTstatic intD_POINTstatic intD_POLYGONstatic intD_PRATIOstatic intD_PSQUAREstatic intD_PTDISTANCEstatic intD_SQUAREstatic intD_TCLINEstatic intD_TEXTstatic intD_TRATIOstatic intDISTANCEprotected java.util.Vectordistancelistprotected booleanDRAWGRIDprotected java.io.Filefileprotected doublefootMarkLengthprotected booleanfootMarkShownprotected java.awt.ColorgridColorprotected intGridXprotected intGridYprotected GExpertgxInstancestatic intH_LINEprotected doubleHeightstatic intINCENTERprotected booleanisPointOnIntersectionprotected booleanisPointOnObjectprotected Languagelanprotected java.util.Vectorlineliststatic intLRATIOstatic intMEETstatic intMIRRORprotected intmouseCatchXprotected intmouseCatchYprotected booleanmouseInsideprotected intMouseXprotected intMouseYprotected java.lang.Stringnamestatic intORTHOCENTERprotected java.util.Vectorotherlistprotected double[]paraBackupprotected intparaCounterprotected Param[]parameterprotected TPolypblistprotected intpcircleCounterstatic intPERPWITHFOOTprotected intplineCounterprotected intpnameCounterprotected java.util.Vectorpointlistprotected static GeoPolypolyprotected java.util.Vectorpolygonlistprotected TPolypolyliststatic int[][]POOLThe POOL array contains the types of geometric objects and their parameters.protected double[]pptransprotected java.util.VectorSelectListstatic intSETEQANGLEprotected booleanSNAPprotected intSTATUSprotected java.util.Vectortextlistprotected java.util.Vectortraceliststatic intV_LINEprotected doubleWidth
-
Constructor Summary
Constructors Constructor Description DrawBase()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddCircle(Circle c)Adds the specified circle to the list of circles if it is not already present.voidaddLine(CLine ln)Adds the specified line to the list of lines if it is not already present.protected booleancheck_cc_inter(Circle c1, Circle c2)Checks if two circles intersect based on their radii and center distance.protected booleancheck_lc_inter(CLine ln, Circle c2)Checks if a line and a circle intersect.static booleancheck_same_side(CPoint p1, CPoint p2, CPoint p3, CPoint p4)Checks if points p3 and p4 lie on the same side of the line defined by p1 and p2.static booleancheck_triangle_inside(CPoint p, CPoint p1, CPoint p2, CPoint p3)Determines if point p lies inside the triangle defined by p1, p2, and p3.static doublecollv(CPoint A, CPoint B, CPoint C)Computes the cross product of vectors AB and AC.booleancontainFreezedPoint()Checks if there is at least one freezed point in the diagram.CPointCreateATempPoint(double x, double y)Creates a temporary point with the specified coordinates.booleandecide_wu_identical(CPoint p1, CPoint p2)Determines whether two points are identical by comparing their Wu representations.booleandiv_set(TMono m1)Checks if the given TMono reduces to zero relative to the polynomial set.voiddrawCatch(java.awt.Graphics2D g2)Draws the catch indicator based on the current catch list and catch point.voiddrawCatchInterCross(java.awt.Graphics2D g2)Draws a cross marker to indicate an intersection catch point.voiddrawCatchObjName(java.awt.Graphics2D g2)Draws the name of the caught object if exactly one object is caught.voiddrawCatchRect(java.awt.Graphics2D g2)Draws a catch rectangle around the catch point if certain conditions are met.voiddrawcircle2p(double x1, double y1, double x2, double y2, java.awt.Graphics2D g2)Draws a circle defined by two points.voiddrawCross(int x, int y, int w, java.awt.Graphics2D g2)Draws a cross centered at the given coordinates with the specified half-width.voiddrawGrid(java.awt.Graphics2D g2)Draws the grid on the drawing area if grid drawing or snapping is enabled.voiddrawList(java.util.Vector list, java.awt.Graphics2D g2)Draws all objects in the given list using the provided Graphics2D context.voiddrawPerpFoot(java.awt.Graphics2D g2, java.util.Vector vlist, int type)Draws the perpendicular footmarks for constraints.voiddrawpoint(CPoint p, java.awt.Graphics2D g2)Draws the specified point using its own drawing method.voiddrawPointNameLocation(CPoint p, java.awt.Graphics2D g2)Draws the name and coordinate location of a point.voiddrawPointOrCross(java.awt.Graphics2D g2)Draws either a point or a cross based on the object's state.voiddrawRect(int x, int y, int x1, int y1, java.awt.Graphics2D g2)Draws a rectangle defined by two opposite corner coordinates.voiddrawSelect(java.util.Vector list, java.awt.Graphics2D g2)Draws the selection highlight for a list of geometric objects.voiddrawTipRect(int x, int y, java.awt.Graphics2D g2)Draws a tip rectangle around the specified coordinates.voiddrawTipSquare(CPoint p1, CPoint p2, CPoint p, java.awt.Graphics2D g2)Draws a tip square marker using the provided points.voiddrawTipTirangle(CPoint p1, CPoint p2, CPoint p, java.awt.Graphics2D g2)Draws a tip triangle marker based on the provided points.voiddrawTTFoot(int type, java.util.Vector vlist, java.awt.Graphics2D g2, double x, double y, CPoint pc, CPoint p1, CPoint p2)Draws two footmarks for a constraint between two lines.voidDWButtonDown(double x, double y)Handles a button down event at the specified coordinates.Circlefd_circle(CPoint p1, CPoint p2)Finds a circle defined by a center point and a point on its circumference.CLinefd_line(CPoint p1, CPoint p2)Finds and returns an existing line that connects the two specified points.booleanfind_tmark(CPoint p1, CPoint p2, CPoint p3, CPoint p4)Determines if a tmark exists that contains the specified four points.CTMarkfindCTMark(CPoint p1, CPoint p2, CPoint p3, CPoint p4)Searches for a CTMark based on two pairs of points.CPointfindPoint(java.lang.String name)Searches for a point with the given name in the point list.java.awt.RectanglegetBounds()Calculates and returns the bounding rectangle that encompasses all points, circles, and text elements.CPointgetCatchHVPoint(int CatchType)Retrieves a horizontal or vertical catch point based on the catch type.java.util.VectorgetPointList()Returns a copy of the point list.protected CPoint[]getPoints(Cons c)Retrieves an array of points extracted from the given construct.intgetPointSize()Returns the number of points in the drawing.intgetPoolA(int a, int index)Returns the parameter at a specific index for the given geometric object type.intgetPooln(int a)Returns the number of parameters for the specified geometric object type.protected TMonogetTMono(Cons c)Builds a TMono object that represents a geometric relation based on the construct.voidhvCatchPoint()Adjusts the catch point type by examining proximity to other points.double[]intersect_cc(Circle c1, Circle c2)Computes the intersection points of two circles.double[]intersect_ll(CLine ln1, CLine ln2)Computes the intersection point of two lines.booleanisFrozen()Determines if the diagram is in a frozen state.booleanisLineDrawn(CPoint p1, CPoint p2)Checks if a line connecting the two given points is drawn.protected static booleanisZero(double r)Determines if a given value is effectively zero within a tolerance.protected static booleannear(double x, double y, double x1, double y1)Checks whether two coordinates are nearly equal based on a tolerance.voidprintPoly(TPoly p)Prints the polynomial represented by the TPoly chain.voidremoveFromeListLastNElements(java.util.Vector v, int n)Removes the last n elements from the provided Vector.voidsetAntiAlias(java.awt.Graphics2D g2)Sets the antialiasing rendering hint on the provided Graphics2D object based on the application setting.voidsetCatchHVPoint(CPoint pv)Adjusts the provided point to align with a nearby point based on the catch type.voidsetCurrentDrawEnvironment(java.awt.Graphics2D g2)Sets the current drawing environment parameters such as color and stroke.voidsetLanguage(Language lan)Sets the language for the drawing environment.voidsetMouseInside(boolean t)Sets the state indicating whether the mouse is inside the drawing area.static doublesignArea(double x1, double y1, double x2, double y2, double x3, double y3)Computes the signed area determined by three points.voidunfreezeAllPoints()Unfreezes all points in the diagram.voidzoom_in(double x, double y, int zz)Zooms in the diagram from a specified center by adjusting the points.voidzoom_out(double x, double y, int zz)Zooms out the diagram from a specified center by adjusting the points.
-
-
-
Field Detail
-
D_POINT
public static final int D_POINT
- See Also:
- Constant Field Values
-
D_LINE
public static final int D_LINE
- See Also:
- Constant Field Values
-
D_PARELINE
public static final int D_PARELINE
- See Also:
- Constant Field Values
-
D_PERPLINE
public static final int D_PERPLINE
- See Also:
- Constant Field Values
-
PERPWITHFOOT
public static final int PERPWITHFOOT
- See Also:
- Constant Field Values
-
D_POLYGON
public static final int D_POLYGON
- See Also:
- Constant Field Values
-
D_CIRCLE
public static final int D_CIRCLE
- See Also:
- Constant Field Values
-
D_3PCIRCLE
public static final int D_3PCIRCLE
- See Also:
- Constant Field Values
-
D_MIDPOINT
public static final int D_MIDPOINT
- See Also:
- Constant Field Values
-
D_PSQUARE
public static final int D_PSQUARE
- See Also:
- Constant Field Values
-
D_TEXT
public static final int D_TEXT
- See Also:
- Constant Field Values
-
D_PFOOT
public static final int D_PFOOT
- See Also:
- Constant Field Values
-
D_CIRCLEBYRADIUS
public static final int D_CIRCLEBYRADIUS
- See Also:
- Constant Field Values
-
D_PTDISTANCE
public static final int D_PTDISTANCE
- See Also:
- Constant Field Values
-
D_CCLINE
public static final int D_CCLINE
- See Also:
- Constant Field Values
-
D_SQUARE
public static final int D_SQUARE
- See Also:
- Constant Field Values
-
LRATIO
public static final int LRATIO
- See Also:
- Constant Field Values
-
D_PRATIO
public static final int D_PRATIO
- See Also:
- Constant Field Values
-
CIRCUMCENTER
public static final int CIRCUMCENTER
- See Also:
- Constant Field Values
-
BARYCENTER
public static final int BARYCENTER
- See Also:
- Constant Field Values
-
ORTHOCENTER
public static final int ORTHOCENTER
- See Also:
- Constant Field Values
-
INCENTER
public static final int INCENTER
- See Also:
- Constant Field Values
-
D_TRATIO
public static final int D_TRATIO
- See Also:
- Constant Field Values
-
D_ANGLE
public static final int D_ANGLE
- See Also:
- Constant Field Values
-
SETEQANGLE
public static final int SETEQANGLE
- See Also:
- Constant Field Values
-
MEET
public static final int MEET
- See Also:
- Constant Field Values
-
D_IOSTRI
public static final int D_IOSTRI
- See Also:
- Constant Field Values
-
MIRROR
public static final int MIRROR
- See Also:
- Constant Field Values
-
DISTANCE
public static final int DISTANCE
- See Also:
- Constant Field Values
-
H_LINE
public static final int H_LINE
- See Also:
- Constant Field Values
-
V_LINE
public static final int V_LINE
- See Also:
- Constant Field Values
-
D_ALINE
public static final int D_ALINE
- See Also:
- Constant Field Values
-
D_ABLINE
public static final int D_ABLINE
- See Also:
- Constant Field Values
-
D_BLINE
public static final int D_BLINE
- See Also:
- Constant Field Values
-
D_CIR_BY_DIM
public static final int D_CIR_BY_DIM
- See Also:
- Constant Field Values
-
D_TCLINE
public static final int D_TCLINE
- See Also:
- Constant Field Values
-
CCTANGENT
public static final int CCTANGENT
- See Also:
- Constant Field Values
-
pointlist
protected java.util.Vector pointlist
-
linelist
protected java.util.Vector linelist
-
circlelist
protected java.util.Vector circlelist
-
anglelist
protected java.util.Vector anglelist
-
constraintlist
protected java.util.Vector constraintlist
-
distancelist
protected java.util.Vector distancelist
-
polygonlist
protected java.util.Vector polygonlist
-
textlist
protected java.util.Vector textlist
-
tracelist
protected java.util.Vector tracelist
-
otherlist
protected java.util.Vector otherlist
-
SelectList
protected java.util.Vector SelectList
-
CatchList
protected java.util.Vector CatchList
-
CatchPoint
protected CPoint CatchPoint
-
MouseX
protected int MouseX
-
MouseY
protected int MouseY
-
mouseCatchX
protected int mouseCatchX
-
mouseCatchY
protected int mouseCatchY
-
CatchType
protected int CatchType
-
parameter
protected Param[] parameter
-
pptrans
protected double[] pptrans
-
paraBackup
protected double[] paraBackup
-
polylist
protected TPoly polylist
-
pblist
protected TPoly pblist
-
CurrentAction
protected int CurrentAction
-
name
protected java.lang.String name
-
Width
protected double Width
-
Height
protected double Height
-
GridX
protected int GridX
-
GridY
protected int GridY
-
DRAWGRID
protected boolean DRAWGRID
-
SNAP
protected boolean SNAP
-
gridColor
protected java.awt.Color gridColor
-
paraCounter
protected int paraCounter
-
pnameCounter
protected int pnameCounter
-
plineCounter
protected int plineCounter
-
pcircleCounter
protected int pcircleCounter
-
poly
protected static GeoPoly poly
-
charset
protected static CharSet charset
-
isPointOnObject
protected boolean isPointOnObject
-
isPointOnIntersection
protected boolean isPointOnIntersection
-
catchX
protected double catchX
-
catchY
protected double catchY
-
file
protected java.io.File file
-
mouseInside
protected boolean mouseInside
-
STATUS
protected int STATUS
-
gxInstance
protected GExpert gxInstance
-
lan
protected Language lan
-
footMarkShown
protected boolean footMarkShown
-
footMarkLength
protected double footMarkLength
-
POOL
public static final int[][] POOL
The POOL array contains the types of geometric objects and their parameters. Each entry in the array represents a different type of geometric object, with the first element being the type identifier and the subsequent elements representing the number of parameters required for that object.
-
-
Method Detail
-
getPooln
public final int getPooln(int a)
Returns the number of parameters for the specified geometric object type. For a polygon (\_D\_POLYGON), returns the current status if less than 10, otherwise 0. For other types, iterates through the POOL array and returns the parameter count. Returns -1 if the type is not found.- Parameters:
a- the geometric object type identifier- Returns:
- the number of parameters for the object type, or -1 if not found
-
getPoolA
public int getPoolA(int a, int index)Returns the parameter at a specific index for the given geometric object type. Iterates through the POOL array and returns the value at the specified index. If the index is out of bounds, returns 1.- Parameters:
a- the geometric object type identifierindex- the index of the parameter to retrieve- Returns:
- the parameter value at the given index, or 1 if not found
-
setLanguage
public void setLanguage(Language lan)
Sets the language for the drawing environment.- Parameters:
lan- the Language instance to be set
-
DWButtonDown
public void DWButtonDown(double x, double y)Handles a button down event at the specified coordinates. The implementation depends on the current action.- Parameters:
x- the x-coordinate of the button down eventy- the y-coordinate of the button down event
-
setMouseInside
public void setMouseInside(boolean t)
Sets the state indicating whether the mouse is inside the drawing area.- Parameters:
t- true if the mouse is inside, false otherwise
-
CreateATempPoint
public final CPoint CreateATempPoint(double x, double y)
Creates a temporary point with the specified coordinates.- Parameters:
x- the x-coordinate of the temporary pointy- the y-coordinate of the temporary point- Returns:
- a new temporary CPoint instance
-
fd_line
public CLine fd_line(CPoint p1, CPoint p2)
Finds and returns an existing line that connects the two specified points. Returns null if no such line exists or if either point is null.- Parameters:
p1- the first pointp2- the second point- Returns:
- the CLine connecting the two points, or null if not found
-
setAntiAlias
public final void setAntiAlias(java.awt.Graphics2D g2)
Sets the antialiasing rendering hint on the provided Graphics2D object based on the application setting.- Parameters:
g2- the Graphics2D object on which to set the anti-aliasing
-
drawPerpFoot
public final void drawPerpFoot(java.awt.Graphics2D g2, java.util.Vector vlist, int type)Draws the perpendicular footmarks for constraints. Iterates through the constraint list and draws the foot for each applicable constraint. Supports constraint types such as PERPENDICULAR, PFOOT, RIGHT\_ANGLED\_TRIANGLE, and RIGHT\_ANGLE\_TRAPEZOID.- Parameters:
g2- the Graphics2D object used for drawingvlist- a Vector used for additional drawing informationtype- the mode type (0 for drawing and 1 for PostScript)
-
removeFromeListLastNElements
public final void removeFromeListLastNElements(java.util.Vector v, int n)Removes the last n elements from the provided Vector.- Parameters:
v- the Vector from which elements will be removedn- the number of elements to remove from the end
-
getPointSize
public final int getPointSize()
Returns the number of points in the drawing.- Returns:
- the size of the point list
-
getPointList
public final java.util.Vector getPointList()
Returns a copy of the point list.- Returns:
- a new Vector containing all points.
-
drawList
public final void drawList(java.util.Vector list, java.awt.Graphics2D g2)Draws all objects in the given list using the provided Graphics2D context.- Parameters:
list- the Vector containing drawable objects.g2- the Graphics2D object used for drawing.
-
drawPointNameLocation
public final void drawPointNameLocation(CPoint p, java.awt.Graphics2D g2)
Draws the name and coordinate location of a point.- Parameters:
p- the point whose location is displayed.g2- the Graphics2D context used for drawing.
-
setCurrentDrawEnvironment
public final void setCurrentDrawEnvironment(java.awt.Graphics2D g2)
Sets the current drawing environment parameters such as color and stroke.- Parameters:
g2- the Graphics2D object where the environment settings are applied.
-
drawGrid
public final void drawGrid(java.awt.Graphics2D g2)
Draws the grid on the drawing area if grid drawing or snapping is enabled.- Parameters:
g2- the Graphics2D context used for drawing the grid.
-
drawTipTirangle
public final void drawTipTirangle(CPoint p1, CPoint p2, CPoint p, java.awt.Graphics2D g2)
Draws a tip triangle marker based on the provided points.- Parameters:
p1- the first point defining the triangle.p2- the second point defining the triangle.p- the reference point for triangle alignment.g2- the Graphics2D context used for drawing.
-
drawCross
public final void drawCross(int x, int y, int w, java.awt.Graphics2D g2)Draws a cross centered at the given coordinates with the specified half-width.- Parameters:
x- the x-coordinate of the center.y- the y-coordinate of the center.w- the half-width of the cross.g2- the Graphics2D context used for drawing.
-
drawCatchRect
public void drawCatchRect(java.awt.Graphics2D g2)
Draws a catch rectangle around the catch point if certain conditions are met.- Parameters:
g2- the Graphics2D context used for drawing.
-
drawCatchInterCross
public void drawCatchInterCross(java.awt.Graphics2D g2)
Draws a cross marker to indicate an intersection catch point.- Parameters:
g2- the Graphics2D context used for drawing.
-
drawTipRect
public void drawTipRect(int x, int y, java.awt.Graphics2D g2)Draws a tip rectangle around the specified coordinates.- Parameters:
x- the x-coordinate for the tip rectangle.y- the y-coordinate for the tip rectangle.g2- the Graphics2D context used for drawing.
-
drawPointOrCross
public void drawPointOrCross(java.awt.Graphics2D g2)
Draws either a point or a cross based on the object's state.- Parameters:
g2- the Graphics2D context used for drawing.
-
drawCatchObjName
public void drawCatchObjName(java.awt.Graphics2D g2)
Draws the name of the caught object if exactly one object is caught.- Parameters:
g2- the Graphics2D context used for drawing.
-
drawTipSquare
public final void drawTipSquare(CPoint p1, CPoint p2, CPoint p, java.awt.Graphics2D g2)
Draws a tip square marker using the provided points.- Parameters:
p1- the first point defining the square.p2- the second point defining the square.p- the reference point used for adjusting the square.g2- the Graphics2D context used for drawing.
-
drawTTFoot
public void drawTTFoot(int type, java.util.Vector vlist, java.awt.Graphics2D g2, double x, double y, CPoint pc, CPoint p1, CPoint p2)Draws two footmarks for a constraint between two lines.- Parameters:
type- the drawing mode (0 for direct drawing, non-zero for vector accumulation)vlist- the vector list to add drawing points if not drawing directlyg2- the Graphics2D context to draw onx- the starting x coordinate for the footmarky- the starting y coordinate for the footmarkpc- the common point for both lines (may be null)p1- the first point defining the first linep2- the second point defining the second line
-
drawCatch
public void drawCatch(java.awt.Graphics2D g2)
Draws the catch indicator based on the current catch list and catch point. If no catch objects exist, draws smart horizontal/vertical catch lines. If one object exists, draws it with its predefined style. If multiple objects exist, displays a prompt for selection.- Parameters:
g2- the Graphics2D context to draw on
-
isLineDrawn
public boolean isLineDrawn(CPoint p1, CPoint p2)
Checks if a line connecting the two given points is drawn.- Parameters:
p1- the first pointp2- the second point- Returns:
- true if the line exists and is drawn; false otherwise
-
drawSelect
public void drawSelect(java.util.Vector list, java.awt.Graphics2D g2)Draws the selection highlight for a list of geometric objects. Iterates over the list and draws each object with selection indication.- Parameters:
list- the list of objects to be highlightedg2- the Graphics2D context to use for drawing
-
drawRect
public void drawRect(int x, int y, int x1, int y1, java.awt.Graphics2D g2)Draws a rectangle defined by two opposite corner coordinates. Four lines are drawn between the specified corners.- Parameters:
x- the x coordinate of the first cornery- the y coordinate of the first cornerx1- the x coordinate of the opposite cornery1- the y coordinate of the opposite cornerg2- the Graphics2D context for drawing
-
drawcircle2p
public void drawcircle2p(double x1, double y1, double x2, double y2, java.awt.Graphics2D g2)Draws a circle defined by two points. The first point represents the center and the distance to the second point determines the radius.- Parameters:
x1- the x coordinate of the centery1- the y coordinate of the centerx2- the x coordinate of a point on the circley2- the y coordinate of a point on the circleg2- the Graphics2D context for drawing
-
drawpoint
public void drawpoint(CPoint p, java.awt.Graphics2D g2)
Draws the specified point using its own drawing method.- Parameters:
p- the point to be drawng2- the Graphics2D context for drawing
-
addLine
public void addLine(CLine ln)
Adds the specified line to the list of lines if it is not already present.- Parameters:
ln- the line to be added
-
addCircle
public void addCircle(Circle c)
Adds the specified circle to the list of circles if it is not already present.- Parameters:
c- the circle to add
-
findPoint
public CPoint findPoint(java.lang.String name)
Searches for a point with the given name in the point list.- Parameters:
name- the name of the point to search for- Returns:
- the point with the specified name, or null if not found
-
fd_circle
public Circle fd_circle(CPoint p1, CPoint p2)
Finds a circle defined by a center point and a point on its circumference. Searches the circle list for a circle where the first point is the center and the second point lies on the circle.- Parameters:
p1- the potential center point of the circlep2- the potential point on the circumference- Returns:
- the matching circle if found; otherwise, null
-
getBounds
public java.awt.Rectangle getBounds()
Calculates and returns the bounding rectangle that encompasses all points, circles, and text elements.- Returns:
- the bounding Rectangle of the drawing.
-
signArea
public static double signArea(double x1, double y1, double x2, double y2, double x3, double y3)Computes the signed area determined by three points.- Parameters:
x1- the x-coordinate of the first point.y1- the y-coordinate of the first point.x2- the x-coordinate of the second point.y2- the y-coordinate of the second point.x3- the x-coordinate of the third point.y3- the y-coordinate of the third point.- Returns:
- the signed area value.
-
check_same_side
public static boolean check_same_side(CPoint p1, CPoint p2, CPoint p3, CPoint p4)
Checks if points p3 and p4 lie on the same side of the line defined by p1 and p2.- Parameters:
p1- first point defining the linep2- second point defining the linep3- first point to testp4- second point to test- Returns:
- true if p3 and p4 are on the same side of the line; false otherwise
-
collv
public static double collv(CPoint A, CPoint B, CPoint C)
Computes the cross product of vectors AB and AC.- Parameters:
A- the starting pointB- the end point of the first vectorC- the end point of the second vector- Returns:
- the cross product value
-
check_triangle_inside
public static boolean check_triangle_inside(CPoint p, CPoint p1, CPoint p2, CPoint p3)
Determines if point p lies inside the triangle defined by p1, p2, and p3.- Parameters:
p- the point to testp1- first vertex of the trianglep2- second vertex of the trianglep3- third vertex of the triangle- Returns:
- true if p is inside the triangle; false otherwise
-
intersect_ll
public double[] intersect_ll(CLine ln1, CLine ln2)
Computes the intersection point of two lines.- Parameters:
ln1- the first lineln2- the second line- Returns:
- a two-element array with the x and y coordinates of the intersection, or null if undefined
-
intersect_cc
public double[] intersect_cc(Circle c1, Circle c2)
Computes the intersection points of two circles.- Parameters:
c1- the first circlec2- the second circle- Returns:
- an array containing the intersection coordinates; null if there is no intersection
-
check_cc_inter
protected boolean check_cc_inter(Circle c1, Circle c2)
Checks if two circles intersect based on their radii and center distance.- Parameters:
c1- the first circlec2- the second circle- Returns:
- true if the circles intersect within the defined tolerance
-
check_lc_inter
protected boolean check_lc_inter(CLine ln, Circle c2)
Checks if a line and a circle intersect.- Parameters:
ln- the linec2- the circle- Returns:
- true if the line intersects the circle
-
isZero
protected static boolean isZero(double r)
Determines if a given value is effectively zero within a tolerance.- Parameters:
r- the value to check- Returns:
- true if the value is considered zero
-
near
protected static boolean near(double x, double y, double x1, double y1)Checks whether two coordinates are nearly equal based on a tolerance.- Parameters:
x- the first x-coordinatey- the first y-coordinatex1- the second x-coordinatey1- the second y-coordinate- Returns:
- true if the points are near each other
-
getPoints
protected CPoint[] getPoints(Cons c)
Retrieves an array of points extracted from the given construct.- Parameters:
c- the construct containing point identifiers- Returns:
- an array of points, or null if a point cannot be found
-
getTMono
protected TMono getTMono(Cons c)
Builds a TMono object that represents a geometric relation based on the construct.- Parameters:
c- the construct defining the relation- Returns:
- the constructed TMono object, or null if it cannot be built
-
decide_wu_identical
public boolean decide_wu_identical(CPoint p1, CPoint p2)
Determines whether two points are identical by comparing their Wu representations.- Parameters:
p1- the first pointp2- the second point- Returns:
- true if both points are considered identical
-
div_set
public boolean div_set(TMono m1)
Checks if the given TMono reduces to zero relative to the polynomial set.- Parameters:
m1- the TMono expression to check- Returns:
- true if the expression is effectively zero within the polynomial context
-
printPoly
public void printPoly(TPoly p)
Prints the polynomial represented by the TPoly chain.- Parameters:
p- the TPoly instance containing the polynomial
-
findCTMark
public CTMark findCTMark(CPoint p1, CPoint p2, CPoint p3, CPoint p4)
Searches for a CTMark based on two pairs of points.- Parameters:
p1- the first point of the first pairp2- the second point of the first pairp3- the first point of the second pairp4- the second point of the second pair- Returns:
- the CTMark if found, otherwise null
-
find_tmark
public boolean find_tmark(CPoint p1, CPoint p2, CPoint p3, CPoint p4)
Determines if a tmark exists that contains the specified four points.- Parameters:
p1- the first pointp2- the second pointp3- the third pointp4- the fourth point- Returns:
- true if a matching tmark is found
-
containFreezedPoint
public boolean containFreezedPoint()
Checks if there is at least one freezed point in the diagram.- Returns:
- true if any point is freezed, otherwise false
-
unfreezeAllPoints
public void unfreezeAllPoints()
Unfreezes all points in the diagram.
-
isFrozen
public boolean isFrozen()
Determines if the diagram is in a frozen state.- Returns:
- true if any point is freezed, indicating the diagram is frozen
-
zoom_out
public void zoom_out(double x, double y, int zz)Zooms out the diagram from a specified center by adjusting the points.- Parameters:
x- the x-coordinate of the zoom centery- the y-coordinate of the zoom centerzz- the zoom factor denominator
-
zoom_in
public void zoom_in(double x, double y, int zz)Zooms in the diagram from a specified center by adjusting the points.- Parameters:
x- the x-coordinate of the zoom centery- the y-coordinate of the zoom centerzz- the zoom factor denominator
-
hvCatchPoint
public void hvCatchPoint()
Adjusts the catch point type by examining proximity to other points.
-
getCatchHVPoint
public CPoint getCatchHVPoint(int CatchType)
Retrieves a horizontal or vertical catch point based on the catch type.- Parameters:
CatchType- the catch type indicator (2 for vertical, 3 for horizontal)- Returns:
- the catch point if found, otherwise null
-
setCatchHVPoint
public void setCatchHVPoint(CPoint pv)
Adjusts the provided point to align with a nearby point based on the catch type.- Parameters:
pv- the point to be adjusted
-
-