// SPDX-FileCopyrightText: 2024 Filip Leonarski, Paul Scherrer Institute // SPDX-License-Identifier: GPL-3.0-only #pragma once #include #include class Coord { public: float x,y,z; Coord(); Coord(const float in[3]); Coord(float x, float y, float z); void swap(Coord& other) noexcept; Coord operator+(const Coord &in) const; Coord operator-(const Coord &in) const; Coord operator*(float in) const; Coord operator/(float in) const; Coord operator-() const; Coord& operator+=(const Coord &in); Coord& operator-=(const Coord &in); Coord& operator*=(float in); Coord& operator/=(float in); bool operator==(const Coord &other) const; Coord operator%(const Coord &in) const; // Cross product float operator*(const Coord &in) const; // Dot product const float& operator[](int64_t val) const; float& operator[](int64_t val); float Length() const; Coord Normalize() const; friend std::ostream &operator<<( std::ostream &output, const Coord &in ); }; Coord operator*(float in1, const Coord& in2); inline void swap(Coord& a, Coord& b) noexcept; float angle_deg(const Coord &in1, const Coord &in2); class RotMatrix { float v[3][3]; public: RotMatrix(); RotMatrix(float alpha, const Coord &dir); Coord operator*(const Coord &in) const; RotMatrix operator*(const RotMatrix &other) const; RotMatrix invert() const; RotMatrix transpose() const; RotMatrix operator!() const; std::vector arr() const; }; inline void swap(Coord& a, Coord& b) noexcept { a.swap(b); }