Commit Graph

361 Commits

Author SHA1 Message Date
0e03805439 added nodiscard + static 2025-12-04 04:46:00 +03:00
eafefb40ec fixed typo 2025-12-04 04:45:15 +03:00
9e4c778e8f tweak 2025-12-04 04:38:44 +03:00
0788fd6122 replaced with emplace 2025-12-03 14:11:29 +03:00
3685f13344 back to static 2025-12-03 13:34:35 +03:00
d4d8f70fff switched to shared_ptr 2025-12-03 13:30:05 +03:00
918858e255 added poly allocators 2025-12-03 09:52:53 +03:00
1aff083ef3 fixed uv type 2025-12-01 05:03:43 +03:00
3a66b66c6a fixed somebugs, improved tests 2025-11-29 21:24:45 +03:00
e54d5e7388 changed ebo type 2025-11-29 16:49:19 +03:00
9a89e2467e fix 2025-11-29 16:37:30 +03:00
48bf06f69c refactored using stuff 2025-11-29 16:35:43 +03:00
8feddf872a added conecpt to method 2025-11-29 16:33:31 +03:00
99ebdeb188 added template arg to Vertex struct 2025-11-29 16:31:24 +03:00
ba267cbcb8 improved mesh class 2025-11-29 16:28:06 +03:00
0283935918 added std::optional 2025-11-13 21:25:45 +03:00
12f888b8d4 Calculates penetration vector for EPA algorithm
Adds `penetration_vector` to the `epa_result` struct to represent the direction and magnitude of penetration.

This allows for more accurate collision response calculations and simplifies access to penetration information.

Updates both the early-exit and iterative EPA calculations within `epa_algorithm.hpp` to compute and store the penetration vector, factoring in the relative origin of the colliding meshes.
2025-11-13 21:19:09 +03:00
798caa2b0d made ref 2025-11-13 17:34:39 +03:00
fa91f21e39 Refactors collision detection with GJK and EPA
This commit refactors the collision detection pipeline to utilize a more standard GJK algorithm and simplifies the EPA implementation.

Removes the custom `GjkAlgorithmWithSimplex` in favor of the standalone `GjkAlgorithm`. This streamlines the collision detection process and enhances code clarity.

Updates unit tests to align with the new GJK implementation, ensuring continued functionality and correctness.
2025-11-13 16:39:26 +03:00
20aecac2ae Refactors vertex parameter name
Updates the `make_face` function to use `vertexes` instead of `verts` for clarity and consistency in naming conventions.
2025-11-13 16:16:23 +03:00
09fd92ccad Refactor EPA algorithm for clarity
Improves code organization and readability within the EPA algorithm implementation.

Changes include renaming variables for better semantic meaning (e.g., `verts` to `vertexes`), adding `final` specifiers to structs for clarity, and enhancing function signatures with `[[nodiscard]]` where appropriate.

These refactorings aim to enhance maintainability and understanding of the code without altering its core functionality.
2025-11-13 16:15:45 +03:00
2b21caf58f Refactors face initialization
Replaces `push_back` with `emplace_back` when initializing faces in the EPA algorithm. This avoids unnecessary copying and improves performance during face creation.
2025-11-13 16:07:57 +03:00
40e26be72e Refactors EPA algorithm loop
Replaces the `for(;;)` loop in the EPA algorithm with a `while(true)` loop for improved readability and clarity.

This change enhances the maintainability of the code without altering its functionality.
2025-11-13 16:06:18 +03:00
2699053102 fixed formating 2025-11-13 16:01:42 +03:00
06b597f37c added epa 2025-11-13 15:57:38 +03:00
6d3b543648 Refactors triangle calculations for generic vectors
Updates the `Triangle` class to use a generic `Vector` type instead of `Vector3`, enhancing flexibility and reusability.

Changes include updating relevant function return types to use `Vector::ContainedType` and adapting length and distance calculations accordingly.

This refactoring supports the ongoing work on the EPA algorithm (feature/epa_algorithm) by providing a more adaptable foundation for geometric calculations.
2025-11-13 15:29:10 +03:00
c515dc89a9 Adds GjkHitInfo and refactors collision detection
Introduces `GjkHitInfo` to encapsulate collision results, including the simplex.

Refactors `is_collide` to return the `GjkHitInfo` struct, providing more detailed collision data. This prepares the codebase for integrating the EPA algorithm (as per the feature branch) which requires simplex information.
2025-11-13 13:33:18 +03:00
66919af46a Refactors GJK algorithm vertex type
Simplifies the GJK algorithm by using a type alias for the vertex type, improving code readability and reducing redundancy. Removes unnecessary includes.
2025-11-11 23:37:56 +03:00
28ef194586 Adds nodiscard attribute to simplex functions
Applies the `[[nodiscard]]` attribute to several functions within the `omath::collision` namespace to improve code safety and signal potential misuse when return values are ignored. This encourages developers to handle the results of these functions appropriately.
2025-11-11 23:36:19 +03:00
05bc7577b5 Refactors perpendicular vector selection
Simplifies logic for finding a non-zero perpendicular vector by iterating through candidate directions. This improves readability and maintainability.
2025-11-11 23:34:30 +03:00
8f225c5f8e forgot keyname 2025-11-09 23:23:13 +03:00
44682b6f2c added other collision types 2025-11-09 22:39:09 +03:00
a6cf043d79 style fix 2025-11-09 22:27:04 +03:00
3968d13a19 removed redundant headers 2025-11-09 22:25:29 +03:00
6da44a5a51 added mesh class, added mesh trair 2025-11-09 22:10:56 +03:00
e5d8e1c953 add mesh class 2025-11-09 21:28:00 +03:00
e2378bfa8b Refactors Simplex class for GJK algorithm
Simplifies Simplex initialization and accessors.

Ensures correct handling of collinearity within the simplex calculation, preventing issues when colliders share the same origin. This improves stability and reliability of the GJK algorithm.
2025-11-09 17:29:50 +03:00
ca3dab855b Corrects transform order for collider
Reorders the transform application to translation, scale, then rotation.

This ensures the collider’s world matrix is constructed correctly, preventing potential scaling or rotation issues in the GJK algorithm being developed on this branch.
2025-11-09 17:15:01 +03:00
c4024663bb Auto stash before checking out "origin/feature/gjk_algorithm" 2025-11-09 17:08:57 +03:00
b2a512eafe Adds mesh scaling to mesh collider
Updates the mesh collider to include a scale parameter, allowing for non-uniform scaling of the collision mesh.

This provides more flexibility in defining collision shapes and supports a wider range of scenarios.
2025-11-09 17:02:07 +03:00
0b663b73d5 Handles collinear cases in simplex collision
Adds helper functions to address near-zero vectors and find perpendicular directions.

This prevents potential crashes and improves robustness when the origin lies on the line defined by the simplex edges during GJK collision detection.
2025-11-09 16:56:38 +03:00
afc0720f08 Refactor: Simplify GJK simplex handling
Removes the separate `Simplex` class and integrates its functionality directly into the `GjkAlgorithm`. This simplifies the code and reduces unnecessary overhead.

Updates tests to align with refactored implementation.
2025-11-09 16:02:13 +03:00
015fc9b1e7 made final 2025-11-09 15:51:28 +03:00
62d1a615ae fix 2025-11-09 15:50:07 +03:00
043b5c588d updated 2025-11-09 15:39:11 +03:00
cd18b088cb updated test 2025-11-09 15:38:38 +03:00
ebfdd0b70e Refactors simplex handling in GJK algorithm
Updates simplex handling to use references for vertex access, avoiding unnecessary copies. This improves performance and clarity within the GJK algorithm.
2025-11-09 14:40:22 +03:00
e7b82f441c patch 2025-11-09 14:23:34 +03:00
6e59957247 Adds mat_scale function
Introduces a utility function to create a scaling matrix from a Vector3.
This simplifies the creation of scale transformations, particularly useful for the GJK algorithm implementation.
2025-11-09 14:19:08 +03:00
1e540862a0 Refactors GJK tetrahedron handling
Updates the `handle_tetrahedron` function to use const references for simplex points, improving efficiency and readability.

Corrects a potential bug where the `simplex` variable wasn't being correctly updated when recursively calling `handle_triangle`.

Also, const-qualifies `point_to_same_direction` for better safety.
2025-11-09 14:15:32 +03:00