/* * Copyright (c) 2025 Konrad Gębik * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see */ #pragma once #include //Simple 3D vector with simple algebraic operations defined struct Vector { double x, y, z; Vector& operator+=(const Vector& v) { this->x += v.x; this->y += v.y; this->z += v.z; return *this; } Vector& operator-=(const Vector& v) { this->x -= v.x; this->y -= v.y; this->z -= v.z; return *this; } friend Vector operator*(Vector v, double a); friend Vector operator*(double a, Vector v); friend Vector operator+(Vector, Vector); friend Vector operator/(Vector v, double a); friend Vector operator-(Vector, Vector); friend std::ostream& operator<<(std::ostream&, const Vector&); double dotProduct(Vector) const; double normSq() const; double norm() const; };