mirror of
https://github.com/orange-cpp/omath.git
synced 2026-04-18 18:23:26 +00:00
Compare commits
4 Commits
v5.1.1
...
28e86fc355
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
28e86fc355 | ||
|
|
93e7a9457a | ||
| 8f65183882 | |||
| 327db8d441 |
@@ -1,32 +1,36 @@
|
||||
## 🤝 Contributing to OMath or other Orange's Projects
|
||||
# Contributing
|
||||
|
||||
### ❕ Prerequisites
|
||||
## Prerequisites
|
||||
|
||||
- A working up-to-date OMath installation
|
||||
- C++ knowledge
|
||||
- Git knowledge
|
||||
- Ability to ask for help (Feel free to create empty pull-request or PM a maintainer
|
||||
in [Telegram](https://t.me/orange_cpp))
|
||||
- C++ compiler with C++23 support (Clang 18+, GCC 14+, MSVC 19.38+)
|
||||
- CMake 3.25+
|
||||
- Git
|
||||
- Familiarity with the codebase (see `INSTALL.md` for setup)
|
||||
|
||||
### ⏬ Setting up OMath
|
||||
For questions, create a draft PR or reach out via [Telegram](https://t.me/orange_cpp).
|
||||
|
||||
Please read INSTALL.md file in repository
|
||||
## Workflow
|
||||
|
||||
### 🔀 Pull requests and Branches
|
||||
1. [Fork](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/fork-a-repo) the repository.
|
||||
2. Create a feature branch from `main`.
|
||||
3. Make your changes, ensuring tests pass.
|
||||
4. Open a [pull request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork) against `main`.
|
||||
|
||||
In order to send code back to the official OMath repository, you must first create a copy of OMath on your github
|
||||
account ([fork](https://help.github.com/articles/creating-a-pull-request-from-a-fork/)) and
|
||||
then [create a pull request](https://help.github.com/articles/creating-a-pull-request-from-a-fork/) back to OMath.
|
||||
## Code Style
|
||||
|
||||
OMath development is performed on multiple branches. Changes are then pull requested into master. By default, changes
|
||||
merged into master will not roll out to stable build users unless the `stable` tag is updated.
|
||||
Follow the project `.clang-format`. Run `clang-format` before committing.
|
||||
|
||||
### 📜 Code-Style
|
||||
## Building
|
||||
|
||||
The orange code-style can be found in `.clang-format`.
|
||||
Use one of the CMake presets defined in `CMakePresets.json`:
|
||||
|
||||
### 📦 Building
|
||||
```bash
|
||||
cmake --preset <preset-name> -DOMATH_BUILD_TESTS=ON
|
||||
cmake --build --preset <preset-name>
|
||||
```
|
||||
|
||||
OMath has already created the `cmake-build` and `out` directories where cmake/bin files are located. By default, you
|
||||
can build OMath by running `cmake --build cmake-build/build/windows-release --target omath -j 6` in the source
|
||||
directory.
|
||||
Run `cmake --list-presets` to see available configurations.
|
||||
|
||||
## Tests
|
||||
|
||||
All new functionality must include unit tests. Run the test binary after building to verify nothing is broken.
|
||||
|
||||
@@ -71,18 +71,18 @@ void drawChar(char c, float x, float y, float scale, const Color& color, std::ve
|
||||
lines.push_back(x + x1 * w);
|
||||
lines.push_back(y + y1 * h);
|
||||
lines.push_back(0.0f);
|
||||
lines.push_back(color.x);
|
||||
lines.push_back(color.y);
|
||||
lines.push_back(color.z);
|
||||
lines.push_back(color.value().x);
|
||||
lines.push_back(color.value().y);
|
||||
lines.push_back(color.value().z);
|
||||
lines.push_back(1.0f); // size
|
||||
lines.push_back(1.0f); // isLine
|
||||
|
||||
lines.push_back(x + x2 * w);
|
||||
lines.push_back(y + y2 * h);
|
||||
lines.push_back(0.0f);
|
||||
lines.push_back(color.x);
|
||||
lines.push_back(color.y);
|
||||
lines.push_back(color.z);
|
||||
lines.push_back(color.value().x);
|
||||
lines.push_back(color.value().y);
|
||||
lines.push_back(color.value().z);
|
||||
lines.push_back(1.0f); // size
|
||||
lines.push_back(1.0f); // isLine
|
||||
};
|
||||
|
||||
@@ -87,11 +87,11 @@ namespace omath::pathfinding
|
||||
|
||||
const auto current_node = current_node_it->second;
|
||||
|
||||
closed_list.emplace(current, current_node);
|
||||
|
||||
if (current == end_vertex)
|
||||
return reconstruct_final_path(closed_list, current);
|
||||
|
||||
closed_list.emplace(current, current_node);
|
||||
|
||||
for (const auto& neighbor: nav_mesh.get_neighbors(current))
|
||||
{
|
||||
if (closed_list.contains(neighbor))
|
||||
|
||||
@@ -40,8 +40,9 @@ TEST(AStarExtra, TrivialNeighbor)
|
||||
nav.m_vertex_map[v2] = {v1};
|
||||
|
||||
const auto path = Astar::find_path(v1, v2, nav);
|
||||
ASSERT_EQ(path.size(), 1u);
|
||||
EXPECT_EQ(path.front(), v2);
|
||||
ASSERT_EQ(path.size(), 2u);
|
||||
EXPECT_EQ(path.front(), v1);
|
||||
EXPECT_EQ(path.back(), v2);
|
||||
}
|
||||
|
||||
TEST(AStarExtra, StartEqualsGoal)
|
||||
@@ -101,7 +102,7 @@ TEST(AStarExtra, LongerPathAvoidsBlock)
|
||||
constexpr Vector3<float> goal = idx(2, 1);
|
||||
const auto path = Astar::find_path(start, goal, nav);
|
||||
ASSERT_FALSE(path.empty());
|
||||
EXPECT_EQ(path.front(), goal);
|
||||
EXPECT_EQ(path.back(), goal);
|
||||
}
|
||||
|
||||
TEST(AstarTests, TrivialDirectNeighborPath)
|
||||
@@ -114,8 +115,9 @@ TEST(AstarTests, TrivialDirectNeighborPath)
|
||||
nav.m_vertex_map.emplace(v2, std::vector<Vector3<float>>{v1});
|
||||
|
||||
const auto path = Astar::find_path(v1, v2, nav);
|
||||
ASSERT_EQ(path.size(), 1u);
|
||||
EXPECT_EQ(path.front(), v2);
|
||||
ASSERT_EQ(path.size(), 2u);
|
||||
EXPECT_EQ(path.front(), v1);
|
||||
EXPECT_EQ(path.back(), v2);
|
||||
}
|
||||
|
||||
TEST(AstarTests, NoPathWhenDisconnected)
|
||||
|
||||
Reference in New Issue
Block a user