Index: src/vectorunittest.cpp
===================================================================
--- src/vectorunittest.cpp	(revision d52e70c6c193b4da43bf1669f9b468e2b6092897)
+++ src/vectorunittest.cpp	(revision c26f44b5c51a3902dd55fb535bd81f36ffebe3d7)
@@ -55,41 +55,43 @@
 void VectorTest::SimpleAlgebraTest()
 {
-  Vector helper;
   double factor;
+  // copy vector
+  fixture.Init(2.,3.,4.);
+  CPPUNIT_ASSERT_EQUAL( Vector(2.,3.,4.), fixture );
   // summation and scaling
-  helper.CopyVector(&zero);
-  helper.AddVector(&unit);
-  CPPUNIT_ASSERT_EQUAL( true, helper.IsOne() );
-  helper.CopyVector(&zero);
-  helper.SubtractVector(&unit);
-  CPPUNIT_ASSERT_EQUAL( true, helper.IsOne() );
-  CPPUNIT_ASSERT_EQUAL( false, helper.IsZero() );
-  helper.CopyVector(&zero);
-  helper.AddVector(&zero);
-  CPPUNIT_ASSERT_EQUAL( true, helper.IsZero() );
-  helper.CopyVector(&notunit);
-  helper.SubtractVector(&otherunit);
-  CPPUNIT_ASSERT_EQUAL( true, helper.IsOne() );
-  helper.CopyVector(&unit);
-  helper.AddVector(&otherunit);
-  CPPUNIT_ASSERT_EQUAL( false, helper.IsOne() );
-  helper.CopyVector(&notunit);
-  helper.SubtractVector(&unit);
-  helper.SubtractVector(&otherunit);
-  CPPUNIT_ASSERT_EQUAL( false, helper.IsZero() );
-  helper.CopyVector(&unit);
-  helper.Scale(0.98);
-  CPPUNIT_ASSERT_EQUAL( false, helper.IsOne() );
-  helper.CopyVector(&unit);
-  helper.Scale(1.);
-  CPPUNIT_ASSERT_EQUAL( true, helper.IsOne() );
-  helper.CopyVector(&unit);
+  fixture.CopyVector(&zero);
+  fixture.AddVector(&unit);
+  CPPUNIT_ASSERT_EQUAL( true, fixture.IsOne() );
+  fixture.CopyVector(&zero);
+  fixture.SubtractVector(&unit);
+  CPPUNIT_ASSERT_EQUAL( true, fixture.IsOne() );
+  CPPUNIT_ASSERT_EQUAL( false, fixture.IsZero() );
+  fixture.CopyVector(&zero);
+  fixture.AddVector(&zero);
+  CPPUNIT_ASSERT_EQUAL( true, fixture.IsZero() );
+  fixture.CopyVector(&notunit);
+  fixture.SubtractVector(&otherunit);
+  CPPUNIT_ASSERT_EQUAL( true, fixture.IsOne() );
+  fixture.CopyVector(&unit);
+  fixture.AddVector(&otherunit);
+  CPPUNIT_ASSERT_EQUAL( false, fixture.IsOne() );
+  fixture.CopyVector(&notunit);
+  fixture.SubtractVector(&unit);
+  fixture.SubtractVector(&otherunit);
+  CPPUNIT_ASSERT_EQUAL( false, fixture.IsZero() );
+  fixture.CopyVector(&unit);
+  fixture.Scale(0.98);
+  CPPUNIT_ASSERT_EQUAL( false, fixture.IsOne() );
+  fixture.CopyVector(&unit);
+  fixture.Scale(1.);
+  CPPUNIT_ASSERT_EQUAL( true, fixture.IsOne() );
+  fixture.CopyVector(&unit);
   factor = 0.98;
-  helper.Scale(factor);
-  CPPUNIT_ASSERT_EQUAL( false, helper.IsOne() );
-  helper.CopyVector(&unit);
+  fixture.Scale(factor);
+  CPPUNIT_ASSERT_EQUAL( false, fixture.IsOne() );
+  fixture.CopyVector(&unit);
   factor = 1.;
-  helper.Scale(factor);
-  CPPUNIT_ASSERT_EQUAL( true, helper.IsOne() );
+  fixture.Scale(factor);
+  CPPUNIT_ASSERT_EQUAL( true, fixture.IsOne() );
 };
 
@@ -183,37 +185,109 @@
 void VectorTest::LineIntersectionTest()
 {
-  Vector helper;
   // plane at (0,0,0) normal to (1,0,0) cuts line from (0,0,0) to (2,1,0) at ???
-  CPPUNIT_ASSERT_EQUAL( true, helper.GetIntersectionWithPlane((ofstream *)&cout, &unit, &zero, &zero, &two) );
-  CPPUNIT_ASSERT_EQUAL( zero, helper );
+  CPPUNIT_ASSERT_EQUAL( true, fixture.GetIntersectionWithPlane((ofstream *)&cout, &unit, &zero, &zero, &two) );
+  CPPUNIT_ASSERT_EQUAL( zero, fixture );
 
   // plane at (2,1,0) normal to (0,1,0) cuts line from (1,0,0) to (0,1,1) at ???
-  CPPUNIT_ASSERT_EQUAL( true, helper.GetIntersectionWithPlane((ofstream *)&cout, &otherunit, &two, &unit, &notunit) );
-  CPPUNIT_ASSERT_EQUAL( Vector(0., 1., 1.), helper );
+  CPPUNIT_ASSERT_EQUAL( true, fixture.GetIntersectionWithPlane((ofstream *)&cout, &otherunit, &two, &unit, &notunit) );
+  CPPUNIT_ASSERT_EQUAL( Vector(0., 1., 1.), fixture );
 
   // four vectors equal to zero
-  CPPUNIT_ASSERT_EQUAL( false, helper.GetIntersectionOfTwoLinesOnPlane((ofstream *)&cout, &zero, &zero, &zero, &zero, NULL) );
-  CPPUNIT_ASSERT_EQUAL( zero, helper );
+  CPPUNIT_ASSERT_EQUAL( false, fixture.GetIntersectionOfTwoLinesOnPlane((ofstream *)&cout, &zero, &zero, &zero, &zero, NULL) );
+  CPPUNIT_ASSERT_EQUAL( zero, fixture );
 
   // four vectors equal to unit
-  CPPUNIT_ASSERT_EQUAL( false, helper.GetIntersectionOfTwoLinesOnPlane((ofstream *)&cout, &unit, &unit, &unit, &unit, NULL) );
-  CPPUNIT_ASSERT_EQUAL( zero, helper );
+  CPPUNIT_ASSERT_EQUAL( false, fixture.GetIntersectionOfTwoLinesOnPlane((ofstream *)&cout, &unit, &unit, &unit, &unit, NULL) );
+  CPPUNIT_ASSERT_EQUAL( zero, fixture );
 
   // two equal lines
-  CPPUNIT_ASSERT_EQUAL( true, helper.GetIntersectionOfTwoLinesOnPlane((ofstream *)&cout, &unit, &two, &unit, &two, NULL) );
-  CPPUNIT_ASSERT_EQUAL( unit, helper );
+  CPPUNIT_ASSERT_EQUAL( true, fixture.GetIntersectionOfTwoLinesOnPlane((ofstream *)&cout, &unit, &two, &unit, &two, NULL) );
+  CPPUNIT_ASSERT_EQUAL( unit, fixture );
 
   // line from (1,0,0) to (2,1,0) cuts line from (1,0,0) to (0,1,0) at ???
-  CPPUNIT_ASSERT_EQUAL( true, helper.GetIntersectionOfTwoLinesOnPlane((ofstream *)&cout, &unit, &two, &unit, &otherunit, NULL) );
-  CPPUNIT_ASSERT_EQUAL( unit, helper );
+  CPPUNIT_ASSERT_EQUAL( true, fixture.GetIntersectionOfTwoLinesOnPlane((ofstream *)&cout, &unit, &two, &unit, &otherunit, NULL) );
+  CPPUNIT_ASSERT_EQUAL( unit, fixture );
 
   // line from (1,0,0) to (0,0,0) cuts line from (0,0,0) to (2,1,0) at ???
-  CPPUNIT_ASSERT_EQUAL( true, helper.GetIntersectionOfTwoLinesOnPlane((ofstream *)&cout, &unit, &zero, &zero, &two, NULL) );
-  CPPUNIT_ASSERT_EQUAL( zero, helper );
+  CPPUNIT_ASSERT_EQUAL( true, fixture.GetIntersectionOfTwoLinesOnPlane((ofstream *)&cout, &unit, &zero, &zero, &two, NULL) );
+  CPPUNIT_ASSERT_EQUAL( zero, fixture );
 
   // line from (1,0,0) to (2,1,0) cuts line from (0,0,0) to (0,1,0) at ???
-  CPPUNIT_ASSERT_EQUAL( true, helper.GetIntersectionOfTwoLinesOnPlane((ofstream *)&cout, &unit, &two, &zero, &otherunit, NULL) );
-  CPPUNIT_ASSERT_EQUAL( Vector(0., -1., 0.), helper );
-};
+  CPPUNIT_ASSERT_EQUAL( true, fixture.GetIntersectionOfTwoLinesOnPlane((ofstream *)&cout, &unit, &two, &zero, &otherunit, NULL) );
+  CPPUNIT_ASSERT_EQUAL( Vector(0., -1., 0.), fixture );
+};
+
+/** UnitTest for vector rotations.
+ */
+void VectorTest::VectorRotationTest()
+{
+  fixture.Init(-1.,0.,0.);
+
+  // zero vector does not change
+  fixture.CopyVector(&zero);
+  fixture.RotateVector(&unit, 1.);
+  CPPUNIT_ASSERT_EQUAL( zero, fixture );
+
+  fixture.RotateVector(&two, 1.);
+  CPPUNIT_ASSERT_EQUAL( zero,  fixture);
+
+  // vector on axis does not change
+  fixture.CopyVector(&unit);
+  fixture.RotateVector(&unit, 1.);
+  CPPUNIT_ASSERT_EQUAL( unit, fixture );
+
+  fixture.RotateVector(&unit, 1.);
+  CPPUNIT_ASSERT_EQUAL( unit, fixture );
+
+  // rotations
+  fixture.CopyVector(&otherunit);
+  fixture.RotateVector(&unit, M_PI);
+  CPPUNIT_ASSERT_EQUAL( Vector(0.,-1.,0.), fixture );
+
+  fixture.CopyVector(&otherunit);
+  fixture.RotateVector(&unit, 2. * M_PI);
+  CPPUNIT_ASSERT_EQUAL( otherunit, fixture );
+
+  fixture.CopyVector(&otherunit);
+  fixture.RotateVector(&unit, 0);
+  CPPUNIT_ASSERT_EQUAL( otherunit, fixture );
+
+  fixture.Init(0.,0.,1.);
+  fixture.RotateVector(&notunit, M_PI);
+  CPPUNIT_ASSERT_EQUAL( otherunit, fixture );
+}
+
+/**
+ * UnitTest for Vector::IsInParallelepiped().
+ */
+void VectorTest::IsInParallelepipedTest()
+{
+  double parallelepiped[NDIM*NDIM];
+  parallelepiped[0] = 1;
+  parallelepiped[1] = 0;
+  parallelepiped[2] = 0;
+  parallelepiped[3] = 0;
+  parallelepiped[4] = 1;
+  parallelepiped[5] = 0;
+  parallelepiped[6] = 0;
+  parallelepiped[7] = 0;
+  parallelepiped[8] = 1;
+
+  fixture.CopyVector(zero);
+  CPPUNIT_ASSERT_EQUAL( false, fixture.IsInParallelepiped(Vector(2.,2.,2.), parallelepiped) );
+  fixture.Init(2.5,2.5,2.5);
+  CPPUNIT_ASSERT_EQUAL( true, fixture.IsInParallelepiped(Vector(2.,2.,2.), parallelepiped) );
+  fixture.Init(1.,1.,1.);
+  CPPUNIT_ASSERT_EQUAL( false, fixture.IsInParallelepiped(Vector(2.,2.,2.), parallelepiped) );
+  fixture.Init(3.5,3.5,3.5);
+  CPPUNIT_ASSERT_EQUAL( false, fixture.IsInParallelepiped(Vector(2.,2.,2.), parallelepiped) );
+  fixture.Init(2.,2.,2.);
+  CPPUNIT_ASSERT_EQUAL( true, fixture.IsInParallelepiped(Vector(2.,2.,2.), parallelepiped) );
+  fixture.Init(2.,3.,2.);
+  CPPUNIT_ASSERT_EQUAL( true, fixture.IsInParallelepiped(Vector(2.,2.,2.), parallelepiped) );
+  fixture.Init(-2.,2.,-1.);
+  CPPUNIT_ASSERT_EQUAL( false, fixture.IsInParallelepiped(Vector(2.,2.,2.), parallelepiped) );
+}
+
 
 /********************************************** Main routine **************************************/
