Basics

The basic classes are as follows:

class line_intersect_2d.basics.Point

A single point.

This is immutable, hashable and __eq__able. Take care when comparing floats.

This overloads +, -, * and /

Parameters
  • x (float) – x coordinate

  • y (float) – y coordinate

Variables
  • x – x coordinate (float)

  • y – y coordinate (float)

add()
Returns

result of adding this point to another point

Parameters

p (Point) – point p

Returns

new Point

Return type

Point

div()
Returns

result of dividing this point by a factor

Parameters

p (float) – point p

Returns

new Point

Return type

Point

mul()
Returns

result of multiplying this point by a factor

Parameters

p (float) – point p

Returns

new Point

Return type

Point

sub()
Returns

result of the difference between this point and p

Parameters

p (Point) – point p

Returns

new Point

Return type

Point

class line_intersect_2d.basics.Segment

A segment.

This is immutable (save for tag), __eq__able and hashable.

Parameters
  • start (Vector) – start point

  • stop (Vector) – stop point

Variables
  • start – start point (Point)

  • stop – stop point (Point)

  • tag – tag (int), writable

  • q_nodes – numbers of q-nodes that this segment belongs to (tp.List[int])

intersection_point()

Get the point of intersection between this segment and s

Parameters

sa (Segment) – segment s

Returns

point of intersection

Return type

Point

Raises

ValueError – there is no intesection

class line_intersect_2d.quadtrees.Path

A path made from connected segments.

This is immutable.

Constructor works as:

>>> p = Path([Segment(...), Segment(...)])

or

>>> p = Path((x1, y1), (x2, y2), ...)
Variables

segments – list of segments (tp.List[Segment])