Usage

First you need to create your Path objects. Assume that paths you pass are numbered from 0 to n.

After you make them, you just pass them to

line_intersect_2d.quadtrees.check_intersection()

Check whether any number of paths intersect.

Parameters
  • paths (tp.List[Path]) – paths to check

  • split_factor (float) – Factor that the tree should be constructed. Eg. for the default value of 0.1 the grid will be divided into 10 rows and 10 columns. Default is 0.1

Returns

a tuple of two segments from different paths that intersect, or None if no intersection

Return type

tp.Optional[tp.Tuple[Segment, Segment]]

Note that a split_factor will divide the grid into (1/split_factor)**2, so in case of the default split_factor of 0.1 100 subrectangles will be made.

Which will return either a tuple of (Segment, Segment) two segments from different paths (which paths it will be stored in their tag attribute, the number that was aforementioned) or None will be returned, if they don’t collide

You can use later line_intersect_2d.basics.Segment.intersection_point() to calculate the intersection point.