forked from OPCODE-Open-Spring-Fest/ImGraph
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfuncs.hpp
More file actions
32 lines (27 loc) · 961 Bytes
/
funcs.hpp
File metadata and controls
32 lines (27 loc) · 961 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
//
// Created by nishant on 09/10/25.
//
#ifndef IMGRAPH_FUNCS_HPP
#define IMGRAPH_FUNCS_HPP
#include <numbers>
#include <string>
#include <cctype>
#include "exprtk.hpp"
inline void addConstants(exprtk::symbol_table<double> &symbolTable) {
symbolTable.add_constant("e", std::numbers::e);
symbolTable.add_constant("π", std::numbers::pi); // "pi" is already added by add_constants()
symbolTable.add_constant("phi", std::numbers::phi);
symbolTable.add_constant("ϕ", std::numbers::phi);
symbolTable.add_constant("φ", std::numbers::phi);
symbolTable.add_constant("gamma", std::numbers::egamma);
symbolTable.add_constant("γ", std::numbers::egamma);
}
inline std::string trim(const std::string& s) {
const char* ws = " \t\n\r";
size_t start = s.find_first_not_of(ws);
size_t end = s.find_last_not_of(ws);
if (start == std::string::npos)
return std::string();
return s.substr(start, end - start + 1);
}
#endif // IMGRAPH_FUNCS_HPP