10.1.4.12. Segment

Module to implement segment.

class Patro.GeometryEngine.Segment.Segment2D(p0, p1)[source]

Bases: Patro.GeometryEngine.Primitive.Primitive2DMixin, Patro.GeometryEngine.Primitive.Primitive2P

Class to implement 2D Segment

Construct a Segment2D between two points.

__init__(p0, p1)[source]

Construct a Segment2D between two points.

center
cross(other)[source]
cross_product
direction
distance_to_point(point)[source]
intersect_with(segment2)[source]

Checks if the line segments intersect. return 1 if there is an intersection 0 otherwise

intersection(segment2)[source]
is_collinear(point)[source]

Tests if a point is on line

left_of(point)[source]

Tests if a point is left a line

length
point_at_t(t)

Return the linear interpolate of two points.

right_of(point)[source]

Tests if a point is right a line

share_vertex_with(segment2)[source]
side_of(point)[source]

Tests if a point is left/on/right of a line.

> 0 if point is left of the line = 0 if point is on the line < 0 if point is right of the line

to_line()[source]
vector