pysal.lib.cg.LineSegment

class pysal.lib.cg.LineSegment(start_pt, end_pt)[source]

Geometric representation of line segment objects.

Parameters:
start_pt : Point

Point where segment begins

end_pt : Point

Point where segment ends

Attributes:
p1 : Point

HELPER METHOD.

p2 : Point

HELPER METHOD.

bounding_box : tuple

Returns the minimum bounding box of a LineSegment object.

len : float

Returns the length of a LineSegment object.

line : Line

Returns a Line object of the line which the segment lies on.

Methods

get_swap() Returns a LineSegment object which has its endpoints swapped.
intersect(other) Test whether segment intersects with other segment
is_ccw(pt) Returns whether a point is counterclockwise of the segment.
is_cw(pt) Returns whether a point is clockwise of the segment.
sw_ccw(pt) Sedgewick test for pt being ccw of segment
__init__(start_pt, end_pt)[source]

Creates a LineSegment object.

__init__(Point, Point) -> LineSegment

Test tag: <tc>#is#LineSegment.__init__</tc> Test tag: <tc>#tests#LineSegment.__init__</tc>

Examples

>>> ls = LineSegment(Point((1, 2)), Point((5, 6)))
Attributes:
None

Methods

__init__(start_pt, end_pt) Creates a LineSegment object.
get_swap() Returns a LineSegment object which has its endpoints swapped.
intersect(other) Test whether segment intersects with other segment
is_ccw(pt) Returns whether a point is counterclockwise of the segment.
is_cw(pt) Returns whether a point is clockwise of the segment.
sw_ccw(pt) Sedgewick test for pt being ccw of segment

Attributes

bounding_box Returns the minimum bounding box of a LineSegment object.
len Returns the length of a LineSegment object.
line Returns a Line object of the line which the segment lies on.
p1 HELPER METHOD.
p2 HELPER METHOD.