/*************************************************************************** * Copyright (C) gempa GmbH * * All rights reserved. * * Contact: gempa GmbH (seiscomp-dev@gempa.de) * * * * GNU Affero General Public License Usage * * This file may be used under the terms of the GNU Affero * * Public License version 3.0 as published by the Free Software Foundation * * and appearing in the file LICENSE included in the packaging of this * * file. Please review the following information to ensure the GNU Affero * * Public License version 3.0 requirements will be met: * * https://www.gnu.org/licenses/agpl-3.0.html. * * * * Other Usage * * Alternatively, this file may be used in accordance with the terms and * * conditions contained in a signed written agreement between you and * * gempa GmbH. * ***************************************************************************/ #ifndef SEISCOMP_MATH_VECTOR3_H #define SEISCOMP_MATH_VECTOR3_H #include namespace Seiscomp { namespace Math { template struct Vector3 { Vector3() {} Vector3(const Vector3 &other) : x(other.x), y(other.y), z(other.z) {} Vector3(T x_, T y_, T z_) : x(x_), y(y_), z(z_) {} T length() const; T dot(const Vector3 &v) const; Vector3 &cross(const Vector3 &a, const Vector3 &b); Vector3 &normalize(); Vector3 &operator=(const Vector3 &other); Vector3 operator*(T scale) const; Vector3 &operator*=(T scale); T operator*(const Vector3 &other) const; operator T *() { return (T*)this; } operator const T *() const { return (const T*)this; } Vector3 &operator+=(const Vector3 &other); Vector3 &operator-=(const Vector3 &other); Vector3 operator+(const Vector3 &other) const; Vector3 operator-(const Vector3 &other) const; Vector3 &fromAngles(T radAzimuth, T radDip); Vector3 &toAngles(T &radAzimuth, T &radDip); T x,y,z; }; typedef Vector3 Vector3f; typedef Vector3 Vector3d; #include } // namespace Math } // namespace Seiscomp #endif