Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2008-01-30 17:34:35 +0000
committerStijn Buys <ingar@osirion.org>2008-01-30 17:34:35 +0000
commit69f7ffa70863bef2be4cae08c466b5d97a627277 (patch)
tree9945e1c5cb29e10afda66af3274c3ef87886225a /src/common/vector3f.cc
parenta94049b1a43f83d750b9b5dee031c19a6b1fafb0 (diff)
accomodate the new modules
Diffstat (limited to 'src/common/vector3f.cc')
-rw-r--r--src/common/vector3f.cc161
1 files changed, 0 insertions, 161 deletions
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 <cmath>
-
-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