OSDN Git Service

remove confliction
authortomohiro yasutomo <o_ggy@users.sourceforge.jp>
Mon, 6 Sep 2010 02:55:26 +0000 (19:55 -0700)
committertomohiro yasutomo <o_ggy@users.sourceforge.jp>
Mon, 6 Sep 2010 02:55:26 +0000 (19:55 -0700)
36 files changed:
bin/numeric
lib/libmofmath.a
lib/libmofutil.a
sample/build_unix/CMakeFiles/CMakeDirectoryInformation.cmake
sample/build_unix/numeric/CMakeFiles/CMakeDirectoryInformation.cmake
sample/build_unix/numeric/CMakeFiles/numeric.dir/flags.make
src/build_unix/Testing/Temporary/LastTest.log
src/build_unix/mof/math/CMakeFiles/CMakeDirectoryInformation.cmake
src/build_unix/mof/math/CMakeFiles/make_matrix_test.dir/flags.make
src/build_unix/mof/math/CMakeFiles/make_matrix_test.dir/link.txt
src/build_unix/mof/math/CMakeFiles/matrix2_test.dir/flags.make
src/build_unix/mof/math/CMakeFiles/matrix2_test.dir/link.txt
src/build_unix/mof/math/CMakeFiles/matrix3_test.dir/flags.make
src/build_unix/mof/math/CMakeFiles/matrix3_test.dir/link.txt
src/build_unix/mof/math/CMakeFiles/mofmath.dir/flags.make
src/build_unix/mof/math/CMakeFiles/vector2_test.dir/flags.make
src/build_unix/mof/math/CMakeFiles/vector2_test.dir/link.txt
src/build_unix/mof/math/CMakeFiles/vector3_test.dir/flags.make
src/build_unix/mof/math/CMakeFiles/vector3_test.dir/link.txt
src/build_unix/mof/util/CMakeFiles/CMakeDirectoryInformation.cmake
src/build_unix/mof/util/CMakeFiles/mofutil.dir/flags.make
src/mof/math/basic_matrix.hpp
src/mof/math/basic_matrix.hpp.orig [new file with mode: 0644]
src/mof/math/basic_vector.hpp
src/mof/math/basic_vector.hpp.orig [new file with mode: 0644]
src/mof/math/matrix2.hpp
src/mof/math/matrix2.hpp.orig [new file with mode: 0644]
src/mof/math/matrix3.hpp
src/mof/math/matrix3.hpp.orig [new file with mode: 0644]
src/mof/math/test/matrix3_test.cpp
src/mof/math/test/matrix3_test.cpp.orig [new file with mode: 0644]
src/mof/math/test/testbin/make_matrix_test
src/mof/math/test/testbin/matrix2_test
src/mof/math/test/testbin/matrix3_test
src/mof/math/test/testbin/vector2_test
src/mof/math/test/testbin/vector3_test

index 22a530a..700e5b3 100755 (executable)
Binary files a/bin/numeric and b/bin/numeric differ
index fde4fc2..50407fe 100644 (file)
Binary files a/lib/libmofmath.a and b/lib/libmofmath.a differ
index 59b1d33..5753500 100644 (file)
Binary files a/lib/libmofutil.a and b/lib/libmofutil.a differ
index f61b233..0328d3b 100644 (file)
@@ -11,7 +11,6 @@ SET(CMAKE_FORCE_UNIX_PATHS 1)
 # The C and CXX include file search paths:
 SET(CMAKE_C_INCLUDE_PATH
   "../../src"
-  "../BOOST_INCLUDE_DIR"
   )
 SET(CMAKE_CXX_INCLUDE_PATH ${CMAKE_C_INCLUDE_PATH})
 SET(CMAKE_Fortran_INCLUDE_PATH ${CMAKE_C_INCLUDE_PATH})
index f61b233..0328d3b 100644 (file)
@@ -11,7 +11,6 @@ SET(CMAKE_FORCE_UNIX_PATHS 1)
 # The C and CXX include file search paths:
 SET(CMAKE_C_INCLUDE_PATH
   "../../src"
-  "../BOOST_INCLUDE_DIR"
   )
 SET(CMAKE_CXX_INCLUDE_PATH ${CMAKE_C_INCLUDE_PATH})
 SET(CMAKE_Fortran_INCLUDE_PATH ${CMAKE_C_INCLUDE_PATH})
index bcadb6a..ad62032 100644 (file)
@@ -2,7 +2,7 @@
 # Generated by "Unix Makefiles" Generator, CMake Version 2.8
 
 # compile CXX with /usr/bin/c++
-CXX_FLAGS =  -Wall -O3 -DNDEBUG -std=c++0x -I/home/yasutomo/devel/moflib/sample/../src -I/home/yasutomo/devel/moflib/sample/BOOST_INCLUDE_DIR  
+CXX_FLAGS =  -Wall -O3 -DNDEBUG -std=c++0x -I/home/yasutomo/devel/moflib/sample/../src  
 
 CXX_DEFINES = 
 
index 227fe09..d085b0f 100644 (file)
@@ -1,17 +1,17 @@
-Start testing: Sep 03 15:16 PDT
+Start testing: Sep 05 19:53 PDT
 ----------------------------------------------------------
 1/5 Testing: vector2_test
 1/5 Test: vector2_test
 Command: "/home/yasutomo/devel/moflib/src/mof/math/test/testbin/vector2_test"
 Directory: /home/yasutomo/devel/moflib/src/build_unix/mof/math
-"vector2_test" start time: Sep 03 15:16 PDT
+"vector2_test" start time: Sep 05 19:53 PDT
 Output:
 ----------------------------------------------------------
 <end of output>
-Test time =   0.01 sec
+Test time =   0.00 sec
 ----------------------------------------------------------
 Test Passed.
-"vector2_test" end time: Sep 03 15:16 PDT
+"vector2_test" end time: Sep 05 19:53 PDT
 "vector2_test" time elapsed: 00:00:00
 ----------------------------------------------------------
 
@@ -19,14 +19,14 @@ Test Passed.
 2/5 Test: vector3_test
 Command: "/home/yasutomo/devel/moflib/src/mof/math/test/testbin/vector3_test"
 Directory: /home/yasutomo/devel/moflib/src/build_unix/mof/math
-"vector3_test" start time: Sep 03 15:16 PDT
+"vector3_test" start time: Sep 05 19:53 PDT
 Output:
 ----------------------------------------------------------
 <end of output>
-Test time =   0.02 sec
+Test time =   0.01 sec
 ----------------------------------------------------------
 Test Passed.
-"vector3_test" end time: Sep 03 15:16 PDT
+"vector3_test" end time: Sep 05 19:53 PDT
 "vector3_test" time elapsed: 00:00:00
 ----------------------------------------------------------
 
@@ -34,14 +34,14 @@ Test Passed.
 3/5 Test: matrix2_test
 Command: "/home/yasutomo/devel/moflib/src/mof/math/test/testbin/matrix2_test"
 Directory: /home/yasutomo/devel/moflib/src/build_unix/mof/math
-"matrix2_test" start time: Sep 03 15:16 PDT
+"matrix2_test" start time: Sep 05 19:53 PDT
 Output:
 ----------------------------------------------------------
 <end of output>
 Test time =   0.01 sec
 ----------------------------------------------------------
 Test Passed.
-"matrix2_test" end time: Sep 03 15:16 PDT
+"matrix2_test" end time: Sep 05 19:53 PDT
 "matrix2_test" time elapsed: 00:00:00
 ----------------------------------------------------------
 
@@ -49,14 +49,14 @@ Test Passed.
 4/5 Test: matrix3_test
 Command: "/home/yasutomo/devel/moflib/src/mof/math/test/testbin/matrix3_test"
 Directory: /home/yasutomo/devel/moflib/src/build_unix/mof/math
-"matrix3_test" start time: Sep 03 15:16 PDT
+"matrix3_test" start time: Sep 05 19:53 PDT
 Output:
 ----------------------------------------------------------
 <end of output>
-Test time =   0.02 sec
+Test time =   0.01 sec
 ----------------------------------------------------------
 Test Passed.
-"matrix3_test" end time: Sep 03 15:16 PDT
+"matrix3_test" end time: Sep 05 19:53 PDT
 "matrix3_test" time elapsed: 00:00:00
 ----------------------------------------------------------
 
@@ -64,15 +64,15 @@ Test Passed.
 5/5 Test: make_matrix_test
 Command: "/home/yasutomo/devel/moflib/src/mof/math/test/testbin/make_matrix_test"
 Directory: /home/yasutomo/devel/moflib/src/build_unix/mof/math
-"make_matrix_test" start time: Sep 03 15:16 PDT
+"make_matrix_test" start time: Sep 05 19:53 PDT
 Output:
 ----------------------------------------------------------
 <end of output>
-Test time =   0.01 sec
+Test time =   0.02 sec
 ----------------------------------------------------------
 Test Passed.
-"make_matrix_test" end time: Sep 03 15:16 PDT
+"make_matrix_test" end time: Sep 05 19:53 PDT
 "make_matrix_test" time elapsed: 00:00:00
 ----------------------------------------------------------
 
-End testing: Sep 03 15:16 PDT
+End testing: Sep 05 19:53 PDT
index a5bac9f..1842d82 100644 (file)
@@ -11,7 +11,6 @@ SET(CMAKE_FORCE_UNIX_PATHS 1)
 # The C and CXX include file search paths:
 SET(CMAKE_C_INCLUDE_PATH
   ".."
-  "../mof/math/BOOST_INCLUDE_DIR"
   )
 SET(CMAKE_CXX_INCLUDE_PATH ${CMAKE_C_INCLUDE_PATH})
 SET(CMAKE_Fortran_INCLUDE_PATH ${CMAKE_C_INCLUDE_PATH})
index 4644440..7ce566b 100644 (file)
@@ -2,7 +2,7 @@
 # Generated by "Unix Makefiles" Generator, CMake Version 2.8
 
 # compile CXX with /usr/bin/c++
-CXX_FLAGS = -Wall -Werror -g -DPSTSDK_VALIDATION_LEVEL_FULL -std=c++0x -I/home/yasutomo/devel/moflib/src -I/home/yasutomo/devel/moflib/src/mof/math/BOOST_INCLUDE_DIR  
+CXX_FLAGS = -Wall -g -DPSTSDK_VALIDATION_LEVEL_FULL -std=c++0x -I/home/yasutomo/devel/moflib/src  
 
 CXX_DEFINES = 
 
index 19c7446..a0cc250 100644 (file)
@@ -1 +1 @@
-/usr/bin/c++   -Wall -Werror -g -DPSTSDK_VALIDATION_LEVEL_FULL -std=c++0x   CMakeFiles/make_matrix_test.dir/test/make_matrix_test.cpp.o  -o ../../../mof/math/test/testbin/make_matrix_test -rdynamic -L/home/yasutomo/devel/moflib/src/../lib /home/yasutomo/devel/moflib/lib/libmofmath.a -Wl,-rpath,/home/yasutomo/devel/moflib/src/../lib 
+/usr/bin/c++   -Wall -g -DPSTSDK_VALIDATION_LEVEL_FULL -std=c++0x   CMakeFiles/make_matrix_test.dir/test/make_matrix_test.cpp.o  -o ../../../mof/math/test/testbin/make_matrix_test -rdynamic -L/home/yasutomo/devel/moflib/src/../lib /home/yasutomo/devel/moflib/lib/libmofmath.a -Wl,-rpath,/home/yasutomo/devel/moflib/src/../lib 
index 4644440..7ce566b 100644 (file)
@@ -2,7 +2,7 @@
 # Generated by "Unix Makefiles" Generator, CMake Version 2.8
 
 # compile CXX with /usr/bin/c++
-CXX_FLAGS = -Wall -Werror -g -DPSTSDK_VALIDATION_LEVEL_FULL -std=c++0x -I/home/yasutomo/devel/moflib/src -I/home/yasutomo/devel/moflib/src/mof/math/BOOST_INCLUDE_DIR  
+CXX_FLAGS = -Wall -g -DPSTSDK_VALIDATION_LEVEL_FULL -std=c++0x -I/home/yasutomo/devel/moflib/src  
 
 CXX_DEFINES = 
 
index 7a76b85..83f32c5 100644 (file)
@@ -1 +1 @@
-/usr/bin/c++   -Wall -Werror -g -DPSTSDK_VALIDATION_LEVEL_FULL -std=c++0x   CMakeFiles/matrix2_test.dir/test/matrix2_test.cpp.o  -o ../../../mof/math/test/testbin/matrix2_test -rdynamic -L/home/yasutomo/devel/moflib/src/../lib /home/yasutomo/devel/moflib/lib/libmofmath.a -Wl,-rpath,/home/yasutomo/devel/moflib/src/../lib 
+/usr/bin/c++   -Wall -g -DPSTSDK_VALIDATION_LEVEL_FULL -std=c++0x   CMakeFiles/matrix2_test.dir/test/matrix2_test.cpp.o  -o ../../../mof/math/test/testbin/matrix2_test -rdynamic -L/home/yasutomo/devel/moflib/src/../lib /home/yasutomo/devel/moflib/lib/libmofmath.a -Wl,-rpath,/home/yasutomo/devel/moflib/src/../lib 
index 4644440..7ce566b 100644 (file)
@@ -2,7 +2,7 @@
 # Generated by "Unix Makefiles" Generator, CMake Version 2.8
 
 # compile CXX with /usr/bin/c++
-CXX_FLAGS = -Wall -Werror -g -DPSTSDK_VALIDATION_LEVEL_FULL -std=c++0x -I/home/yasutomo/devel/moflib/src -I/home/yasutomo/devel/moflib/src/mof/math/BOOST_INCLUDE_DIR  
+CXX_FLAGS = -Wall -g -DPSTSDK_VALIDATION_LEVEL_FULL -std=c++0x -I/home/yasutomo/devel/moflib/src  
 
 CXX_DEFINES = 
 
index da0b6b2..7ba7d31 100644 (file)
@@ -1 +1 @@
-/usr/bin/c++   -Wall -Werror -g -DPSTSDK_VALIDATION_LEVEL_FULL -std=c++0x   CMakeFiles/matrix3_test.dir/test/matrix3_test.cpp.o  -o ../../../mof/math/test/testbin/matrix3_test -rdynamic -L/home/yasutomo/devel/moflib/src/../lib /home/yasutomo/devel/moflib/lib/libmofmath.a -Wl,-rpath,/home/yasutomo/devel/moflib/src/../lib 
+/usr/bin/c++   -Wall -g -DPSTSDK_VALIDATION_LEVEL_FULL -std=c++0x   CMakeFiles/matrix3_test.dir/test/matrix3_test.cpp.o  -o ../../../mof/math/test/testbin/matrix3_test -rdynamic -L/home/yasutomo/devel/moflib/src/../lib /home/yasutomo/devel/moflib/lib/libmofmath.a -Wl,-rpath,/home/yasutomo/devel/moflib/src/../lib 
index 4644440..7ce566b 100644 (file)
@@ -2,7 +2,7 @@
 # Generated by "Unix Makefiles" Generator, CMake Version 2.8
 
 # compile CXX with /usr/bin/c++
-CXX_FLAGS = -Wall -Werror -g -DPSTSDK_VALIDATION_LEVEL_FULL -std=c++0x -I/home/yasutomo/devel/moflib/src -I/home/yasutomo/devel/moflib/src/mof/math/BOOST_INCLUDE_DIR  
+CXX_FLAGS = -Wall -g -DPSTSDK_VALIDATION_LEVEL_FULL -std=c++0x -I/home/yasutomo/devel/moflib/src  
 
 CXX_DEFINES = 
 
index 4644440..7ce566b 100644 (file)
@@ -2,7 +2,7 @@
 # Generated by "Unix Makefiles" Generator, CMake Version 2.8
 
 # compile CXX with /usr/bin/c++
-CXX_FLAGS = -Wall -Werror -g -DPSTSDK_VALIDATION_LEVEL_FULL -std=c++0x -I/home/yasutomo/devel/moflib/src -I/home/yasutomo/devel/moflib/src/mof/math/BOOST_INCLUDE_DIR  
+CXX_FLAGS = -Wall -g -DPSTSDK_VALIDATION_LEVEL_FULL -std=c++0x -I/home/yasutomo/devel/moflib/src  
 
 CXX_DEFINES = 
 
index 9a70ada..02d626f 100644 (file)
@@ -1 +1 @@
-/usr/bin/c++   -Wall -Werror -g -DPSTSDK_VALIDATION_LEVEL_FULL -std=c++0x   CMakeFiles/vector2_test.dir/test/vector2_test.cpp.o  -o ../../../mof/math/test/testbin/vector2_test -rdynamic -L/home/yasutomo/devel/moflib/src/../lib /home/yasutomo/devel/moflib/lib/libmofmath.a -Wl,-rpath,/home/yasutomo/devel/moflib/src/../lib 
+/usr/bin/c++   -Wall -g -DPSTSDK_VALIDATION_LEVEL_FULL -std=c++0x   CMakeFiles/vector2_test.dir/test/vector2_test.cpp.o  -o ../../../mof/math/test/testbin/vector2_test -rdynamic -L/home/yasutomo/devel/moflib/src/../lib /home/yasutomo/devel/moflib/lib/libmofmath.a -Wl,-rpath,/home/yasutomo/devel/moflib/src/../lib 
index 4644440..7ce566b 100644 (file)
@@ -2,7 +2,7 @@
 # Generated by "Unix Makefiles" Generator, CMake Version 2.8
 
 # compile CXX with /usr/bin/c++
-CXX_FLAGS = -Wall -Werror -g -DPSTSDK_VALIDATION_LEVEL_FULL -std=c++0x -I/home/yasutomo/devel/moflib/src -I/home/yasutomo/devel/moflib/src/mof/math/BOOST_INCLUDE_DIR  
+CXX_FLAGS = -Wall -g -DPSTSDK_VALIDATION_LEVEL_FULL -std=c++0x -I/home/yasutomo/devel/moflib/src  
 
 CXX_DEFINES = 
 
index fab204a..c431531 100644 (file)
@@ -1 +1 @@
-/usr/bin/c++   -Wall -Werror -g -DPSTSDK_VALIDATION_LEVEL_FULL -std=c++0x   CMakeFiles/vector3_test.dir/test/vector3_test.cpp.o  -o ../../../mof/math/test/testbin/vector3_test -rdynamic -L/home/yasutomo/devel/moflib/src/../lib /home/yasutomo/devel/moflib/lib/libmofmath.a -Wl,-rpath,/home/yasutomo/devel/moflib/src/../lib 
+/usr/bin/c++   -Wall -g -DPSTSDK_VALIDATION_LEVEL_FULL -std=c++0x   CMakeFiles/vector3_test.dir/test/vector3_test.cpp.o  -o ../../../mof/math/test/testbin/vector3_test -rdynamic -L/home/yasutomo/devel/moflib/src/../lib /home/yasutomo/devel/moflib/lib/libmofmath.a -Wl,-rpath,/home/yasutomo/devel/moflib/src/../lib 
index f338302..1842d82 100644 (file)
@@ -11,7 +11,6 @@ SET(CMAKE_FORCE_UNIX_PATHS 1)
 # The C and CXX include file search paths:
 SET(CMAKE_C_INCLUDE_PATH
   ".."
-  "../mof/util/BOOST_INCLUDE_DIR"
   )
 SET(CMAKE_CXX_INCLUDE_PATH ${CMAKE_C_INCLUDE_PATH})
 SET(CMAKE_Fortran_INCLUDE_PATH ${CMAKE_C_INCLUDE_PATH})
index 75c7dab..7ce566b 100644 (file)
@@ -2,7 +2,7 @@
 # Generated by "Unix Makefiles" Generator, CMake Version 2.8
 
 # compile CXX with /usr/bin/c++
-CXX_FLAGS = -Wall -Werror -g -DPSTSDK_VALIDATION_LEVEL_FULL -std=c++0x -I/home/yasutomo/devel/moflib/src -I/home/yasutomo/devel/moflib/src/mof/util/BOOST_INCLUDE_DIR  
+CXX_FLAGS = -Wall -g -DPSTSDK_VALIDATION_LEVEL_FULL -std=c++0x -I/home/yasutomo/devel/moflib/src  
 
 CXX_DEFINES = 
 
index 06972ee..143a8a4 100644 (file)
@@ -116,7 +116,6 @@ namespace math
 //{{{ operator *=      
                Derived& operator*=(const Derived& rhs)
                {
-<<<<<<< HEAD
                        Derived M;
                        for (size_t i = 0; i < Dim; ++i) {
                                for (size_t j = 0; j <= Dim; ++j) {
@@ -125,26 +124,6 @@ namespace math
                                                sum += at(i, k) * rhs.at(k, j);
                                        }
                                        M.elements_[i][j] = sum;
-=======
-                       Derived retval;
-                       const int SIZE = Dim + 1;
-
-                       // calculate the last element previously
-                       int b = last_index() - Dim;
-                       int c = Dim;
-                       float last_sum = 0;
-                       for (int i = 0; i < SIZE; ++i) {
-                               last_sum += elements_[b + i] * rhs.elements_[c + i * SIZE];
-                       }
-                       retval.elements_[last_index()] = 1;
-
-                       for (int a = last_index() - 1; a >= 0; --a) {
-                               int b = a / SIZE * SIZE;
-                               int c = a % SIZE;
-                               float sum = 0;
-                               for (int i = 0; i < SIZE; ++i) {
-                                       sum += elements_[b + i] * rhs.elements_[c + i * SIZE];
->>>>>>> 01b4978a6b6cd046ad399644ea70ddec977a688a
                                }
                        }
                        *this = M;
@@ -165,7 +144,7 @@ namespace math
                        for (size_t i = 0; i < Dim; ++i) {
                                float sum = 0;
                                for (size_t k = 0; k <= Dim; ++k) {
-                                       sum += (*this)[i][k] * rhs[k];
+                                       sum += elements_[i][k] * rhs[k];
                                }
                                arr[i] = sum;
                        }
diff --git a/src/mof/math/basic_matrix.hpp.orig b/src/mof/math/basic_matrix.hpp.orig
new file mode 100644 (file)
index 0000000..06972ee
--- /dev/null
@@ -0,0 +1,276 @@
+#pragma once
+#include <mof/base/mofdef.hpp>
+#include <mof/math/threshold.hpp>
+#include <boost/operators.hpp>
+#include <ostream>
+#include <iomanip>
+#include <cmath>
+
+namespace mof
+{
+namespace math
+{
+       template <size_t Dim> class row_of_matrix;
+
+       /**
+        * @brief 同次座標変換行列テンプレートクラス
+        * @note  このクラスはアフィン変換行列を表す
+        * @note  このテンプレートから直接特殊化することは想定していない.
+        * あくまでmatrixxを実装するための補助テンプレートである.
+        * このクラスは不変クラスである.
+        * @tparam Dim        行列の次元(要素数はこの数値の2乗)
+        * @tparam Derived    特殊化されたテンプレートの派生クラス(matrixx)の型
+        * @tparam Coordinate 対応するベクトルクラス(vectorx)の型
+        */
+       template <size_t Dim, typename Derived, typename Coordinate>
+       class basic_matrix
+               : boost::addable< Derived 
+               , boost::addable2< Derived, float
+               , boost::subtractable< Derived 
+               , boost::subtractable2< Derived, float
+               , boost::multipliable< Derived
+               , boost::multipliable2< Derived, float
+               , boost::dividable2< Derived, float
+               , boost::equality_comparable< Derived
+               > > > > > > > >
+       {
+       protected:
+//{{{ size
+               /**
+                * @brief components_のサイズを返す
+                */
+               size_t size() const
+               {
+                       return Dim * (Dim + 1);
+               }
+//}}}
+               union 
+               {
+                       float components_[Dim * (Dim + 1)];
+                       float elements_[Dim][Dim + 1];
+               };///< 要素の配列(アフィン行列なので,最後の行は省略している)
+       public:
+               // コンストラクタ,デストラクタはデフォルトのものを使う
+               // 代入演算子,コピーコンストラクタはデフォルトのものを使う
+//{{{ swap
+               void swap(Derived& rhs) throw()
+               {
+                       using std::swap;
+                       for (size_t i = 0; i < size(); ++i) {
+                               swap(components_[i], rhs.components_[i]);
+                       }
+               }
+//}}}
+//{{{ operator +=
+               Derived& operator+=(const Derived& rhs)
+               {
+                       for (size_t i = 0; i < size(); ++i) {
+                               components_[i] += rhs.components_[i];
+                       }
+                       return *reinterpret_cast<Derived*>(this);//thisがDerived型であることは保証されている.
+               }
+               
+               Derived& operator+=(float rhs) 
+               {
+                       for (size_t i = 0; i < size(); ++i) {
+                               components_[i] += rhs;
+                       }
+                       return *reinterpret_cast<Derived*>(this);//thisがDerived型であることは保証されている.
+               }
+               
+               friend Derived operator+(float rhs1, Derived& rhs2)
+               {
+                       float tmp[size()];
+                       for (size_t i = 0; i < size(); ++i) {
+                               tmp[i] = rhs1 + rhs2.components_[i];
+                       }
+                       return Derived(tmp);
+               }
+//}}}
+//{{{ operator -=
+               Derived& operator-=(const Derived& rhs)
+               {
+                       for (size_t i = 0; i < size(); ++i) {
+                               components_[i] -= rhs.components_[i];
+                       }
+                       return *reinterpret_cast<Derived*>(this);//thisがDerived型であることは保証されている.
+               }
+               
+               Derived& operator-=(float rhs)
+               {
+                       for (size_t i = 0; i < size(); ++i) {
+                               components_[i] -= rhs;
+                       }
+                       return *reinterpret_cast<Derived*>(this);//thisがDerived型であることは保証されている.
+               }
+               
+               friend Derived operator-(float rhs1, Derived& rhs2) 
+               {
+                       float tmp[size()];
+                       for (size_t i = 0; i < size(); ++i) {
+                               tmp[i] = rhs1 - rhs2.components_[i];
+                       }
+                       return Derived(tmp);
+               }
+//}}}
+//{{{ operator *=      
+               Derived& operator*=(const Derived& rhs)
+               {
+<<<<<<< HEAD
+                       Derived M;
+                       for (size_t i = 0; i < Dim; ++i) {
+                               for (size_t j = 0; j <= Dim; ++j) {
+                                       float sum = 0;
+                                       for (size_t k = 0; k <= Dim; ++k) {
+                                               sum += at(i, k) * rhs.at(k, j);
+                                       }
+                                       M.elements_[i][j] = sum;
+=======
+                       Derived retval;
+                       const int SIZE = Dim + 1;
+
+                       // calculate the last element previously
+                       int b = last_index() - Dim;
+                       int c = Dim;
+                       float last_sum = 0;
+                       for (int i = 0; i < SIZE; ++i) {
+                               last_sum += elements_[b + i] * rhs.elements_[c + i * SIZE];
+                       }
+                       retval.elements_[last_index()] = 1;
+
+                       for (int a = last_index() - 1; a >= 0; --a) {
+                               int b = a / SIZE * SIZE;
+                               int c = a % SIZE;
+                               float sum = 0;
+                               for (int i = 0; i < SIZE; ++i) {
+                                       sum += elements_[b + i] * rhs.elements_[c + i * SIZE];
+>>>>>>> 01b4978a6b6cd046ad399644ea70ddec977a688a
+                               }
+                       }
+                       *this = M;
+                       return *reinterpret_cast<Derived*>(this);//thisがDerived型であることは保証されている.
+               }
+
+               Derived& operator*=(float rhs) 
+               {
+                       for (size_t i = 0; i < size(); ++i) {
+                               components_[i] *= rhs;
+                       }
+                       return *reinterpret_cast<Derived*>(this);//thisがDerived型であることは保証されている.
+               }
+       
+               Coordinate operator*(const Coordinate& rhs)
+               {
+                       float arr[Dim];
+                       for (size_t i = 0; i < Dim; ++i) {
+                               float sum = 0;
+                               for (size_t k = 0; k <= Dim; ++k) {
+                                       sum += (*this)[i][k] * rhs[k];
+                               }
+                               arr[i] = sum;
+                       }
+                       return Coordinate(arr);
+               }
+//}}}
+//{{{ operator /=
+               Derived& operator/=(float rhs)
+               {
+                       for (size_t i = 0; i < size(); ++i) {
+                               components_[i] /= rhs;
+                       }
+                       return *reinterpret_cast<Derived*>(this);//thisがDerived型であることは保証されている.
+               }
+//}}}
+//{{{ operator ==
+               bool operator==(const Derived& rhs) const
+               {
+                       for (size_t i = 0; i < size(); ++i) {
+                               if (std::abs(components_[i] - rhs.components_[i]) > MOF_ERROR_THRESHOLD) return false;
+                       }
+                       return true;
+               }
+//}}}
+//{{{ operator []
+               /**
+                * @note M[i][j]のように参照可能
+                * @note この方法による複数の要素への参照は非効率
+                */
+               row_of_matrix<Dim> const operator [](size_t i) const
+               {
+                       return row_of_matrix<Dim>(i, elements_);
+               }
+//}}}
+//{{{ operator <<
+               /**
+                * @brief デバッグ出力用ストリーム演算子
+                * @param [in] stream 出力ストリーム
+                * @param [in] rhs    出力対象となる行列オブジェクト
+                * @return 引数で与えられた出力ストリーム
+                */
+               friend std::ostream& operator<<
+               (
+                       std::ostream& stream,
+                       const Derived& rhs
+               )
+               {
+                       for (size_t i = 0; i < Dim + 1; ++i) {
+                               for (size_t j = 0; j < Dim + 1; ++j) {
+                                       if (j != 0) stream << ", ";
+                                       else if (j != Dim) stream << "\n";
+                                       stream << std::setw(5) << rhs[i][j];
+                               }
+                       }
+                       return stream;
+               }
+//}}}
+//{{{ at
+               /**
+                * @brief 行列の要素にアクセス
+                * @param[in] 行番号
+                * @param[in] 列番号
+                * @return    要素
+                */
+               const float at(size_t i, size_t j) const
+               {
+                       if (i < Dim ) return elements_[i][j];
+                       if (j == Dim) return 1;
+                       else return 0;
+               }
+//}}}
+       };
+//{{{ swap
+       template <size_t Dim, typename Derived, typename Coordinate>
+       void swap
+       (
+               basic_matrix<Dim, Derived, Coordinate>& a,
+               basic_matrix<Dim, Derived, Coordinate>& b
+       ) throw()
+       {
+               a.swap(b);
+       }
+//}}}
+//{{{ row_of_matrix
+       /**
+        * @brief M[i][j]のように行列の要素を取得するための補助クラス
+        */
+       template <size_t Dim>
+       class row_of_matrix
+       {
+               size_t index_;
+               const float (&elements_)[Dim][Dim+1];
+       public:
+               row_of_matrix(size_t i, const float (&elements)[Dim][Dim+1])
+                       : index_(i), elements_(elements)
+               {
+               }
+
+               float operator[](size_t j) const
+               {
+                       if (Dim != index_) return elements_[index_][j];
+                       else if (Dim == j) return 1;
+                       else return 0;
+               }
+       };
+//}}}
+}// namespace math
+}// namespace mof
index e6ae1a3..ba78898 100644 (file)
@@ -86,16 +86,6 @@ namespace math
                        for (size_t i = 0; i < Dim; ++i) components_[i] *= rhs;
                        return *reinterpret_cast<Derived*>(this);//thisがDerived型であることは保証されている.
                }
-<<<<<<< HEAD
-               
-               friend Derived operator*(float rhs1, Derived& rhs2)
-               {
-                       Derived retval;
-                       for (size_t i = 0; i < Dim; ++i) retval.components_[i] = rhs1 * rhs2.components_[i];
-                       return retval;
-               }
-=======
->>>>>>> 01b4978a6b6cd046ad399644ea70ddec977a688a
 //}}}
 //{{{ operator /=
                Derived& operator/=(float rhs)
@@ -158,3 +148,4 @@ namespace math
 
 }// namespace math
 }// namespace mof
+
diff --git a/src/mof/math/basic_vector.hpp.orig b/src/mof/math/basic_vector.hpp.orig
new file mode 100644 (file)
index 0000000..e6ae1a3
--- /dev/null
@@ -0,0 +1,160 @@
+#pragma once
+#include <mof/base/mofdef.hpp>
+#include <mof/math/threshold.hpp>
+#include <boost/operators.hpp>
+#include <ostream>
+#include <cmath>
+
+
+namespace mof
+{
+namespace math
+{
+       /**
+        * @brief 同次座標ベクトルテンプレートクラス
+        * @note  このテンプレートから直接特殊化することは想定していない.
+        * あくまでvectorxを実装するための補助テンプレートである.
+        * このクラスは不変クラスである.
+        * @tparam Dim     ベクトルの次元(要素数)
+        * @tparam Derived 特殊化されたテンプレートの派生クラス(vectorx)の型
+        */
+       template <size_t Dim, typename Derived>
+       class basic_vector 
+               : boost::addable< Derived 
+               , boost::addable2< Derived, float
+               , boost::subtractable< Derived 
+               , boost::subtractable2< Derived, float
+               , boost::multipliable2< Derived, float
+               , boost::dividable2< Derived, float
+               , boost::equality_comparable< Derived
+               > > > > > > > 
+       {
+       protected:
+               float components_[Dim];///< 要素の配列
+       public:
+               // コンストラクタ,デストラクタはデフォルトのものを使う
+               // 代入演算子,コピーコンストラクタはデフォルトのものを使う
+//{{{ swap
+               void swap(Derived& rhs) throw()
+               {
+                       for (size_t i = 0; i < Dim; ++i) std::swap(rhs.components_[i], components_[i]);
+               }
+//}}}
+//{{{ operator +=
+               Derived& operator+=(const Derived& rhs)
+               {
+                       for (size_t i = 0; i < Dim; ++i) components_[i] += rhs.components_[i];
+                       return *reinterpret_cast<Derived*>(this);//thisがDerived型であることは保証されている.
+               }
+               
+               Derived& operator+=(float rhs) 
+               {
+                       for (size_t i = 0; i < Dim; ++i) components_[i] += rhs;
+                       return *reinterpret_cast<Derived*>(this);//thisがDerived型であることは保証されている.
+               }
+               
+               friend Derived operator+(float rhs1, Derived& rhs2)
+               {
+                       Derived retval;
+                       for (size_t i = 0; i < Dim; ++i) retval.components_[i] = rhs1 + rhs2.components_[i];
+                       return retval;
+               }
+//}}}
+//{{{ operator -=
+               Derived& operator-=(const Derived& rhs)
+               {
+                       for (size_t i = 0; i < Dim; ++i) components_[i] -= rhs.components_[i];
+                       return *reinterpret_cast<Derived*>(this);//thisがDerived型であることは保証されている.
+               }
+               
+               Derived& operator-=(float rhs)
+               {
+                       for (size_t i = 0; i < Dim; ++i) components_[i] -= rhs;
+                       return *reinterpret_cast<Derived*>(this);//thisがDerived型であることは保証されている.
+               }
+
+               friend Derived operator-(float rhs1, Derived& rhs2)
+               {
+                       Derived retval;
+                       for (size_t i = 0; i < Dim; ++i) retval.components_[i] = rhs1 - rhs2.components_[i];
+                       return retval;
+               }
+//}}}
+//{{{ operator *=
+               Derived& operator*=(float rhs)
+               {
+                       for (size_t i = 0; i < Dim; ++i) components_[i] *= rhs;
+                       return *reinterpret_cast<Derived*>(this);//thisがDerived型であることは保証されている.
+               }
+<<<<<<< HEAD
+               
+               friend Derived operator*(float rhs1, Derived& rhs2)
+               {
+                       Derived retval;
+                       for (size_t i = 0; i < Dim; ++i) retval.components_[i] = rhs1 * rhs2.components_[i];
+                       return retval;
+               }
+=======
+>>>>>>> 01b4978a6b6cd046ad399644ea70ddec977a688a
+//}}}
+//{{{ operator /=
+               Derived& operator/=(float rhs)
+               {
+                       for (size_t i = 0; i < Dim; ++i) components_[i] /= rhs;
+                       return *reinterpret_cast<Derived*>(this);//thisがDerived型であることは保証されている.
+               }
+//}}}
+//{{{ operator ==
+               bool operator==(const Derived& rhs) const
+               {
+                       for (size_t i = 0; i < Dim; ++i) {
+                               if (std::abs(components_[i] - rhs.components_[i]) > MOF_ERROR_THRESHOLD) return false;
+                       }
+                       return true;
+               }
+//}}}
+//{{{ operator []
+               /**
+                * @note Dim+1番目の要素は常に1
+                * @param[in] index 添字
+                */
+               float operator[](size_t index) const
+               {
+                       if (index < Dim) return components_[index];
+                       else if (index == Dim) return 1;
+                       // TODO exception
+                       return 0;
+               }
+//}}}
+//{{{ operator <<
+               /**
+                * @brief デバッグ出力用ストリーム演算子
+                * @param[in] stream 出力ストリーム
+                * @param[in] rhs    出力対象となるベクトルオブジェクト
+                * @return 引数で与えられた出力ストリーム
+                */
+               friend std::ostream& operator<<
+               (
+                       std::ostream& stream,
+                       const Derived& rhs
+               )
+               {
+                       for (size_t i = 0; i < Dim; ++i)
+                       {
+                               if (i != 0) stream << ", ";
+                               stream << rhs.components_[i];
+                       }
+                       return stream;
+               }
+//}}}
+       };
+//{{{ swap
+       template <size_t Dim, typename Derived>
+       void swap(basic_vector<Dim, Derived>& a, basic_vector<Dim, Derived>& b) throw()
+       {
+               a.swap(b);
+       }
+//}}}
+
+}// namespace math
+}// namespace mof
index 2e969de..a460b76 100644 (file)
@@ -66,13 +66,8 @@ namespace math
 //{{{ operator =
        matrix2& operator = (const matrix2& rhs)
        {
-<<<<<<< HEAD
                for (size_t i = 0; i < size(); ++i) {
                        components_[i] = rhs.components_[i];
-=======
-               for (size_t i = 0; i <= last_index() - 1; ++i) {
-                       elements_[i] = rhs.elements_[i];
->>>>>>> 01b4978a6b6cd046ad399644ea70ddec977a688a
                }
                return *this;
        }
diff --git a/src/mof/math/matrix2.hpp.orig b/src/mof/math/matrix2.hpp.orig
new file mode 100644 (file)
index 0000000..2e969de
--- /dev/null
@@ -0,0 +1,83 @@
+#pragma once
+#include <mof/math/basic_matrix.hpp>
+
+namespace mof
+{
+namespace math
+{
+       class vector2;
+
+       /**
+        * @brief 2次元同次座標変換行列クラス
+        */
+       class matrix2 : public basic_matrix<2, matrix2, vector2>
+       {
+       public:
+//{{{ constructor
+               /**
+                * @brief デフォルトコンストラクタ
+                * @note  効率のため,初期化は行われない
+                */
+               matrix2()
+               {
+               }
+
+               /**
+                * @brief 指定した値で初期化する.
+                * @tparam     T   配列型(operator[]をオーバーロードしていること)
+                * @param[in]  arr 初期化用配列
+                */
+               template <class T>
+               explicit matrix2(const T& arr)
+               {
+                       for (size_t i = 0; i < size(); ++i) {
+                               components_[i] = arr[i];
+                       }
+               }
+               
+               /**
+                * @brief 指定した値で初期化する.
+                */
+               matrix2
+               (
+                       float m11, float m12, float m13,
+                       float m21, float m22, float m23
+               )
+               {
+                       const float* table[] =
+                               {
+                                       &m11, &m12, &m13,
+                                       &m21, &m22, &m23
+                               };
+                       for (size_t i = 0; i < size(); ++i) {
+                               components_[i] = *table[i];
+                       }
+               }
+
+//}}}
+//{{{ copy constructor
+       matrix2(const matrix2& rhs)
+       {
+               for (size_t i = 0; i < size(); ++i) {
+                       components_[i] = rhs.components_[i];
+               }
+       }
+//}}}
+//{{{ operator =
+       matrix2& operator = (const matrix2& rhs)
+       {
+<<<<<<< HEAD
+               for (size_t i = 0; i < size(); ++i) {
+                       components_[i] = rhs.components_[i];
+=======
+               for (size_t i = 0; i <= last_index() - 1; ++i) {
+                       elements_[i] = rhs.elements_[i];
+>>>>>>> 01b4978a6b6cd046ad399644ea70ddec977a688a
+               }
+               return *this;
+       }
+//}}}
+       };
+
+}// namespace math
+}// namespace mof
index a6f7849..77e6ade 100644 (file)
@@ -60,13 +60,8 @@ namespace math
 //{{{ copy constructor
        matrix3(const matrix3& rhs)
        {
-<<<<<<< HEAD
                for (size_t i = 0; i < size(); ++i) {
                        components_[i] = rhs.components_[i];
-=======
-               for (size_t i = 0; i <= last_index(); ++i) {
-                       elements_[i] = rhs.elements_[i];
->>>>>>> 01b4978a6b6cd046ad399644ea70ddec977a688a
                }
        }
 //}}}
@@ -76,13 +71,8 @@ namespace math
         */
        matrix3& operator = (const matrix3& rhs)
        {
-<<<<<<< HEAD
                for (size_t i = 0; i < size(); ++i) {
                        components_[i] = rhs.components_[i];
-=======
-               for (size_t i = 0; i <= last_index() -1; ++i) {
-                       elements_[i] = rhs.elements_[i];
->>>>>>> 01b4978a6b6cd046ad399644ea70ddec977a688a
                }
                return *this;
        }
diff --git a/src/mof/math/matrix3.hpp.orig b/src/mof/math/matrix3.hpp.orig
new file mode 100644 (file)
index 0000000..a6f7849
--- /dev/null
@@ -0,0 +1,93 @@
+#pragma once
+#include <mof/math/basic_matrix.hpp>
+
+namespace mof
+{
+namespace math
+{
+       class vector3;
+
+       /**
+        * @brief 3次元同次座標変換行列クラス
+        */
+       class matrix3 : public basic_matrix<3, matrix3, vector3>
+       {
+       public:
+//{{{ constructor
+               /**
+                * @brief デフォルトコンストラクタ
+                * @note  効率のため,初期化は行われない
+                */
+               matrix3()
+               {
+               }
+
+               /**
+                * @brief 指定した値で初期化する.
+                * @tparam     T   配列型(operator[]をオーバーロードしていること)
+                * @param[in]  arr 初期化用配列
+                */
+               template <class T>
+               explicit matrix3(const T& arr)
+               {
+                       for (size_t i = 0; i < size(); ++i) {
+                               components_[i] = arr[i];
+                       }
+               }
+
+               /**
+                * @brief 指定した値で初期化する.
+                */
+               matrix3
+               (
+                       float m11, float m12, float m13, float m14,
+                       float m21, float m22, float m23, float m24,
+                       float m31, float m32, float m33, float m34
+               )
+               {
+                       const float* table[] =
+                               {
+                                       &m11, &m12, &m13, &m14,
+                                       &m21, &m22, &m23, &m24,
+                                       &m31, &m32, &m33, &m34
+                               };
+                       for (size_t i = 0; i < size(); ++i) {
+                               components_[i] = *table[i];
+                       }
+               }
+
+//}}}
+//{{{ copy constructor
+       matrix3(const matrix3& rhs)
+       {
+<<<<<<< HEAD
+               for (size_t i = 0; i < size(); ++i) {
+                       components_[i] = rhs.components_[i];
+=======
+               for (size_t i = 0; i <= last_index(); ++i) {
+                       elements_[i] = rhs.elements_[i];
+>>>>>>> 01b4978a6b6cd046ad399644ea70ddec977a688a
+               }
+       }
+//}}}
+//{{{ operator =
+       /**
+        * @note コピーのパフォーマンスのためにこの関数の定義は重要
+        */
+       matrix3& operator = (const matrix3& rhs)
+       {
+<<<<<<< HEAD
+               for (size_t i = 0; i < size(); ++i) {
+                       components_[i] = rhs.components_[i];
+=======
+               for (size_t i = 0; i <= last_index() -1; ++i) {
+                       elements_[i] = rhs.elements_[i];
+>>>>>>> 01b4978a6b6cd046ad399644ea70ddec977a688a
+               }
+               return *this;
+       }
+//}}}
+       };
+
+}// namespace math
+}// namespace mof
index 30595a4..f079e11 100644 (file)
@@ -83,12 +83,7 @@ int main()
                matrix3 N1(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12);
                matrix3 N2(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13);
                matrix3 N = N1 * N2;
-<<<<<<< HEAD
                matrix3 A(44, 50, 56, 66, 116, 134, 152, 178, 188, 218, 248, 290);
-=======
-               matrix3 A(44, 50, 56, 66, 116, 134, 152, 178, 188, 218, 248, 290, 0, 0, 0);
-               cout << N << endl;
->>>>>>> 01b4978a6b6cd046ad399644ea70ddec977a688a
                if (N != A) {
                        cerr << "Failed:" << "Affine matrix N1 * N2 test" << endl;      
                        failed_count++;
@@ -96,28 +91,7 @@ int main()
        }
        
        {
-<<<<<<< HEAD
                matrix3 M(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12);
-=======
-               matrix3 N1(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
-               matrix3 N2(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
-               matrix3 N = N1 * N2;
-               matrix3 A
-               (
-                       0.25840f, 0.28424f, 0.31008f, 0.17054f,
-                       0.58915f, 0.65633f, 0.72351f, 0.45995f,
-                       0.91990f, 1.02842f, 1.13695f, 0.74935f,
-                       0.70801f, 0.81912f, 0.93023f
-               );
-               if (N != A) {
-                       cerr << "Failed:" << "Projective matrix N1 * N2 test" << endl;  
-                       failed_count++;
-               }
-       }
-       
-       {
-               matrix3 M(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
->>>>>>> 01b4978a6b6cd046ad399644ea70ddec977a688a
                vector3 v(1, 2, 3);
                vector3 w = M * v;
                vector3 a(18, 46, 74);
diff --git a/src/mof/math/test/matrix3_test.cpp.orig b/src/mof/math/test/matrix3_test.cpp.orig
new file mode 100644 (file)
index 0000000..30595a4
--- /dev/null
@@ -0,0 +1,152 @@
+#include <mof/math/matrix3.hpp>
+#include <mof/math/vector3.hpp>
+#include <iostream>
+#include <sstream>
+
+int main()
+{
+       using namespace mof::math;
+       using namespace std;
+       int failed_count = 0;
+
+       {
+               matrix3 M(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12);
+               bool failed = false;
+               for (size_t i = 0; i < 12; ++i) {
+                       if (M[i / 4][i % 4] != i + 1) failed = true;
+               }
+               if (failed || M[3][0] != 0 || M[3][1] != 0 || M[3][2] != 0 || M[3][3] != 1) {
+                       cerr << "Failed:" << " initialize test" << endl;        
+                       failed_count++;
+               }
+       }
+
+       {
+               float arr[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
+               matrix3 M(arr);
+               bool failed = false;
+               for (size_t i = 0; i < 12; ++i) {
+                       if (M[i / 4][i % 4] != i + 1) failed = true;
+               }
+               if (failed || M[3][0] != 0 || M[3][1] != 0 || M[3][2] != 0 || M[3][3] != 1) {
+                       cerr << "Failed:" << " initialize by array test" << endl;       
+                       failed_count++;
+               }
+       }
+
+       {       
+               matrix3 M(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12);
+               matrix3 N(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12);
+               if (M != N) {
+                       cerr << "Failed:" << " M == N test" << endl;    
+                       failed_count++;
+               }
+       }
+       
+       {       
+               matrix3 M(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12);
+               matrix3 N(0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12);
+               if (M == N) {
+                       cerr << "Failed:" << " M != N test" << endl;    
+                       failed_count++;
+               }
+       }
+
+       {
+               matrix3 N1(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12);
+               matrix3 N2(29, 27, 25, 23, 21, 19, 17, 15, 13, 11, 9, 7);
+               matrix3 N = N1 + N2;
+               matrix3 A(30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19);
+               if (N != A) {
+                       cerr << "Failed:" << " addition test" << endl;  
+                       failed_count++;
+               }
+       }
+       
+       {
+               matrix3 N1(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12);
+               matrix3 N2(29, 27, 25, 23, 21, 19, 17, 15, 13, 11, 9, 7);
+               matrix3 N = N1 - N2;
+               matrix3 A
+               (
+                       -28, -25, -22, -19,
+                       -16, -13, -10,  -7,
+                        -4,  -1,   2,   5
+               );
+               if (N != A) {
+                       cerr << "Failed:" << " subtraction test" << endl;       
+                       failed_count++;
+               }
+       }
+
+       {
+               matrix3 N1(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12);
+               matrix3 N2(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13);
+               matrix3 N = N1 * N2;
+<<<<<<< HEAD
+               matrix3 A(44, 50, 56, 66, 116, 134, 152, 178, 188, 218, 248, 290);
+=======
+               matrix3 A(44, 50, 56, 66, 116, 134, 152, 178, 188, 218, 248, 290, 0, 0, 0);
+               cout << N << endl;
+>>>>>>> 01b4978a6b6cd046ad399644ea70ddec977a688a
+               if (N != A) {
+                       cerr << "Failed:" << "Affine matrix N1 * N2 test" << endl;      
+                       failed_count++;
+               }
+       }
+       
+       {
+<<<<<<< HEAD
+               matrix3 M(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12);
+=======
+               matrix3 N1(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
+               matrix3 N2(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
+               matrix3 N = N1 * N2;
+               matrix3 A
+               (
+                       0.25840f, 0.28424f, 0.31008f, 0.17054f,
+                       0.58915f, 0.65633f, 0.72351f, 0.45995f,
+                       0.91990f, 1.02842f, 1.13695f, 0.74935f,
+                       0.70801f, 0.81912f, 0.93023f
+               );
+               if (N != A) {
+                       cerr << "Failed:" << "Projective matrix N1 * N2 test" << endl;  
+                       failed_count++;
+               }
+       }
+       
+       {
+               matrix3 M(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
+>>>>>>> 01b4978a6b6cd046ad399644ea70ddec977a688a
+               vector3 v(1, 2, 3);
+               vector3 w = M * v;
+               vector3 a(18, 46, 74);
+               if (a != w) {
+                       cerr << "Failed:" << "M * v test" << endl;      
+                       failed_count++;
+               }
+       }
+
+
+       {
+               matrix3 M(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12);
+               matrix3 N = 2 * M * 3;
+               matrix3 A(6, 12, 18, 24, 30, 36, 42, 48, 54, 60, 66, 72);
+               if (N != A) {
+                       cerr << "Failed:" << "s * M * s test" << endl;  
+                       failed_count++;
+               }
+       }
+       
+       {
+               matrix3 M(6, 12, 18, 24, 30, 36, 42, 48, 54, 60, 66, 72);
+               matrix3 N = M / 6;
+               matrix3 A(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12);
+               if (N != A) {
+                       cerr << "Failed:" << "M / s test" << endl;      
+                       failed_count++;
+               }
+       }
+
+       return failed_count;
+}
index b193979..40d6ca1 100755 (executable)
Binary files a/src/mof/math/test/testbin/make_matrix_test and b/src/mof/math/test/testbin/make_matrix_test differ
index 0de64cd..8605ded 100755 (executable)
Binary files a/src/mof/math/test/testbin/matrix2_test and b/src/mof/math/test/testbin/matrix2_test differ
index 6e36d71..c1b162a 100755 (executable)
Binary files a/src/mof/math/test/testbin/matrix3_test and b/src/mof/math/test/testbin/matrix3_test differ
index 9e9025b..28a6a75 100755 (executable)
Binary files a/src/mof/math/test/testbin/vector2_test and b/src/mof/math/test/testbin/vector2_test differ
index a440908..57045bc 100755 (executable)
Binary files a/src/mof/math/test/testbin/vector3_test and b/src/mof/math/test/testbin/vector3_test differ