collision
pykraken.collision Collision detection functions
At a glance
2 membersReference
PYTHON APIOverloaded function.
contains(outer: Rect, inner: Rect) -> bool
Check whether one rectangle completely contains another rectangle.
Args
- outer (
Rect) — The outer rectangle. - inner (
Rect) — 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 (
Rect) — The rectangle. - circle (
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 (
Rect) — The rectangle. - line (
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 (
Circle) — The outer circle. - inner (
Circle) — 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 (
Circle) — The circle. - rect (
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 (
Circle) — The circle. - line (
Line) — The line.
Returns
- bool — True if the circle completely contains the line.
Overloaded function.
overlap(a: Rect, b: Rect) -> bool
Check whether two rectangles overlap.
Args
- a (
Rect) — The first rectangle. - b (
Rect) — 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 (
Rect) — The rectangle. - circle (
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 (
Rect) — The rectangle. - line (
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 (
Rect) — The rectangle. - point (
Vec2) — The point.
Returns
- bool — True if the rectangle contains the point.
overlap(a: Circle, b: Circle) -> bool
Check whether two circles overlap.
Args
- a (
Circle) — The first circle. - b (
Circle) — 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 (
Circle) — The circle. - rect (
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 (
Circle) — The circle. - line (
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 (
Circle) — The circle. - point (
Vec2) — 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 (
Line) — The first line. - b (
Line) — 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 (
Line) — The line. - rect (
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 (
Line) — The line. - circle (
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 (
Vec2) — The point. - rect (
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 (
Vec2) — The point. - circle (
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 (
Polygon) — The polygon. - point (
Vec2) — 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 (
Vec2) — The point. - polygon (
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 (
Polygon) — The polygon. - rect (
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 (
Rect) — The rectangle. - polygon (
Polygon) — The polygon.
Returns
- bool — True if the rectangle and polygon overlap.