Collision

Collision detection functions


Contains

contains(outer: Rect, inner: Rect) bool

Check whether one rectangle completely contains another rectangle.

Args

  • outer : The outer rectangle.
  • inner : The inner rectangle.

Returns

bool : True if the outer rectangle completely contains the inner rectangle.


contains(rect: Rect, circle: Circle) bool

Check whether a rectangle completely contains a circle.

Args

  • rect : The rectangle.
  • circle : The circle.

Returns

bool : True if the rectangle completely contains the circle.


contains(rect: Rect, line: Line) bool

Check whether a rectangle completely contains a line.

Args

  • rect : The rectangle.
  • line : The line.

Returns

bool : True if the rectangle completely contains the line.


contains(outer: Circle, inner: Circle) bool

Check whether one circle completely contains another circle.

Args

  • outer : The outer circle.
  • inner : The inner circle.

Returns

bool : True if the outer circle completely contains the inner circle.


contains(circle: Circle, rect: Rect) bool

Check whether a circle completely contains a rectangle.

Args

  • circle : The circle.
  • rect : The rectangle.

Returns

bool : True if the circle completely contains the rectangle.


contains(circle: Circle, line: Line) bool

Check whether a circle completely contains a line.

Args

  • circle : The circle.
  • line : The line.

Returns

bool : True if the circle completely contains the line.

Overlap

overlap(a: Rect, b: Rect) bool

Check whether two rectangles overlap.

Args

  • a : The first rectangle.
  • b : The second rectangle.

Returns

bool : True if the rectangles overlap.


overlap(rect: Rect, circle: Circle) bool

Check whether a rectangle and a circle overlap.

Args

  • rect : The rectangle.
  • circle : The circle.

Returns

bool : True if the rectangle and circle overlap.


overlap(rect: Rect, line: Line) bool

Check whether a rectangle and a line overlap.

Args

  • rect : The rectangle.
  • line : The line.

Returns

bool : True if the rectangle and line overlap.


overlap(rect: Rect, point: Vec2) bool

Check whether a rectangle contains a point.

Args

  • rect : The rectangle.
  • point : The point.

Returns

bool : True if the rectangle contains the point.


overlap(a: Circle, b: Circle) bool

Check whether two circles overlap.

Args

  • a : The first circle.
  • b : The second circle.

Returns

bool : True if the circles overlap.


overlap(circle: Circle, rect: Rect) bool

Check whether a circle and a rectangle overlap.

Args

  • circle : The circle.
  • rect : The rectangle.

Returns

bool : True if the circle and rectangle overlap.


overlap(circle: Circle, line: Line) bool

Check whether a circle and a line overlap.

Args

  • circle : The circle.
  • line : The line.

Returns

bool : True if the circle and line overlap.


overlap(circle: Circle, point: Vec2) bool

Check whether a circle contains a point.

Args

  • circle : The circle.
  • point : The point.

Returns

bool : True if the circle contains the point.


overlap(a: Line, b: Line) bool

Check whether two lines overlap (intersect).

Args

  • a : The first line.
  • b : The second line.

Returns

bool : True if the lines intersect.


overlap(line: Line, rect: Rect) bool

Check whether a line and a rectangle overlap.

Args

  • line : The line.
  • rect : The rectangle.

Returns

bool : True if the line and rectangle overlap.


overlap(line: Line, circle: Circle) bool

Check whether a line and a circle overlap.

Args

  • line : The line.
  • circle : The circle.

Returns

bool : True if the line and circle overlap.


overlap(point: Vec2, rect: Rect) bool

Check whether a point is inside a rectangle.

Args

  • point : The point.
  • rect : The rectangle.

Returns

bool : True if the point is inside the rectangle.


overlap(point: Vec2, circle: Circle) bool

Check whether a point is inside a circle.

Args

  • point : The point.
  • circle : The circle.

Returns

bool : True if the point is inside the circle.


overlap(polygon: Polygon, point: Vec2) bool

Check whether a polygon contains a point.

Args

  • polygon : The polygon.
  • point : The point.

Returns

bool : True if the polygon contains the point.


overlap(point: Vec2, polygon: Polygon) bool

Check whether a point is inside a polygon.

Args

  • point : The point.
  • polygon : The polygon.

Returns

bool : True if the point is inside the polygon.


overlap(polygon: Polygon, rect: Rect) bool

Check whether a polygon and a rectangle overlap.

Args

  • polygon : The polygon.
  • rect : The rectangle.

Returns

bool : True if the polygon and rectangle overlap.


overlap(rect: Rect, polygon: Polygon) bool

Check whether a rectangle and a polygon overlap.

Args

  • rect : The rectangle.
  • polygon : The polygon.

Returns

bool : True if the rectangle and polygon overlap.