From a8c367416c28edb47c8f8c447b515cca4080adc2 Mon Sep 17 00:00:00 2001
From: Stijn Buys <ingar@osirion.org>
Date: Sun, 5 Oct 2008 19:04:56 +0000
Subject: adds vector2f to the math library

---
 src/math/Makefile.am |  6 ++++--
 src/math/vector3f.cc | 13 +++++++++----
 src/math/vector3f.h  |  9 +++------
 3 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/src/math/Makefile.am b/src/math/Makefile.am
index ab4577e..df180dd 100644
--- a/src/math/Makefile.am
+++ b/src/math/Makefile.am
@@ -1,9 +1,11 @@
 METASOURCES = AUTO
 
-libmath_la_SOURCES = axis.cc color.cc functions.cc matrix4f.cc vector3f.cc
+libmath_la_SOURCES = axis.cc color.cc functions.cc matrix4f.cc vector2f.cc \
+	vector3f.cc
 libmath_la_LDFLAGS = -avoid-version -no-undefined -lm
 
 noinst_LTLIBRARIES = libmath.la
-noinst_HEADERS = axis.h color.h functions.h mathlib.h matrix4f.h vector3f.h
+noinst_HEADERS = axis.h color.h functions.h mathlib.h matrix4f.h vector2f.h \
+		vector3f.h
 
 INCLUDES = -I$(top_srcdir)/src
diff --git a/src/math/vector3f.cc b/src/math/vector3f.cc
index 3d816f6..bf2cb8d 100644
--- a/src/math/vector3f.cc
+++ b/src/math/vector3f.cc
@@ -4,11 +4,10 @@
    the terms of the GNU General Public License version 2
 */
 
-// project headers
-#include "math/vector3f.h"
-
-// C++ headers
 #include <cmath>
+#include <cstring>
+
+#include "math/vector3f.h"
 
 namespace math
 {
@@ -37,8 +36,11 @@ Vector3f::~Vector3f()
 
 void Vector3f::clear()
 {
+	/*
 	for (size_t i =0; i < 3; i++)
 		coord[i] = 0;
+	*/
+	memset(coord, 0, sizeof(coord));
 }
 
 void Vector3f::assign(const float vx, const float vy, const float vz)
@@ -50,8 +52,11 @@ void Vector3f::assign(const float vx, const float vy, const float vz)
 
 void Vector3f::assign(Vector3f const & other)
 {
+	/*
 	for (size_t i =0; i < 3; i++)
 		coord[i] = other.coord[i];
+	*/
+	memcpy(coord, other.coord, sizeof(coord));
 }
 
 Vector3f & Vector3f::operator=(const Vector3f & other)
diff --git a/src/math/vector3f.h b/src/math/vector3f.h
index 25fcbff..20be5ab 100644
--- a/src/math/vector3f.h
+++ b/src/math/vector3f.h
@@ -1,5 +1,5 @@
 /*
-   math/vector3f.cc
+   math/vector3f.h
    This file is part of the Osirion project and is distributed under
    the terms of the GNU General Public License version 2
 */
@@ -7,16 +7,13 @@
 #ifndef __INCLUDED_MATH_VECTOR3F_H__
 #define __INCLUDED_MATH_VECTOR3F_H__
 
-// project headers
-#include "math/vector3f.h"
-
-// C++ headers
 #include <iostream>
+#include "math/vector3f.h"
 
 namespace math
 {
 
-/// a point or vector in 3D-space
+/// 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.
  */
-- 
cgit v1.2.3