Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add object collision classification and resolution functions #197

Open
wants to merge 26 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
89a459f
add resolve_collision
matt439 Nov 20, 2024
4f16611
add collision resolution functions
matt439 Nov 22, 2024
0d8b23d
add collision resolution tests
matt439 Nov 22, 2024
3804620
fix bug in 1st iteration
matt439 Nov 22, 2024
4785591
change sprite functions to generic point and rectangle
matt439 Nov 25, 2024
f48b45b
add collision resolution tests
matt439 Nov 27, 2024
d322135
adding overloads to sprite resolution
matt439 Nov 27, 2024
e9bedae
add triangle_quad_intersect funtion
matt439 Nov 27, 2024
0c03344
add rectangels around shapes
matt439 Nov 27, 2024
2d36d1c
fix bug in line_intersects_rect
matt439 Nov 27, 2024
0107947
simplify and remove comments
matt439 Nov 27, 2024
efba9ef
change test names
matt439 Nov 27, 2024
968e62a
add shape overloads
matt439 Nov 28, 2024
f4b8c37
add circle_quad_intersect
matt439 Nov 28, 2024
8c422e8
add rectangle_circle_intersect
matt439 Nov 28, 2024
64f1b5b
fix segmentaton fault bugs
matt439 Nov 29, 2024
ea1d2de
add tests for different objects
matt439 Nov 29, 2024
d559c6f
improve collision tests
matt439 Nov 29, 2024
7e8b2ea
change quad spawn location
matt439 Nov 29, 2024
5465c8f
add unit tests
matt439 Nov 29, 2024
a748f0b
add unit tests
matt439 Nov 29, 2024
193c5b2
remove unused constant
matt439 Nov 29, 2024
a83edda
add function description
matt439 Nov 29, 2024
cfbe64a
update parameter names in collision functions
matt439 Dec 13, 2024
cc9e2cf
add suffix to collision function overloads for translator
matt439 Dec 13, 2024
6fba89f
Change naming from sprite to object
matt439 Dec 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions coresdk/src/coresdk/circle_geometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,4 +192,19 @@ namespace splashkit_lib

return true;
}

bool circle_quad_intersect(const circle &c, const quad &q)
{
vector<triangle> q_tris = triangles_from(q);

for (size_t i = 0; i < q_tris.size(); i++)
{
if (circle_triangle_intersect(c, q_tris[i]))
{
return true;
}
}

return false;
}
}
8 changes: 8 additions & 0 deletions coresdk/src/coresdk/circle_geometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -213,5 +213,13 @@ namespace splashkit_lib
*/
bool tangent_points(const point_2d &from_pt, const circle &c, point_2d &p1, point_2d &p2);

/**
* Detects if a circle intersects with a quad.
*
* @param c The circle to test
* @param q The quad to test
* @return True if the circle and quad intersect, false otherwise
*/
bool circle_quad_intersect(const circle &c, const quad &q);
}
#endif /* circle_geometry_hpp */
Loading
Loading