libpysal.cg.LineSegment

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

Geometric representation of line segment objects.

Parameters
start_ptPoint

Point where segment begins

end_ptPoint

Point where segment ends

Attributes
p1Point

HELPER METHOD.

p2Point

HELPER METHOD.

bounding_boxtuple

Returns the minimum bounding box of a LineSegment object.

lenfloat

Returns the length of a LineSegment object.

lineLine

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

Methods

get_swap(self)

Returns a LineSegment object which has its endpoints swapped.

intersect(self, other)

Test whether segment intersects with other segment

is_ccw(self, pt)

Returns whether a point is counterclockwise of the segment.

is_cw(self, pt)

Returns whether a point is clockwise of the segment.

sw_ccw(self, pt)

Sedgewick test for pt being ccw of segment

__init__(self, 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__(self, start_pt, end_pt)

Creates a LineSegment object.

get_swap(self)

Returns a LineSegment object which has its endpoints swapped.

intersect(self, other)

Test whether segment intersects with other segment

is_ccw(self, pt)

Returns whether a point is counterclockwise of the segment.

is_cw(self, pt)

Returns whether a point is clockwise of the segment.

sw_ccw(self, 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.