java.lang.Object
impl.org.controlsfx.tools.rectangle.Edge2D
The edge of a rectangle, i.e. a vertical or horizontal line segment.
-
Constructor Summary
ConstructorsConstructorDescriptionEdge2D(Point2D centerPoint, Orientation orientation, double length) Creates a new edge which is specified by its center point, orientation and length. -
Method Summary
Modifier and TypeMethodDescriptionbooleandoubleReturns the edge's lower right end point.Returns this edge's orientation.doublegetOrthogonalDifference(Point2D otherPoint) Returns the distance of the specified point to the edge in terms of the dimension orthogonal to the edge's orientation.Returns the edge's upper left end point.inthashCode()booleanIndicates whether this is ahorizontaledge.booleanIndicates whether this is ahorizontaledge.toString()
-
Constructor Details
-
Edge2D
Creates a new edge which is specified by its center point, orientation and length.- Parameters:
centerPoint- the edge's center pointorientation- the edge's orientationlength- the edge's length; must be non-negative.
-
-
Method Details
-
getUpperLeft
Returns the edge's upper left end point. It has (length/ 2) distance from the center point and depending on the edge's orientation either the same X (forOrientation.HORIZONTAL) or Y (forOrientation.VERTICAL) coordinate.- Returns:
- the edge's upper left point
-
getLowerRight
Returns the edge's lower right end point. It has (length/ 2) distance from the center point and depending on the edge's orientation either the same X (forOrientation.HORIZONTAL) or Y (forOrientation.VERTICAL) coordinate.- Returns:
- the edge's lower right point
-
getOrthogonalDifference
Returns the distance of the specified point to the edge in terms of the dimension orthogonal to the edge's orientation. The sign denotes whether on which side of the edge, the point lies.
So e.g. if the edge is horizontal, only the Y coordinate's difference between the specified point and the edge is considered. If the point lies to the right of the edge, the returned value is positive.- Parameters:
otherPoint- the point to where the distance is computed- Returns:
- the distance
-
getCenterPoint
- Returns:
- the edge's center point
-
getOrientation
Returns this edge's orientation. Note that the orientation can also be checked withisHorizontal()andisVertical().- Returns:
- the edge's orientation
-
isHorizontal
public boolean isHorizontal()Indicates whether this is ahorizontaledge.- Returns:
- true if
getOrientation()returnsOrientation.HORIZONTAL
-
isVertical
public boolean isVertical()Indicates whether this is ahorizontaledge.- Returns:
- true if
getOrientation()returnsOrientation.VERTICAL
-
getLength
public double getLength()- Returns:
- the edge's length
-
hashCode
public int hashCode() -
equals
-
toString
-