Swadge 2024 2.0.0
APIs to develop games for the Magfest Swadge
|
Functions | |
bool | circleCircleFlIntersection (circleFl_t circle1, circleFl_t circle2, vecFl_t *collisionPoint, vecFl_t *collisionVec) |
Check if two circles intersect. | |
bool | circlePointFlIntersection (circleFl_t circle, vecFl_t point, vecFl_t *collisionVec) |
Check if a point and a circle intersect. | |
bool | rectRectFlIntersection (rectangleFl_t rect1, rectangleFl_t rect2, vecFl_t *collisionVec) |
Check if two rectangles intersect. | |
bool | circleRectFlIntersection (circleFl_t circle, rectangleFl_t rect, vecFl_t *collisionVec) |
Check if a circle and a rectangle intersect. | |
bool | circleLineFlIntersection (circleFl_t circle, lineFl_t line, bool checkEnds, vecFl_t *cpOnLine, vecFl_t *collisionVec) |
Check if a circle and a line intersect. | |
int16_t | circleLineFlIntersectionPoints (circleFl_t circle, lineFl_t line, vecFl_t *intersection_1, vecFl_t *intersection_2) |
Find the points of intersection between a circle's circumference and a line. There may be zero (no intersection), one (tangent), or two points of intersection. | |
bool | lineLineFlIntersection (lineFl_t a, lineFl_t b) |
Check if two lines intersect. | |
vecFl_t | infLineIntersectionPoint (lineFl_t a, lineFl_t b) |
Find the intersection point between two infinitely long lines. | |
bool | rectLineFlIntersection (rectangleFl_t rect, lineFl_t line, vecFl_t *collisionVec) |
Check if a line intersects with a rectangle. | |
bool circleCircleFlIntersection | ( | circleFl_t | circle1, |
circleFl_t | circle2, | ||
vecFl_t * | collisionPoint, | ||
vecFl_t * | collisionVec ) |
Check if two circles intersect.
circle1 | [IN] One circle to check for intersection, assumed to be moving |
circle2 | [IN] The other circle to check for intersection, assumed to be fixed |
collisionPoint | [OUT] The point at which the two circles collide, on the circumference of circle2. May be NULL |
collisionVec | [OUT] A vector pointing from the second circle to the first in the direction of the collision. May be NULL. |
bool circlePointFlIntersection | ( | circleFl_t | circle, |
vecFl_t | point, | ||
vecFl_t * | collisionVec ) |
Check if a point and a circle intersect.
circle | [IN] A circle to check for intersection |
point | [IN] A point to check for intersection |
collisionVec | [OUT] A vector pointing from the point to the circle in the direction of the collision. May be NULL. |
bool rectRectFlIntersection | ( | rectangleFl_t | rect1, |
rectangleFl_t | rect2, | ||
vecFl_t * | collisionVec ) |
Check if two rectangles intersect.
Adapted from https://www.jeffreythompson.org/collision-detection/rect-rect.php
rect1 | [IN] One rectangle to check for intersection |
rect2 | [IN] The other rectangle to check for intersection |
collisionVec | [OUT] A vector pointing from the second rectangle to the first in the direction of the collision. May be NULL. |
bool circleRectFlIntersection | ( | circleFl_t | circle, |
rectangleFl_t | rect, | ||
vecFl_t * | collisionVec ) |
Check if a circle and a rectangle intersect.
Adapted from https://www.jeffreythompson.org/collision-detection/circle-rect.php
circle | [IN] The circle to check for intersection |
rect | [IN] The rectangle to check for intersection |
collisionVec | [OUT] A vector pointing from the rectangle to the circle in the direction of the collision. May be NULL. |
bool circleLineFlIntersection | ( | circleFl_t | circle, |
lineFl_t | line, | ||
bool | checkEnds, | ||
vecFl_t * | cpOnLine, | ||
vecFl_t * | collisionVec ) |
Check if a circle and a line intersect.
Adapted from https://www.jeffreythompson.org/collision-detection/line-circle.php
circle | [IN] A circle to test intersection |
line | [IN] A line to test intersection |
checkEnds | [IN] True to check the points at the end of the line, false to ignore them |
cpOnLine | [OUT] The closest point on the line to the circle |
collisionVec | [OUT] A vector pointing from the line to the circle in the direction of the collision. This may be NULL. |
int16_t circleLineFlIntersectionPoints | ( | circleFl_t | circle, |
lineFl_t | line, | ||
vecFl_t * | intersection_1, | ||
vecFl_t * | intersection_2 ) |
Find the points of intersection between a circle's circumference and a line. There may be zero (no intersection), one (tangent), or two points of intersection.
See https://cp-algorithms.com/geometry/circle-line-intersection.html
circle | [IN] The circle to check for intersection |
line | [IN] The line to check for intersection |
intersection_1 | [OUT] If it exists, the first intersection will be written to this pointer |
intersection_2 | [OUT] If it exists, the second intersection will be written to this pointer |
intersection_1
is filled before intersection_2
. Check if two lines intersect.
Adapted from https://www.jeffreythompson.org/collision-detection/line-line.php
a | [IN] One line to check for intersection |
b | [IN] Another line to check for intersection |
Find the intersection point between two infinitely long lines.
a | One infinitely long line |
b | Another infinitely long line |
bool rectLineFlIntersection | ( | rectangleFl_t | rect, |
lineFl_t | line, | ||
vecFl_t * | collisionVec ) |
Check if a line intersects with a rectangle.
Adapted from https://www.jeffreythompson.org/collision-detection/line-rect.php
rect | [IN] A rectangle to check for intersection |
line | [IN] A line to check for intersection |
collisionVec | [OUT] A vector pointing from the rectangle to the line in the direction of the collision. May be NULL. |