polar snapping now very goood!
This commit is contained in:
@@ -25,6 +25,27 @@
|
||||
|
||||
enum Distribution {GEOMETRIC, ROUNDROBIN, RANDOM};
|
||||
|
||||
// Types
|
||||
|
||||
class GraphItem;
|
||||
class Node;
|
||||
class Edge;
|
||||
class Signal;
|
||||
|
||||
#define RANGE_FILTER(L) std::ranges::views::filter(L)
|
||||
|
||||
typedef std::shared_ptr<GraphItem> SPTR_GraphItem;
|
||||
typedef std::shared_ptr<Node> SPTR_Node;
|
||||
typedef std::shared_ptr<Edge> SPTR_Edge;
|
||||
|
||||
typedef std::shared_ptr<Signal> SPTR_Signal;
|
||||
|
||||
typedef std::vector<SPTR_GraphItem> VEC_SPTR_GraphItem;
|
||||
typedef std::vector<SPTR_Node> VEC_SPTR_Node;
|
||||
typedef std::vector<SPTR_Edge> VEC_SPTR_Edge;
|
||||
typedef std::vector<SPTR_Signal> VEC_SPTR_Signal;
|
||||
|
||||
|
||||
// 2D Vectors
|
||||
|
||||
template<typename T>
|
||||
@@ -155,6 +176,16 @@ Vec2D<T> operator*(const Vec2D<T> left, T scalar){
|
||||
return Vec2D<T>(left.x * scalar, left.y * scalar);
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
Vec2D<T> cartesianToPolar(T x, T y) {
|
||||
return Vec2D<T>{sqrt(x * x + y * y), atan(y / x)}; // r,theta
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
Vec2D<T> polarToCartesian(T r, T q) {
|
||||
return Vec2D<T>{r * cos(q), r * sin(q)};
|
||||
}
|
||||
|
||||
// App Settings
|
||||
struct AppSettings{
|
||||
int mode = 0;
|
||||
|
||||
Reference in New Issue
Block a user