Table of Contents

Class LineSegment

Namespace
iText.Kernel.Geom
Assembly
itext.kernel.dll

Represents a line segment in a particular coordinate system.

public class LineSegment
Inheritance
LineSegment
Inherited Members

Remarks

Represents a line segment in a particular coordinate system. This class is immutable.

Constructors

LineSegment(Vector, Vector)

Creates a new line segment.

public LineSegment(Vector startPoint, Vector endPoint)

Parameters

startPoint Vector

the start point of a line segment.

endPoint Vector

the end point of a line segment.

Methods

ContainsPoint(Vector)

Checks if a segment contains a given point in itself

public virtual bool ContainsPoint(Vector point)

Parameters

point Vector

a point to be checked

Returns

bool

true if this segment contains given point, false otherwise

ContainsSegment(LineSegment)

Checks if a segment contains another segment in itself

public virtual bool ContainsSegment(LineSegment other)

Parameters

other LineSegment

a segment to be checked

Returns

bool

true if this segment contains other one, false otherwise

GetBoundingRectangle()

Computes the bounding rectangle for this line segment.

public virtual Rectangle GetBoundingRectangle()

Returns

Rectangle

the bounding rectangle

Remarks

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.

GetEndPoint()

public virtual Vector GetEndPoint()

Returns

Vector

the end point

GetLength()

public virtual float GetLength()

Returns

float

the length of this line segment

GetStartPoint()

public virtual Vector GetStartPoint()

Returns

Vector

the start point

TransformBy(Matrix)

Transforms the segment by the specified matrix

public virtual LineSegment TransformBy(Matrix m)

Parameters

m Matrix

the matrix for the transformation

Returns

LineSegment

the transformed segment