diff options
Diffstat (limited to 'src/math/vector3f.cc')
-rw-r--r-- | src/math/vector3f.cc | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/math/vector3f.cc b/src/math/vector3f.cc index ddf46af..371ada1 100644 --- a/src/math/vector3f.cc +++ b/src/math/vector3f.cc @@ -141,15 +141,6 @@ Vector3f operator*(float scalar, const Vector3f& vector) return vector * scalar; } -Vector3f crossproduct(const Vector3f& first, const Vector3f& second) -{ - float x = first[1]*second[2] - first[2]*second[1]; - float y = first[2]*second[0] - first[0]*second[2]; - float z = first[0]*second[1] - first[1]*second[0]; - - return(Vector3f(x,y,z)); -} - std::ostream &operator<<(std::ostream & os, Vector3f const & vector) { os << vector[0] << " " << vector[1] << " " << vector[2]; @@ -163,6 +154,15 @@ std::istream &operator>>(std::istream & is, Vector3f & vector) return is; } +const Vector3f crossproduct(Vector3f const & first, Vector3f const& second) +{ + float x = first[1]*second[2] - first[2]*second[1]; + float y = first[2]*second[0] - first[0]*second[2]; + float z = first[0]*second[1] - first[1]*second[0]; + + return(Vector3f(x,y,z)); +} + float dotproduct(const Vector3f& first, const Vector3f& second) { float r = 0; @@ -170,5 +170,4 @@ float dotproduct(const Vector3f& first, const Vector3f& second) r += first[i] * second[i]; return (r); } - } // namespace math |