Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src/math
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2008-10-05 19:04:56 +0000
committerStijn Buys <ingar@osirion.org>2008-10-05 19:04:56 +0000
commita8c367416c28edb47c8f8c447b515cca4080adc2 (patch)
treee2ec21d060bff81361e39a784732813d1ad4585d /src/math
parentda9beb729c58ca2d91f67ab85a6728b628c27cf2 (diff)
adds vector2f to the math library
Diffstat (limited to 'src/math')
-rw-r--r--src/math/Makefile.am6
-rw-r--r--src/math/vector3f.cc13
-rw-r--r--src/math/vector3f.h9
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.
*/