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.
Adds a comprehensive unit test for the EPA algorithm,
validating collision detection, depth calculation, and
separation axis determination with a cube overlap scenario.
Refactors the test for clarity and robustness.
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.
Replaces `push_back` with `emplace_back` when initializing faces in the EPA algorithm. This avoids unnecessary copying and improves performance during face creation.
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.
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.
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.
Simplifies the GJK algorithm by using a type alias for the vertex type, improving code readability and reducing redundancy. Removes unnecessary includes.
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.
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.
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.
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.
Implements a new test case for the GJK algorithm
to verify collision detection when colliders share the same origin.
This enhances the robustness of collision detection in scenarios
where objects are positioned at the same location.
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.
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.
Updates simplex handling to use references for vertex access, avoiding unnecessary copies. This improves performance and clarity within the GJK algorithm.
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.
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.
Changes the index type for accessing simplex points to `std::size_t` for consistency and safety.
Adds `[[nodiscard]]` attribute to `size()` and iterator functions to signal potential misuse and enable static analysis.
These updates are part of the GJK algorithm implementation.
Adds GJK algorithm implementation for detecting collisions between mesh colliders.
Includes mesh collider definition and unit tests for basic collision detection.
Provides a foundation for more complex collision handling and physics interactions.
Implements a basic example demonstrating how to scan for a given pattern within a PE file.
The example takes a file path, section, and signature as input and utilizes the `omath::PePatternScanner` to locate the signature within the specified section of the PE file.
Adds support for different screen origin configurations.
This change allows for more accurate conversion from screen coordinates to world coordinates by correctly handling different screen origin positions (top-left and bottom-left). Includes new unit tests to verify the functionality with both configurations.