Package com.itextpdf.kernel.geom
Class LineSegment
- java.lang.Object
-
- com.itextpdf.kernel.geom.LineSegment
-
public class LineSegment extends java.lang.ObjectRepresents a line segment in a particular coordinate system. This class is immutable.
-
-
Field Summary
Fields Modifier and Type Field Description private VectorendPointEnd vector of the segment.private VectorstartPointStart vector of the segment.
-
Constructor Summary
Constructors Constructor Description LineSegment(Vector startPoint, Vector endPoint)Creates a new line segment.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontainsPoint(Vector point)Checks if a segment contains a given point in itselfbooleancontainsSegment(LineSegment other)Checks if a segment contains another segment in itselfRectanglegetBoundingRectangle()Computes the bounding rectangle for this line segment.VectorgetEndPoint()floatgetLength()VectorgetStartPoint()LineSegmenttransformBy(Matrix m)Transforms the segment by the specified matrix
-
-
-
Method Detail
-
getStartPoint
public Vector getStartPoint()
- Returns:
- the start point
-
getEndPoint
public Vector getEndPoint()
- Returns:
- the end point
-
getLength
public float getLength()
- Returns:
- the length of this line segment
-
getBoundingRectangle
public Rectangle 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
public LineSegment transformBy(Matrix m)
Transforms the segment by the specified matrix- Parameters:
m- the matrix for the transformation- Returns:
- the transformed segment
-
containsSegment
public boolean containsSegment(LineSegment other)
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
public boolean containsPoint(Vector point)
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
-
-