From 1160baa61bad605cf8a1d583e8ae356a54a942df Mon Sep 17 00:00:00 2001 From: Jaron Kent-Dobias Date: Thu, 26 Jul 2018 16:18:40 -0400 Subject: many changes, including new spin spaces and groups and cleaning up core library code --- lib/angle.h | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 lib/angle.h (limited to 'lib/angle.h') diff --git a/lib/angle.h b/lib/angle.h new file mode 100644 index 0000000..c3f128e --- /dev/null +++ b/lib/angle.h @@ -0,0 +1,48 @@ +#pragma once + +#include "types.h" + +#include +#include "vector.h" + +class angle_t { + public: + double x; + + typedef vector_t<2, double> M_t; + typedef vector_t<2, double> F_t; + + angle_t() : x(0) {} + angle_t(double x) : x(x) {} + + inline vector_t<2, double> operator*(v_t a) const { + vector_t<2, double>M; + M[0] = a * cos(x); + M[1] = a * sin(x); + + return M; + } + + inline vector_t<2, double> operator*(double a) const { + vector_t<2, double>M; + M[0] = a * cos(x); + M[1] = a * sin(x); + + return M; + } +}; + +inline vector_t<2,double>& operator+=(vector_t<2,double>& M, const angle_t& theta) { + M[0] += cos(theta.x); + M[1] += sin(theta.x); + + return M; +} + +inline vector_t<2,double>& operator-=(vector_t<2,double>& M, const angle_t& theta) { + M[0] -= cos(theta.x); + M[1] -= sin(theta.x); + + return M; +} + -- cgit v1.2.3-70-g09d2