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.cc | 161 ------------------------------------------------- 1 file changed, 161 deletions(-) delete mode 100644 src/common/vector3f.cc (limited to 'src/common/vector3f.cc') diff --git a/src/common/vector3f.cc b/src/common/vector3f.cc deleted file mode 100644 index 86bdb36..0000000 --- a/src/common/vector3f.cc +++ /dev/null @@ -1,161 +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 -*/ - -// project headers -#include "vector3f.h" - -// C++ headers -#include - -namespace common { - -Vector3f::Vector3f() : - x(coord[0]), y(coord[1]), z(coord[2]) -{ - for (int i=0; i < 3; i++) - coord[i] = 0; -} - - -Vector3f::Vector3f(const Vector3f &other) : - x(coord[0]), y(coord[1]), z(coord[2]) -{ - for (int i=0; i < 3; i++) - coord[i] = other.coord[i]; -} - -Vector3f::Vector3f(const float xv, const float yv, const float zv) : - x(coord[0]), y(coord[1]), z(coord[2]) -{ - coord[0] = xv; - coord[1] = yv; - coord[2] = zv; -} - -Vector3f::~Vector3f() -{ -} - - -Vector3f & Vector3f::operator=(const Vector3f & other) -{ - for (int i=0; i < 3; i++) - coord[i] = other.coord[i]; - return (*this); -} - - -Vector3f & Vector3f::operator*=(const float scalar) -{ - for (int i=0; i < 3; i++) - coord[i] *= scalar; - return (*this); -} - - -Vector3f & Vector3f::operator/=(const float scalar) { - for (int i=0; i < 3; i++) - coord[i] /= scalar; - return (*this); -} - - -Vector3f &Vector3f::operator-=(const Vector3f & other) { - for (int i=0; i < 3; i++) - coord[i] -= other[i]; - return (*this); -} - - -Vector3f &Vector3f::operator+=(const Vector3f &other) { - for (int i=0; i < 3; i++) - coord[i] += other[i]; - return (*this); -} - - -Vector3f Vector3f::operator*(const float scalar) const { - Vector3f r(*this); - for (int i=0; i < 3; i++) - r.coord[i] *= scalar; - return (r); - } - - -Vector3f Vector3f::operator/(const float scalar) const { - Vector3f r(*this); - for (int i=0; i < 3; i++) - r.coord[i] /= scalar; - return (r); -} - - -Vector3f Vector3f::operator-(const Vector3f& other) const { - Vector3f r(*this); - for (int i=0; i < 3; i++) - r.coord[i] -= other.coord[i]; - return (r); -} - - -Vector3f Vector3f::operator+(const Vector3f& other) const { - Vector3f r(*this); - for (int i=0; i < 3; i++) - r.coord[i] += other.coord[i]; - return (r); -} - - -float Vector3f::operator*(const Vector3f& other) const { - float r = 0; - for (int i=0; i < 3; i++) - r += coord[i] * other.coord[i]; - return (r); -} - - -bool Vector3f::operator==(const Vector3f& other) const { - for (int i=0; i < 3; i++) - if (coord[i] != other.coord[i]) - return (false); - return (true); -} - -float Vector3f::lengthsquared() const { - double r = 0; - for (int i=0; i < 3; i++) - r += coord[i]*coord[i]; - return ((float) r); -} - -float Vector3f::length() const { - double r = 0; - for (int i=0; i < 3; i++) - r += coord[i]*coord[i]; - - return ((float) sqrt(r)); -} - -void Vector3f::normalize() { - (*this) /= this->length(); -} - -std::ostream &operator<<(std::ostream & os, const Vector3f & vector) { - os << vector[0] << " " << vector[1] << " " << vector[2]; - return os; -} - -std::istream &operator>>(std::istream & is, Vector3f & vector) { - for (int i=0; i < 3; i++) - is >> vector[i]; - return is; -} - -Vector3f operator*(float scalar, const Vector3f& vector) { - return vector * scalar; -} - -} // namespace common -- cgit v1.2.3