[med-svn] [mia] 04/07: Add some patches to correct build failures

Gert Wollny gert-guest at moszumanska.debian.org
Mon Oct 26 13:27:51 UTC 2015


This is an automated email from the git hooks/post-receive script.

gert-guest pushed a commit to branch master
in repository mia.

commit 41e89c12c57269dc14f6c4f8bc5134c733bd33c6
Author: Gert Wollny <gw.fossdev at gmail.com>
Date:   Mon Oct 26 12:20:20 2015 +0100

    Add some patches to correct build failures
---
 debian/changelog                                   |   2 +
 debian/patches/02_remove_double_instaciation.patch |  42 +++++
 debian/patches/03_correct_imagedraw_tests.patch    | 199 +++++++++++++++++++++
 debian/patches/series                              |   2 +
 mia/3d/datafield.cc                                |   4 -
 mia/3d/imagedraw.cc                                |   8 +-
 mia/3d/test_imagedraw.cc                           |  72 ++++----
 mia/3d/vectorfield.cc                              |   5 +-
 8 files changed, 288 insertions(+), 46 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index b6d2c12..88354b3 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,8 @@ mia (2.2.6-1) unstable; urgency=medium
 
   * New upstream version
   * Remove patch 02_doxygen_use_svg.. because it was applied upstream
+  * Add patch 02 to correct build on armhf 
+  * Add patch 03 to correct tests that fail on arm64 and ppc64el  
 
  -- Gert Wollny <gw.fossdev at gmail.com>  Sun, 25 Oct 2015 17:36:59 +0100
 
diff --git a/debian/patches/02_remove_double_instaciation.patch b/debian/patches/02_remove_double_instaciation.patch
new file mode 100644
index 0000000..2013e3c
--- /dev/null
+++ b/debian/patches/02_remove_double_instaciation.patch
@@ -0,0 +1,42 @@
+commit d6b79233c2a921d6dc796fe876fd9a2c8f986977
+Author: Gert Wollny <gw.fossdev at gmail.com>
+Date:   Mon Oct 26 11:25:26 2015 +0100
+
+    remove duplicate instanciation of 3DVector field templates
+
+diff --git a/mia/3d/datafield.cc b/mia/3d/datafield.cc
+index e92d95d..beef397 100644
+--- a/mia/3d/datafield.cc
++++ b/mia/3d/datafield.cc
+@@ -97,10 +97,6 @@ INSTANCIATE(unsigned char );
+ INSTANCIATE(signed char);
+ INSTANCIATE(bool);
+ 
+-INSTANCIATE(C3DFVector)
+-INSTANCIATE(C3DDVector)
+-
+-
+ DEFINE_TYPE_DESCR2(C3DBounds, "3dbounds"); 
+ DEFINE_TYPE_DESCR2(C3DFVector, "3dfvector"); 
+ 
+diff --git a/mia/3d/vectorfield.cc b/mia/3d/vectorfield.cc
+index f082531..269d3e0 100644
+--- a/mia/3d/vectorfield.cc
++++ b/mia/3d/vectorfield.cc
+@@ -56,13 +56,14 @@ EXPORT_3D C3DFVectorfield& operator += (C3DFVectorfield& a, const C3DFVectorfiel
+ 	return a;
+ }
+ 
+-#define INSTANCIATE(TYPE) \
+-	template class  T3DDatafield<TYPE>;			\
++#define INSTANCIATE(TYPE)						\
++	template class  T3DDatafield<TYPE>;				\
+ 	template class  range3d_iterator<T3DDatafield<TYPE>::iterator>; \
+ 	template class  range3d_iterator<T3DDatafield<TYPE>::const_iterator>; \
+ 	template class  range3d_iterator_with_boundary_flag<T3DDatafield<TYPE>::iterator>; \
+ 	template class  range3d_iterator_with_boundary_flag<T3DDatafield<TYPE>::const_iterator>; 
+ 
++
+ #define INSTANCIATE2D(TYPE)						\
+ 	template class  EXPORT_3D T2DDatafield<TYPE>;			\
+ 	template class  range2d_iterator<T2DDatafield<TYPE>::iterator>; \
diff --git a/debian/patches/03_correct_imagedraw_tests.patch b/debian/patches/03_correct_imagedraw_tests.patch
new file mode 100644
index 0000000..9e77909
--- /dev/null
+++ b/debian/patches/03_correct_imagedraw_tests.patch
@@ -0,0 +1,199 @@
+
+Author: Gert Wollny <gw.fossdev at gmail.com>
+Date:   Mon Oct 26 11:48:29 2015 +0100
+
+    correct test to really draw lines
+
+diff --git a/mia/3d/test_imagedraw.cc b/mia/3d/test_imagedraw.cc
+index 982da53..253189f 100644
+--- a/mia/3d/test_imagedraw.cc
++++ b/mia/3d/test_imagedraw.cc
+@@ -317,18 +317,18 @@ BOOST_FIXTURE_TEST_CASE( test_draw_line_pivot_y_outside_ends_dx_is_zero, SimpleB
+ }
+ 
+ 
+-BOOST_FIXTURE_TEST_CASE( test_draw_line_pivot_y_outside_ends_dN_is_zero_and_N_outside, SimpleBitImageDrawFixture ) 
++BOOST_FIXTURE_TEST_CASE( test_draw_line_dN_is_zero_and_N_outside, SimpleBitImageDrawFixture ) 
+ {
+ 	// x outside and parallel 
+         output.draw_line(C3DFVector(-1,-6, 5), C3DFVector(-1,14,9)); 
+-        output.draw_line(C3DFVector(30,6, 5), C3DFVector(30,6,5)); 
++        output.draw_line(C3DFVector(30,-3, 2), C3DFVector(30,6,5)); 
+ 
+ 	// y outside and parallel 
+         output.draw_line(C3DFVector(1,-6, 5), C3DFVector(1,-6,9)); 
+         output.draw_line(C3DFVector(1, 40, 5), C3DFVector(1,40,9)); 
+ 
+ 	// z outside and parallel 
+-        output.draw_line(C3DFVector(1,6, -5), C3DFVector(1,6,-5)); 
++        output.draw_line(C3DFVector(1,6, -5), C3DFVector(8,7,-5)); 
+         output.draw_line(C3DFVector(1,6, 22), C3DFVector(1,14,22)); 
+ 
+         auto& img = output.get_image(); 
+
+diff --git a/mia/3d/imagedraw.cc b/mia/3d/imagedraw.cc
+index de1e578..d662bc0 100644
+--- a/mia/3d/imagedraw.cc
++++ b/mia/3d/imagedraw.cc
+@@ -29,7 +29,7 @@ NS_MIA_BEGIN
+ using std::max; 
+ using std::min; 
+ using std::swap; 
+-using std::fabs; 
++using std::fabs;
+ 
+ C3DDrawBox::C3DDrawBox(const C3DBounds& size, const C3DFVector& origin, const C3DFVector& spacing):
+         m_size(size), 
+@@ -43,9 +43,9 @@ C3DDrawBox::C3DDrawBox(const C3DBounds& size, const C3DFVector& origin, const C3
+ void C3DDrawBox::draw_point(const C3DFVector& p)
+ {
+        
+-        C3DBounds ip(static_cast<unsigned>(floor(p.x + 0.5)), 
+-                     static_cast<unsigned>(floor(p.y + 0.5)), 
+-                     static_cast<unsigned>(floor(p.z + 0.5)));
++        C3DBounds ip(static_cast<unsigned>(roundf(p.x)), 
++                     static_cast<unsigned>(roundf(p.y)), 
++                     static_cast<unsigned>(roundf(p.z)));
+        
+ 	cvdebug() << "about to draw " << ip << " from " << p << "\n"; 
+         if (ip < m_size) 
+diff --git a/mia/3d/test_imagedraw.cc b/mia/3d/test_imagedraw.cc
+index e5d963a..982da53 100644
+--- a/mia/3d/test_imagedraw.cc
++++ b/mia/3d/test_imagedraw.cc
+@@ -59,8 +59,6 @@ BOOST_FIXTURE_TEST_CASE( test_simple_draw_point_outside, SimpleBitImageDrawFixtu
+         output.draw_point(C3DFVector(1,11,6)); 
+         output.draw_point(C3DFVector(1,5,12)); 
+ 
+-
+-
+         auto& img = output.get_image(); 
+         
+         
+@@ -128,9 +126,9 @@ BOOST_FIXTURE_TEST_CASE( test_simple_draw_line_z_pivot, SimpleBitImageDrawFixtur
+ 	
+ 	C3DFVector p(0,0,0);
+ 	for (int k = 0; k < 24; ++k, p += dir) {
+-		C3DBounds ip(static_cast<unsigned>(floor(p.x + 0.5)), 
+-			     static_cast<unsigned>(floor(p.y + 0.5)), 
+-			     static_cast<unsigned>(floor(p.z + 0.5))); 
++		C3DBounds ip(static_cast<unsigned>(roundf(p.x)), 
++			     static_cast<unsigned>(roundf(p.y)), 
++			     static_cast<unsigned>(roundf(p.z))); 
+ 		cvdebug() << "test about to draw " << ip << " from " << p << "\n"; 
+ 		pixels.insert(ip); 
+ 	}
+@@ -161,9 +159,9 @@ BOOST_FIXTURE_TEST_CASE( test_simple_draw_line_pivot_x, SimpleBitImageDrawFixtur
+ 	
+ 	C3DFVector p(0.1,4.2,5.3);
+ 	for (int k = 0; k < 22; ++k, p += dir) {
+-		C3DBounds ip(static_cast<unsigned>(floor(p.x + 0.5)), 
+-			     static_cast<unsigned>(floor(p.y + 0.5)), 
+-			     static_cast<unsigned>(floor(p.z + 0.5))); 
++		C3DBounds ip(static_cast<unsigned>(roundf(p.x)), 
++			     static_cast<unsigned>(roundf(p.y)), 
++			     static_cast<unsigned>(roundf(p.z))); 
+ 		cvdebug() << "test about to draw " << ip << " from " << p << "\n"; 
+ 		pixels.insert(ip); 
+ 	}
+@@ -194,9 +192,9 @@ BOOST_FIXTURE_TEST_CASE( test_simple_draw_line_pivot_y, SimpleBitImageDrawFixtur
+ 	
+ 	C3DFVector p(4,0.1,5.2);
+ 	for (int k = 0; k < 22; ++k, p += dir) {
+-		C3DBounds ip(static_cast<unsigned>(floor(p.x + 0.5)), 
+-			     static_cast<unsigned>(floor(p.y + 0.5)), 
+-			     static_cast<unsigned>(floor(p.z + 0.5))); 
++		C3DBounds ip(static_cast<unsigned>(roundf(p.x)), 
++			     static_cast<unsigned>(roundf(p.y)), 
++			     static_cast<unsigned>(roundf(p.z))); 
+ 		cvdebug() << "test about to draw " << ip << " from " << p << "\n"; 
+ 		pixels.insert(ip); 
+ 	}
+@@ -226,13 +224,15 @@ BOOST_FIXTURE_TEST_CASE( test_draw_line_pivot_x_outside_ends, SimpleBitImageDraw
+ 	C3DFVector dir(0.5, 0.3, 0.1f);
+ 	
+ 	C3DFVector p(-4,2,5);
+-	for (int k = 0; k < 42; ++k, p += dir) {
+-		C3DBounds ip(static_cast<unsigned>(floor(p.x + 0.5)), 
+-			     static_cast<unsigned>(floor(p.y + 0.5)), 
+-			     static_cast<unsigned>(floor(p.z + 0.5))); 
+-		cvdebug() << "test about to draw " << ip << " from " << p << "\n"; 
+-		if (ip.x < img.get_size().x) 
+-			pixels.insert(ip); 
++	for (int k = 0; k < 40; ++k, p += dir) {
++		if (p.x >= 0 || p.x < img.get_size().x) {
++			C3DBounds ip(static_cast<unsigned>(roundf(p.x)), 
++				     static_cast<unsigned>(roundf(p.y)), 
++				     static_cast<unsigned>(roundf(p.z))); 
++			cvdebug() << "test about to draw " << ip << " from " << p << "\n"; 
++			if (ip.x < img.get_size().x) 
++				pixels.insert(ip); 
++		}
+ 	}
+         
+ 	cvdebug() << "Expect " << pixels.size() << " pixels to be set\n"; 
+@@ -263,9 +263,9 @@ BOOST_FIXTURE_TEST_CASE( test_draw_line_pivot_y_outside_ends, SimpleBitImageDraw
+ 	
+ 	C3DFVector p(4,-6,5);
+ 	for (int k = 0; k < 42; ++k, p += dir) {
+-		C3DBounds ip(static_cast<unsigned>(floor(p.x + 0.5)), 
+-			     static_cast<unsigned>(floor(p.y + 0.5)), 
+-			     static_cast<unsigned>(floor(p.z + 0.5))); 
++		C3DBounds ip(static_cast<unsigned>(roundf(p.x)), 
++			     static_cast<unsigned>(roundf(p.y)), 
++			     static_cast<unsigned>(roundf(p.z))); 
+ 		cvdebug() << "test about to draw " << ip << " from " << p << "\n"; 
+ 		if (ip.y < img.get_size().y) 
+ 			pixels.insert(ip); 
+@@ -298,9 +298,9 @@ BOOST_FIXTURE_TEST_CASE( test_draw_line_pivot_y_outside_ends_dx_is_zero, SimpleB
+ 	
+ 	C3DFVector p(4,-6,5);
+ 	for (int k = 0; k < 42; ++k, p += dir) {
+-		C3DBounds ip(static_cast<unsigned>(floor(p.x + 0.5)), 
+-			     static_cast<unsigned>(floor(p.y + 0.5)), 
+-			     static_cast<unsigned>(floor(p.z + 0.5))); 
++		C3DBounds ip(static_cast<unsigned>(roundf(p.x)), 
++			     static_cast<unsigned>(roundf(p.y)), 
++			     static_cast<unsigned>(roundf(p.z))); 
+ 		cvdebug() << "test about to draw " << ip << " from " << p << "\n"; 
+ 		if (ip.y < img.get_size().y) 
+ 			pixels.insert(ip); 
+@@ -360,9 +360,9 @@ BOOST_FIXTURE_TEST_CASE( test_draw_line_pivot_z_outside_ends, SimpleBitImageDraw
+ 	
+ 	C3DFVector p(5.5, 6.5, 0);
+ 	for (int k = 0; k < 41 && p.z < 12; ++k, p += dir) {
+-		C3DBounds ip(static_cast<unsigned>(floor(p.x + 0.5)), 
+-			     static_cast<unsigned>(floor(p.y + 0.5)), 
+-			     static_cast<unsigned>(floor(p.z + 0.5))); 
++		C3DBounds ip(static_cast<unsigned>(roundf(p.x)), 
++			     static_cast<unsigned>(roundf(p.y)), 
++			     static_cast<unsigned>(roundf(p.z))); 
+ 		cvdebug() << "test about to draw " << ip << " from " << p << "\n"; 
+ 		if (ip.z < img.get_size().z) 
+ 			pixels.insert(ip); 
+@@ -395,9 +395,9 @@ BOOST_FIXTURE_TEST_CASE( test_draw_line_pivot_x_outside_ends_dz_is_zero, SimpleB
+ 	
+ 	C3DFVector p(-4,2,5);
+ 	for (int k = 0; k < 42; ++k, p += dir) {
+-		C3DBounds ip(static_cast<unsigned>(floor(p.x + 0.5)), 
+-			     static_cast<unsigned>(floor(p.y + 0.5)), 
+-			     static_cast<unsigned>(floor(p.z + 0.5))); 
++		C3DBounds ip(static_cast<unsigned>(roundf(p.x)), 
++			     static_cast<unsigned>(roundf(p.y)), 
++			     static_cast<unsigned>(roundf(p.z))); 
+ 		cvdebug() << "test about to draw " << ip << " from " << p << "\n"; 
+ 		if (ip.x < img.get_size().x) 
+ 			pixels.insert(ip); 
+@@ -430,9 +430,9 @@ BOOST_FIXTURE_TEST_CASE( test_draw_line_pivot_z_outside_ends_dy_is_zero, SimpleB
+ 	
+ 	C3DFVector p(5.5, 4, 0);
+ 	for (int k = 0; k < 41 && p.z < 12; ++k, p += dir) {
+-		C3DBounds ip(static_cast<unsigned>(floor(p.x + 0.5)), 
+-			     static_cast<unsigned>(floor(p.y + 0.5)), 
+-			     static_cast<unsigned>(floor(p.z + 0.5))); 
++		C3DBounds ip(static_cast<unsigned>(roundf(p.x)), 
++			     static_cast<unsigned>(roundf(p.y)), 
++			     static_cast<unsigned>(roundf(p.z))); 
+ 		cvdebug() << "test about to draw " << ip << " from " << p << "\n"; 
+ 		if (ip.z < img.get_size().z) 
+ 			pixels.insert(ip); 
diff --git a/debian/patches/series b/debian/patches/series
index 8526e67..7d28881 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,3 @@
 01_disable-treeview-for-jquery-compatibility.patch
+02_remove_double_instaciation.patch
+03_correct_imagedraw_tests.patch
diff --git a/mia/3d/datafield.cc b/mia/3d/datafield.cc
index e92d95d..beef397 100644
--- a/mia/3d/datafield.cc
+++ b/mia/3d/datafield.cc
@@ -97,10 +97,6 @@ INSTANCIATE(unsigned char );
 INSTANCIATE(signed char);
 INSTANCIATE(bool);
 
-INSTANCIATE(C3DFVector)
-INSTANCIATE(C3DDVector)
-
-
 DEFINE_TYPE_DESCR2(C3DBounds, "3dbounds"); 
 DEFINE_TYPE_DESCR2(C3DFVector, "3dfvector"); 
 
diff --git a/mia/3d/imagedraw.cc b/mia/3d/imagedraw.cc
index de1e578..d662bc0 100644
--- a/mia/3d/imagedraw.cc
+++ b/mia/3d/imagedraw.cc
@@ -29,7 +29,7 @@ NS_MIA_BEGIN
 using std::max; 
 using std::min; 
 using std::swap; 
-using std::fabs; 
+using std::fabs;
 
 C3DDrawBox::C3DDrawBox(const C3DBounds& size, const C3DFVector& origin, const C3DFVector& spacing):
         m_size(size), 
@@ -43,9 +43,9 @@ C3DDrawBox::C3DDrawBox(const C3DBounds& size, const C3DFVector& origin, const C3
 void C3DDrawBox::draw_point(const C3DFVector& p)
 {
        
-        C3DBounds ip(static_cast<unsigned>(floor(p.x + 0.5)), 
-                     static_cast<unsigned>(floor(p.y + 0.5)), 
-                     static_cast<unsigned>(floor(p.z + 0.5)));
+        C3DBounds ip(static_cast<unsigned>(roundf(p.x)), 
+                     static_cast<unsigned>(roundf(p.y)), 
+                     static_cast<unsigned>(roundf(p.z)));
        
 	cvdebug() << "about to draw " << ip << " from " << p << "\n"; 
         if (ip < m_size) 
diff --git a/mia/3d/test_imagedraw.cc b/mia/3d/test_imagedraw.cc
index e5d963a..253189f 100644
--- a/mia/3d/test_imagedraw.cc
+++ b/mia/3d/test_imagedraw.cc
@@ -59,8 +59,6 @@ BOOST_FIXTURE_TEST_CASE( test_simple_draw_point_outside, SimpleBitImageDrawFixtu
         output.draw_point(C3DFVector(1,11,6)); 
         output.draw_point(C3DFVector(1,5,12)); 
 
-
-
         auto& img = output.get_image(); 
         
         
@@ -128,9 +126,9 @@ BOOST_FIXTURE_TEST_CASE( test_simple_draw_line_z_pivot, SimpleBitImageDrawFixtur
 	
 	C3DFVector p(0,0,0);
 	for (int k = 0; k < 24; ++k, p += dir) {
-		C3DBounds ip(static_cast<unsigned>(floor(p.x + 0.5)), 
-			     static_cast<unsigned>(floor(p.y + 0.5)), 
-			     static_cast<unsigned>(floor(p.z + 0.5))); 
+		C3DBounds ip(static_cast<unsigned>(roundf(p.x)), 
+			     static_cast<unsigned>(roundf(p.y)), 
+			     static_cast<unsigned>(roundf(p.z))); 
 		cvdebug() << "test about to draw " << ip << " from " << p << "\n"; 
 		pixels.insert(ip); 
 	}
@@ -161,9 +159,9 @@ BOOST_FIXTURE_TEST_CASE( test_simple_draw_line_pivot_x, SimpleBitImageDrawFixtur
 	
 	C3DFVector p(0.1,4.2,5.3);
 	for (int k = 0; k < 22; ++k, p += dir) {
-		C3DBounds ip(static_cast<unsigned>(floor(p.x + 0.5)), 
-			     static_cast<unsigned>(floor(p.y + 0.5)), 
-			     static_cast<unsigned>(floor(p.z + 0.5))); 
+		C3DBounds ip(static_cast<unsigned>(roundf(p.x)), 
+			     static_cast<unsigned>(roundf(p.y)), 
+			     static_cast<unsigned>(roundf(p.z))); 
 		cvdebug() << "test about to draw " << ip << " from " << p << "\n"; 
 		pixels.insert(ip); 
 	}
@@ -194,9 +192,9 @@ BOOST_FIXTURE_TEST_CASE( test_simple_draw_line_pivot_y, SimpleBitImageDrawFixtur
 	
 	C3DFVector p(4,0.1,5.2);
 	for (int k = 0; k < 22; ++k, p += dir) {
-		C3DBounds ip(static_cast<unsigned>(floor(p.x + 0.5)), 
-			     static_cast<unsigned>(floor(p.y + 0.5)), 
-			     static_cast<unsigned>(floor(p.z + 0.5))); 
+		C3DBounds ip(static_cast<unsigned>(roundf(p.x)), 
+			     static_cast<unsigned>(roundf(p.y)), 
+			     static_cast<unsigned>(roundf(p.z))); 
 		cvdebug() << "test about to draw " << ip << " from " << p << "\n"; 
 		pixels.insert(ip); 
 	}
@@ -226,13 +224,15 @@ BOOST_FIXTURE_TEST_CASE( test_draw_line_pivot_x_outside_ends, SimpleBitImageDraw
 	C3DFVector dir(0.5, 0.3, 0.1f);
 	
 	C3DFVector p(-4,2,5);
-	for (int k = 0; k < 42; ++k, p += dir) {
-		C3DBounds ip(static_cast<unsigned>(floor(p.x + 0.5)), 
-			     static_cast<unsigned>(floor(p.y + 0.5)), 
-			     static_cast<unsigned>(floor(p.z + 0.5))); 
-		cvdebug() << "test about to draw " << ip << " from " << p << "\n"; 
-		if (ip.x < img.get_size().x) 
-			pixels.insert(ip); 
+	for (int k = 0; k < 40; ++k, p += dir) {
+		if (p.x >= 0 || p.x < img.get_size().x) {
+			C3DBounds ip(static_cast<unsigned>(roundf(p.x)), 
+				     static_cast<unsigned>(roundf(p.y)), 
+				     static_cast<unsigned>(roundf(p.z))); 
+			cvdebug() << "test about to draw " << ip << " from " << p << "\n"; 
+			if (ip.x < img.get_size().x) 
+				pixels.insert(ip); 
+		}
 	}
         
 	cvdebug() << "Expect " << pixels.size() << " pixels to be set\n"; 
@@ -263,9 +263,9 @@ BOOST_FIXTURE_TEST_CASE( test_draw_line_pivot_y_outside_ends, SimpleBitImageDraw
 	
 	C3DFVector p(4,-6,5);
 	for (int k = 0; k < 42; ++k, p += dir) {
-		C3DBounds ip(static_cast<unsigned>(floor(p.x + 0.5)), 
-			     static_cast<unsigned>(floor(p.y + 0.5)), 
-			     static_cast<unsigned>(floor(p.z + 0.5))); 
+		C3DBounds ip(static_cast<unsigned>(roundf(p.x)), 
+			     static_cast<unsigned>(roundf(p.y)), 
+			     static_cast<unsigned>(roundf(p.z))); 
 		cvdebug() << "test about to draw " << ip << " from " << p << "\n"; 
 		if (ip.y < img.get_size().y) 
 			pixels.insert(ip); 
@@ -298,9 +298,9 @@ BOOST_FIXTURE_TEST_CASE( test_draw_line_pivot_y_outside_ends_dx_is_zero, SimpleB
 	
 	C3DFVector p(4,-6,5);
 	for (int k = 0; k < 42; ++k, p += dir) {
-		C3DBounds ip(static_cast<unsigned>(floor(p.x + 0.5)), 
-			     static_cast<unsigned>(floor(p.y + 0.5)), 
-			     static_cast<unsigned>(floor(p.z + 0.5))); 
+		C3DBounds ip(static_cast<unsigned>(roundf(p.x)), 
+			     static_cast<unsigned>(roundf(p.y)), 
+			     static_cast<unsigned>(roundf(p.z))); 
 		cvdebug() << "test about to draw " << ip << " from " << p << "\n"; 
 		if (ip.y < img.get_size().y) 
 			pixels.insert(ip); 
@@ -317,18 +317,18 @@ BOOST_FIXTURE_TEST_CASE( test_draw_line_pivot_y_outside_ends_dx_is_zero, SimpleB
 }
 
 
-BOOST_FIXTURE_TEST_CASE( test_draw_line_pivot_y_outside_ends_dN_is_zero_and_N_outside, SimpleBitImageDrawFixture ) 
+BOOST_FIXTURE_TEST_CASE( test_draw_line_dN_is_zero_and_N_outside, SimpleBitImageDrawFixture ) 
 {
 	// x outside and parallel 
         output.draw_line(C3DFVector(-1,-6, 5), C3DFVector(-1,14,9)); 
-        output.draw_line(C3DFVector(30,6, 5), C3DFVector(30,6,5)); 
+        output.draw_line(C3DFVector(30,-3, 2), C3DFVector(30,6,5)); 
 
 	// y outside and parallel 
         output.draw_line(C3DFVector(1,-6, 5), C3DFVector(1,-6,9)); 
         output.draw_line(C3DFVector(1, 40, 5), C3DFVector(1,40,9)); 
 
 	// z outside and parallel 
-        output.draw_line(C3DFVector(1,6, -5), C3DFVector(1,6,-5)); 
+        output.draw_line(C3DFVector(1,6, -5), C3DFVector(8,7,-5)); 
         output.draw_line(C3DFVector(1,6, 22), C3DFVector(1,14,22)); 
 
         auto& img = output.get_image(); 
@@ -360,9 +360,9 @@ BOOST_FIXTURE_TEST_CASE( test_draw_line_pivot_z_outside_ends, SimpleBitImageDraw
 	
 	C3DFVector p(5.5, 6.5, 0);
 	for (int k = 0; k < 41 && p.z < 12; ++k, p += dir) {
-		C3DBounds ip(static_cast<unsigned>(floor(p.x + 0.5)), 
-			     static_cast<unsigned>(floor(p.y + 0.5)), 
-			     static_cast<unsigned>(floor(p.z + 0.5))); 
+		C3DBounds ip(static_cast<unsigned>(roundf(p.x)), 
+			     static_cast<unsigned>(roundf(p.y)), 
+			     static_cast<unsigned>(roundf(p.z))); 
 		cvdebug() << "test about to draw " << ip << " from " << p << "\n"; 
 		if (ip.z < img.get_size().z) 
 			pixels.insert(ip); 
@@ -395,9 +395,9 @@ BOOST_FIXTURE_TEST_CASE( test_draw_line_pivot_x_outside_ends_dz_is_zero, SimpleB
 	
 	C3DFVector p(-4,2,5);
 	for (int k = 0; k < 42; ++k, p += dir) {
-		C3DBounds ip(static_cast<unsigned>(floor(p.x + 0.5)), 
-			     static_cast<unsigned>(floor(p.y + 0.5)), 
-			     static_cast<unsigned>(floor(p.z + 0.5))); 
+		C3DBounds ip(static_cast<unsigned>(roundf(p.x)), 
+			     static_cast<unsigned>(roundf(p.y)), 
+			     static_cast<unsigned>(roundf(p.z))); 
 		cvdebug() << "test about to draw " << ip << " from " << p << "\n"; 
 		if (ip.x < img.get_size().x) 
 			pixels.insert(ip); 
@@ -430,9 +430,9 @@ BOOST_FIXTURE_TEST_CASE( test_draw_line_pivot_z_outside_ends_dy_is_zero, SimpleB
 	
 	C3DFVector p(5.5, 4, 0);
 	for (int k = 0; k < 41 && p.z < 12; ++k, p += dir) {
-		C3DBounds ip(static_cast<unsigned>(floor(p.x + 0.5)), 
-			     static_cast<unsigned>(floor(p.y + 0.5)), 
-			     static_cast<unsigned>(floor(p.z + 0.5))); 
+		C3DBounds ip(static_cast<unsigned>(roundf(p.x)), 
+			     static_cast<unsigned>(roundf(p.y)), 
+			     static_cast<unsigned>(roundf(p.z))); 
 		cvdebug() << "test about to draw " << ip << " from " << p << "\n"; 
 		if (ip.z < img.get_size().z) 
 			pixels.insert(ip); 
diff --git a/mia/3d/vectorfield.cc b/mia/3d/vectorfield.cc
index f082531..269d3e0 100644
--- a/mia/3d/vectorfield.cc
+++ b/mia/3d/vectorfield.cc
@@ -56,13 +56,14 @@ EXPORT_3D C3DFVectorfield& operator += (C3DFVectorfield& a, const C3DFVectorfiel
 	return a;
 }
 
-#define INSTANCIATE(TYPE) \
-	template class  T3DDatafield<TYPE>;			\
+#define INSTANCIATE(TYPE)						\
+	template class  T3DDatafield<TYPE>;				\
 	template class  range3d_iterator<T3DDatafield<TYPE>::iterator>; \
 	template class  range3d_iterator<T3DDatafield<TYPE>::const_iterator>; \
 	template class  range3d_iterator_with_boundary_flag<T3DDatafield<TYPE>::iterator>; \
 	template class  range3d_iterator_with_boundary_flag<T3DDatafield<TYPE>::const_iterator>; 
 
+
 #define INSTANCIATE2D(TYPE)						\
 	template class  EXPORT_3D T2DDatafield<TYPE>;			\
 	template class  range2d_iterator<T2DDatafield<TYPE>::iterator>; \

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/mia.git



More information about the debian-med-commit mailing list