{"id":21168825,"url":"https://github.com/tbhaxor/firefly","last_synced_at":"2025-07-09T18:31:42.477Z","repository":{"id":90133040,"uuid":"125414726","full_name":"tbhaxor/firefly","owner":"tbhaxor","description":"A standalone C++ Library for vectors calculations","archived":false,"fork":false,"pushed_at":"2024-10-18T19:08:49.000Z","size":1093,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-05T10:05:23.030Z","etag":null,"topics":["cpp","firefly","hacktoberfest","hacktoberfest2024","vector","vector-projection","vectors-calculations"],"latest_commit_sha":null,"homepage":"https://tbhaxor.github.io/firefly/","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tbhaxor.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-03-15T19:10:23.000Z","updated_at":"2025-06-01T19:59:06.000Z","dependencies_parsed_at":null,"dependency_job_id":"6c308db1-2ad8-4c0a-8276-0805a491ee47","html_url":"https://github.com/tbhaxor/firefly","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/tbhaxor/firefly","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tbhaxor%2Ffirefly","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tbhaxor%2Ffirefly/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tbhaxor%2Ffirefly/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tbhaxor%2Ffirefly/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tbhaxor","download_url":"https://codeload.github.com/tbhaxor/firefly/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tbhaxor%2Ffirefly/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264502387,"owners_count":23618587,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpp","firefly","hacktoberfest","hacktoberfest2024","vector","vector-projection","vectors-calculations"],"created_at":"2024-11-20T15:18:00.952Z","updated_at":"2025-07-09T18:31:42.453Z","avatar_url":"https://github.com/tbhaxor.png","language":"C++","readme":"# Firefly\n\nFirefly is a header-only standalone C++ vector calculation library. It performs basic arithmetic operations on vectors and introduces utility functions for advanced functionalities. The library supports templates with arithmetic type precision, and currently, it is only available on CPU systems.\n\nThe library was designed to help people learn C++ and its concepts. It's a simple implementation, but it's a good place to start if you want to learn more about linear algebra and C++\n\n## Features\n\nFirefly is loaded with a bunch of cool features designed to make your vector calculations a breeze:\n\n### Core Features\n\n- **Header-Only:** Simply include the header files and you're good to go! No need to worry about linking libraries.\n- **Template Support:** Works seamlessly with various arithmetic types (e.g., int, float, double) and even complex numbers (std::complex).\n- **Arithmetic Operations** Perform basic arithmetic operations like addition, subtraction, and scaling on your vectors effortlessly.\n\n### Advanced Functionalities\n\n- Geometric Calculations: Compute dot products, cross products (for 3D vectors), and easily normalize vectors.\n- Utility Functions:\n  - Determine the angle between two vectors.\n  - Check if vectors are parallel, anti-parallel, or orthogonal.\n  - Calculate the area of a parallelogram or triangle formed by two vectors.\n  - Project or reject a vector onto or from another vector.\n  - Compute the Euclidean distance between two vectors.\n  - Reflect a vector across another vector.\n  - Rotate a 2D vector by a specified angle.\n  - Calculate the scalar projection of a vector onto another vector.\n  - Perform linear interpolation (Lerp) between two vectors.\n\n## Supported Compilers and Standard\n\n- GCC v13+\n- LLVM v16+\n\n\u003e [!IMPORTANT]\n\u003e Your compiler must support C++ standard 23 [ref](https://github.com/tbhaxor/firefly/blob/208ef838b3f9290d3d6272b476e0a15f7a6b17fb/CMakeLists.txt#L6)\n\n## Build and Install\n\n\u003e [!Note]\n\u003e Ensure CMake 3.10+ and either Make or Ninja build systems are installed before following the steps.\n\n1. Clone the repository\n\n   ```console\n   git clone --depth=1 --branch=master https://github.com/tbhaxor/firefly.git firefly\n   ```\n\n2. Configure the cmake build\n\n   ```console\n   cmake -Bbuild -DFirefly_ENABLE_EXAMPLES=ON\n\n   # With Ninja\n   cmake -Bbuild -GNinja -DFirefly_ENABLE_EXAMPLES=ON\n   ```\n\n   \u003ccenter\u003e\n\n   |      CMake Options      |  Type   | Description                                                                                                |\n   | :---------------------: | :-----: | :--------------------------------------------------------------------------------------------------------- |\n   | Firefly_ENABLE_EXAMPLES | Boolean | Adds the `examples/` directory in the compile target. (default: `OFF`)                                     |\n   |  Firefly_ENABLE_TESTS   | Boolean | Download gtest and configures it to enable test. Check [Testing](#testing) section below. (default: `OFF`) |\n\n   \u003c/center\u003e\n\n3. Build the code and install it\n   ```console\n   cmake --build build\n   sudo cmake --install build\n   ```\n\n## Testing\n\nBy default tests are disabled, you can enable them with `-DFirefly_ENABLE_TESTS` and run using ctest, as shown below.\n\n```console\ncmake -Bbuild -DCMAKE_BUILD_TYPE=Debug -DFirefly_ENABLE_TESTS=ON\ncmake --build build\nctest --test-dir build/tests --verbose\n```\n\n## Example Usage\n\n```cpp\n#include \u003ciostream\u003e\n#include \u003cfirefly/utilities.hpp\u003e\n#include \u003cfirefly/vector.hpp\u003e\n\nint main() {\n  firefly::vector\u003cint, 2\u003e v1{1, 2};\n  firefly::vector\u003cint, 2\u003e v2{-8, 6};\n  auto v3 = v1 + v2;\n  firefly::vector\u003cstd::complex\u003cint\u003e, 5\u003e v4{{1, 2}, {2, 3}, {3, 4}, {4, 5}, {5, 6}};\n  auto v5 = v4.as_type\u003cint\u003e();\n\n  std::cout \u003c\u003c v1 \u003c\u003c std::endl;\n  std::cout \u003c\u003c v2 \u003c\u003c std::endl;\n  std::cout \u003c\u003c v3 \u003c\u003c std::endl;\n  std::cout \u003c\u003c v4 \u003c\u003c std::endl;\n  std::cout \u003c\u003c v5 \u003c\u003c std::endl;\n  std::cout \u003c\u003c v1.norm() \u003c\u003c std::endl;\n  std::cout \u003c\u003c v1.to_normalized().norm() \u003c\u003c std::endl;\n  std::cout \u003c\u003c firefly::utilities::vector::angle_between(v1, v2) \u003c\u003c std::endl\n            \u003c\u003c std::boolalpha \u003c\u003c firefly::utilities::vector::are_orthogonal(v1, v2) \u003c\u003c std::endl\n            \u003c\u003c firefly::utilities::vector::are_parallel(v1, v1) \u003c\u003c std::endl\n            \u003c\u003c firefly::utilities::vector::are_anti_parallel(v1, -v1) \u003c\u003c std::endl\n            \u003c\u003c std::noboolalpha;\n}\n```\n\n## Future Plans\n\n- Implement Kokkos for HPC platforms\n\n## Scope of Contribution\n\n- First of all, if you can help me implement [future plans](#future-plans), I would be thankful to you\n- Documentation using doxygen. I am new to it, you may help me add more professional documentation\n- Add more test cases. I may have left some of the edge cases that you might have come across.\n\n## Contact\n\nTwitter: @tbhaxor \u003cbr /\u003e\nLinkedIn: @tbhaxor\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftbhaxor%2Ffirefly","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftbhaxor%2Ffirefly","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftbhaxor%2Ffirefly/lists"}