From 69f7ffa70863bef2be4cae08c466b5d97a627277 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Wed, 30 Jan 2008 17:34:35 +0000 Subject: accomodate the new modules --- src/common/vector3f.h | 149 -------------------------------------------------- 1 file changed, 149 deletions(-) delete mode 100644 src/common/vector3f.h (limited to 'src/common/vector3f.h') diff --git a/src/common/vector3f.h b/src/common/vector3f.h deleted file mode 100644 index e943bd4..0000000 --- a/src/common/vector3f.h +++ /dev/null @@ -1,149 +0,0 @@ -/* - common/vector3f.cc - This file is part of the Osirion project and is distributed under - the terms of the GNU General Public License version 2 -*/ - -#ifndef __INCLUDED_VECTOR3F_H__ -#define __INCLUDED_VECTOR3F_H__ - -// project headers -#include "vector3f.h" - -// C++ headers -#include - -namespace common { - -/// A point or vector in 3D-space -/*! - An instance of this class represents a point in 3D-space or a 3D-vector - and forms the basic building block for all spatial calculations. - */ -class Vector3f { - -public: - /// Default constructor, creates a Vector3f (0,0,0) - Vector3f(); - - /// Copy constructor - /*! Create a new Vector3f that is a copy from an other - * @param other the vector to copy values from - */ - Vector3f(const Vector3f &other); - - /// Create a Vector3f with given coordinates - /*! Create a new vector at a given position in a 3D-space - * @param xv the x-coordinate of the location - * @param yv the y-coordinate of the location - * @param zv the z-coordinate of the location - */ - Vector3f(const float xv, const float yv, const float zv); - - /// Destructor - ~Vector3f(); - - /* -- Assignment operators -- */ - /// assignment operator - Vector3f& operator=(const Vector3f &other); - - /// multiplicate each element of the vector with a given value - /// @param scalar multiplication factor - Vector3f& operator*=(const float scalar); - - /// divide each element of the vector by a given value - /// @param scalar divider - Vector3f& operator/=(const float scalar); - - /// perform an element-wise subtraction - Vector3f& operator-=(const Vector3f &other); - - /// perform ann element-wise addition - Vector3f& operator+=(const Vector3f &other); - - /* -- Mathematical operators -- */ - - /// return this Vector multiplied with scalar - Vector3f operator*(const float scalar) const; - - /// return this vector divided by a scalar - Vector3f operator/(const float scalar) const; - - /// return the element-wise difference between two vectors - Vector3f operator-(const Vector3f &other) const; - - /// return the element-wise sumn of two vectors - Vector3f operator+(const Vector3f &other) const; - - /// return the vector cross-product - float operator*(const Vector3f &other) const; - - /// comparison operator - bool operator==(const Vector3f &other) const; - - /// assign a value to an element of this vector - /*! WARNING: range is not checked - * @param index the index of the element to assign to ( 0 <= index < 3 ) - */ - inline float& operator[](const unsigned int index) { - return coord[index]; - } - - /// returns the value of an element of this vector - /*! WARNING: range is not checked - * @param index the index of the element to return ( 0 <= index < 3 ) - */ - inline float operator[](const unsigned int index) const { - return coord[index]; - } - - - float &x; - float &y; - float &z; - - /// Return the cartesian length of this vector - float length() const; - - /// Return the cartesian length squared (to speed up calculations) - float lengthsquared() const; - - /// Divide this Vector by it's length - /// @see normalized() - /// WARNING: vector must not be (0, 0, 0) - void normalize(); - - /* static functions */ - - /// Returns the unity vector on the X-axis - static inline Vector3f Xaxis() { return Vector3f(1.0f, 0.0f, 0.0f); } - - /// Returns the unity vector on the Y-axis - static inline Vector3f Yaxis() { return Vector3f(0.0f, 1.0f, 0.0f); } - - /// Returns the unity vector on the Z-axis - static inline Vector3f Zaxis() { return Vector3f(0.0f, 0.0f, 1.0f); } - - /// Return the cartesian length of a vector - static inline float length(const Vector3f& vector) { return vector.length(); } - - /// Return a vector divided by it's length - /// @see normalize() - /// WARNING: vector must not be (0, 0, 0) - static inline Vector3f normalized(const Vector3f& vector) { return (vector / vector.length()); } - - float coord[3]; -}; - -/// Write a Vector3f to a std::ostream -std::ostream &operator<<(std::ostream & os, const Vector3f & vector); - -/// Read a Vector3d from a std::istream -std::istream &operator>>(std::istream & is, Vector3f& vector); - -/// scalar*Vector3f operators -Vector3f operator*(float scalar, const Vector3f& vector); - -} // namespace common - -#endif // __INCLUDED_VECTOR3F_H__ -- cgit v1.2.3