Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/scenent/gp
graph parser for C++.
https://github.com/scenent/gp
cpp graph math parser
Last synced: 5 days ago
JSON representation
graph parser for C++.
- Host: GitHub
- URL: https://github.com/scenent/gp
- Owner: scenent
- License: mit
- Created: 2024-08-22T14:02:30.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-08-22T14:21:09.000Z (5 months ago)
- Last Synced: 2024-11-15T02:29:18.989Z (2 months ago)
- Topics: cpp, graph, math, parser
- Language: C++
- Homepage:
- Size: 85 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gp
graph parser for C++.
just input expression about x.
then you'll get list of two dimensional vector.## Usage
```cpp
int main(const _argc, const char * const * const _argv) {
gp::GraphParser _gp{};
// gp::GraphParser::exec(expression : str, xBegin : real, xEnd : real, xStep : real, varMap : map)
std::vector _vertices = _gp.exec("x + 1", 0.0f, 100.0f, 1.0f, {});
for (const auto& _vertex : _vertices) {
std::cout << _vertex.x << ", " << _vertex.y << "\n";
}
}
```
## Supporting Operators
- Add (+)
- Sub (-)
- Mul (*)
- Div (/)
- Mod (%)
- Pow (^)## Builtin Functions
- sin(x)
- cos(x)
- tan(x)
- asin(x)
- acos(x)
- atan(x)
- log(x)
- exp(x)
- sqrt(x)
- abs(x)## Screenshot
**(renderer uses y-inverted coordinate system)**
| Sine Function | Quadratic Function |
| ---- | ---- |
| `y = sin(x / 10.0) * 50.0 + 100` | `y = (x / 10.0) ^ 2 + 100` |
| ![sine](screenshot_sine.png) | ![quadratic](screenshot_quadratic.png) |## Renderer
[olcPixelGameEngine](https://github.com/OneLoneCoder/olcPixelGameEngine) by Javidx9