updated readme

This commit is contained in:
2024-09-23 10:32:18 -07:00
parent 01a2a3d055
commit ee68574542

View File

@@ -15,6 +15,8 @@ Oranges's Math Library (omath) is a comprehensive, open-source library aimed at
- **Efficiency**: Optimized for performance, ensuring quick computations. - **Efficiency**: Optimized for performance, ensuring quick computations.
- **Versatility**: Includes a wide array of mathematical functions and algorithms. - **Versatility**: Includes a wide array of mathematical functions and algorithms.
- **Ease of Use**: Simplified interface for convenient integration into various projects. - **Ease of Use**: Simplified interface for convenient integration into various projects.
- **Projectile Prediction**: Projectile prediction engine with O(N) algo complexity, that can power you projectile aim-bot.
- **3D Projection**: No need to find view-projection matrix anymore you can make your own projection pipeline.
## Getting Started ## Getting Started
### Prerequisites ### Prerequisites
@@ -39,21 +41,12 @@ Oranges's Math Library (omath) is a comprehensive, open-source library aimed at
## Usage ## Usage
Simple world to screen function Simple world to screen function
```c++ ```c++
std::optional<omath::Vector3> WorldToScreen(omath::Vector3 worldPosition, float width, float height) TEST(UnitTestProjection, IsPointOnScreen)
{ {
auto projected = (GetViewProjectionMatrix() * worldPosition).transpose(); const omath::projection::Camera camera({0.f, 0.f, 0.f}, {0, 0.f, 0.f} , {1920.f, 1080.f}, 110.f, 0.1f, 500.f);
projected /= projected.at(0, 3); const auto proj = camera.WorldToScreen({100, 0, 15});
EXPECT_TRUE(proj.has_value());
const auto out = projected * omath::matrix::to_screen_matrix(width,
height);
if (out.at(0, 2) <= 0.f)
return std::nullopt;
auto final = omath::Vector3(out.at(0, 0),
out.at(0, 1),
out.at(0, 3));
return {final};
} }
``` ```
## Contributing ## Contributing