Collision Detection

class discopygal.geometry_utils.collision_detection.ObjectCollisionDetection(obstaclces, robot)

A class object that handles collision detection of a single object with obstacles. The collision detector builds a CGAL arrangement representing the scene and allows to (quickly) query the arrangement for collisions.

Parameters:
  • obstacles (list<Obstacle>) – list of obstacles

  • robot (Robot) – robot for building the collision detection

build_cspace()

Build the Cspace arrangement

clean_redundant_halfedges(arr)

Given an arrangement, clear any halfedge that its both incident faces are nonfree.

Parameters:

arr (Arrangement_2) – arrangement to clean

expanded_obstacle_arrangement(obstacle)

Given a robot shape and the current obstacle, generate an arrangement that contains the (single) expanded obstacle

Parameters:

obstacle (Obstacle) – obstacle to expand

Returns:

arrangement with expanded obstacle

Return type:

Arrangement_2

is_edge_valid(edge)

Check if a edge is valid (i.e. not colliding with anything).

Parameters:

edge (Segment_2) – edge to check

Returns:

False if edge intersects with the interior of an obstacle

Return type:

bool

is_point_valid(point)

Check if a point is valid (i.e. not colliding with anything).

Parameters:

point (Point_2) – point to check

Returns:

False if point lies in the interior of an obstacle

Return type:

bool

discopygal.geometry_utils.collision_detection.collide_disc_with_disc(center1, r1, center2, r2)

Collide (center ,r) disc with (center ,r) disc

Parameters:
  • center1 (Point_2) – center of the first disc to intersect

  • r1 (FT) – radius of first disc to intersect

  • center2 (Point_2) – center of the second disc to intersect

  • r2 (FT) – radius of second disc to intersect

Returns:

True if discs intersect

Return type:

bool

discopygal.geometry_utils.collision_detection.collide_disc_with_polygon(center, r, polygon)

Collide (center ,r) disc with CGAL polygon

Parameters:
  • center (Point_2) – center of the disc to intersect

  • r (FT) – radius of disc to intersect

  • polygon (Polygon_2) – polygon to intersect with

Returns:

True if disc and polygon intersect

Return type:

bool

discopygal.geometry_utils.collision_detection.collide_disc_with_rod(center, r, x, y, a, length)

Collide (center, r) disc with (x, y, a, length) rod

Parameters:
  • center (Ker.Point_2) – center of the disc to intersect

  • r (FT) – radius of disc to intersect

  • x (FT) – x of rod

  • y (FT) – y of rod

  • a (FT) – angle of rod

  • length (FT) – length of rod

Returns:

True if disc and segment intersect

Return type:

bool

discopygal.geometry_utils.collision_detection.collide_two_robots(robot1, edge1, robot2, edge2)

Get two robots and an edge of their movement, and check if at any point during their movement they intersect

Parameters:
  • robot1 (Robot) – first robot

  • edge1 (Segment_2) – first robot edge motion

  • robot2 (Robot) – second robot

  • edge2 (Segment_2) – second robot edge motion

Returns:

True if robots collide during motion

Return type:

bool