Swadge 2024 2.0.0
APIs to develop games for the Magfest Swadge
Loading...
Searching...
No Matches
geometryFl.h
Go to the documentation of this file.
1
39#ifndef _GEOMETRY_FL_H_
40#define _GEOMETRY_FL_H_
41
42#include <stdint.h>
43#include <stdbool.h>
44#include <float.h>
45#include "vectorFl2d.h"
46
48#define EPSILON 0.0001f
49
53typedef struct
54{
56 float radius;
58
62typedef struct
63{
65 float width;
66 float height;
68
73typedef struct
74{
77} lineFl_t;
78
79bool circleCircleFlIntersection(circleFl_t circle1, circleFl_t circle2, vecFl_t* collisionPoint, vecFl_t* collisionVec);
80bool circlePointFlIntersection(circleFl_t circle, vecFl_t point, vecFl_t* collisionVec);
81bool circleRectFlIntersection(circleFl_t circle, rectangleFl_t rect, vecFl_t* collisionVec);
82bool circleLineFlIntersection(circleFl_t circle, lineFl_t line, bool checkEnds, vecFl_t* cpOnLine,
83 vecFl_t* collisionVec);
84int16_t circleLineFlIntersectionPoints(circleFl_t circle, lineFl_t line, vecFl_t* intersection_1,
85 vecFl_t* intersection_2);
86bool rectRectFlIntersection(rectangleFl_t rect1, rectangleFl_t rect2, vecFl_t* collisionVec);
87bool rectLineFlIntersection(rectangleFl_t rect, lineFl_t line, vecFl_t* collisionVec);
90
91#endif
vecFl_t p2
The other end point of the line segment.
Definition geometryFl.h:76
bool rectRectFlIntersection(rectangleFl_t rect1, rectangleFl_t rect2, vecFl_t *collisionVec)
Check if two rectangles intersect.
Definition geometryFl.c:70
float height
The height of the rectangle.
Definition geometryFl.h:66
float radius
The radius of the circle.
Definition geometryFl.h:56
bool circlePointFlIntersection(circleFl_t circle, vecFl_t point, vecFl_t *collisionVec)
Check if a point and a circle intersect.
Definition geometryFl.c:46
vecFl_t infLineIntersectionPoint(lineFl_t a, lineFl_t b)
Find the intersection point between two infinitely long lines.
Definition geometryFl.c:422
bool rectLineFlIntersection(rectangleFl_t rect, lineFl_t line, vecFl_t *collisionVec)
Check if a line intersects with a rectangle.
Definition geometryFl.c:480
vecFl_t p1
One end point of the line segment.
Definition geometryFl.h:75
bool circleCircleFlIntersection(circleFl_t circle1, circleFl_t circle2, vecFl_t *collisionPoint, vecFl_t *collisionVec)
Check if two circles intersect.
Definition geometryFl.c:16
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 in...
Definition geometryFl.c:296
bool circleRectFlIntersection(circleFl_t circle, rectangleFl_t rect, vecFl_t *collisionVec)
Check if a circle and a rectangle intersect.
Definition geometryFl.c:123
bool circleLineFlIntersection(circleFl_t circle, lineFl_t line, bool checkEnds, vecFl_t *cpOnLine, vecFl_t *collisionVec)
Check if a circle and a line intersect.
Definition geometryFl.c:198
vecFl_t pos
The position of the center of the circle.
Definition geometryFl.h:55
float width
The width of the rectangle.
Definition geometryFl.h:65
bool lineLineFlIntersection(lineFl_t line1, lineFl_t line2)
Check if two lines intersect.
Definition geometryFl.c:401
Signed integer representation of a circle.
Definition geometryFl.h:54
Signed integer representation of a line segment.
Definition geometryFl.h:74
Signed integer representation of a rectangle.
Definition geometryFl.h:63
A 2D vector with signed integer X and Y components.
Definition vectorFl2d.h:37