Package com.itextpdf.kernel.geom
Class LineSegment
java.lang.Object
com.itextpdf.kernel.geom.LineSegment
Represents a line segment in a particular coordinate system. This class is immutable.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
containsPoint
(Vector point) Checks if a segment contains a given point in itselfboolean
containsSegment
(LineSegment other) Checks if a segment contains another segment in itselfComputes the bounding rectangle for this line segment.float
Transforms the segment by the specified matrix
-
Constructor Details
-
LineSegment
Creates a new line segment.- Parameters:
-
startPoint
- the start point of a line segment. -
endPoint
- the end point of a line segment.
-
-
Method Details
-
getStartPoint
- Returns:
- the start point
-
getEndPoint
- Returns:
- the end point
-
getLength
public float getLength()- Returns:
- the length of this line segment
-
getBoundingRectangle
Computes the bounding rectangle for this line segment. The rectangle has a rotation 0 degrees with respect to the coordinate system that the line system is in. For example, if a line segment is 5 unit long and sits at a 37 degree angle from horizontal, the bounding rectangle will have origin of the lower left hand end point of the segment, with width = 4 and height = 3.- Returns:
- the bounding rectangle
-
transformBy
Transforms the segment by the specified matrix- Parameters:
-
m
- the matrix for the transformation - Returns:
- the transformed segment
-
containsSegment
Checks if a segment contains another segment in itself- Parameters:
-
other
- a segment to be checked - Returns:
- true if this segment contains other one, false otherwise
-
containsPoint
Checks if a segment contains a given point in itself- Parameters:
-
point
- a point to be checked - Returns:
- true if this segment contains given point, false otherwise
-