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

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

commit 752d5d3d8f3e7ed62c8b21034466af32a22974ef
Author: Gert Wollny <[email protected]>
Date:   Thu Oct 29 14:08:12 2015 +0100

    revert patches before new import
---
 mia/3d/datafield.cc      |  4 +++
 mia/3d/imagedraw.cc      |  8 +++---
 mia/3d/test_imagedraw.cc | 72 ++++++++++++++++++++++++------------------------
 mia/3d/vectorfield.cc    |  5 ++--
 4 files changed, 46 insertions(+), 43 deletions(-)

diff --git a/mia/3d/datafield.cc b/mia/3d/datafield.cc
index beef397..e92d95d 100644
--- a/mia/3d/datafield.cc
+++ b/mia/3d/datafield.cc
@@ -97,6 +97,10 @@ 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 d662bc0..de1e578 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>(roundf(p.x)), 
-                     static_cast<unsigned>(roundf(p.y)), 
-                     static_cast<unsigned>(roundf(p.z)));
+        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() << "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 253189f..e5d963a 100644
--- a/mia/3d/test_imagedraw.cc
+++ b/mia/3d/test_imagedraw.cc
@@ -59,6 +59,8 @@ 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(); 
         
         
@@ -126,9 +128,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>(roundf(p.x)), 
-                            static_cast<unsigned>(roundf(p.y)), 
-                            static_cast<unsigned>(roundf(p.z))); 
+               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"; 
                pixels.insert(ip); 
        }
@@ -159,9 +161,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>(roundf(p.x)), 
-                            static_cast<unsigned>(roundf(p.y)), 
-                            static_cast<unsigned>(roundf(p.z))); 
+               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"; 
                pixels.insert(ip); 
        }
@@ -192,9 +194,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>(roundf(p.x)), 
-                            static_cast<unsigned>(roundf(p.y)), 
-                            static_cast<unsigned>(roundf(p.z))); 
+               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"; 
                pixels.insert(ip); 
        }
@@ -224,15 +226,13 @@ 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 < 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); 
-               }
+       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); 
        }
         
        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>(roundf(p.x)), 
-                            static_cast<unsigned>(roundf(p.y)), 
-                            static_cast<unsigned>(roundf(p.z))); 
+               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.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>(roundf(p.x)), 
-                            static_cast<unsigned>(roundf(p.y)), 
-                            static_cast<unsigned>(roundf(p.z))); 
+               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.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_dN_is_zero_and_N_outside, 
SimpleBitImageDrawFixture ) 
+BOOST_FIXTURE_TEST_CASE( 
test_draw_line_pivot_y_outside_ends_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,-3, 2), C3DFVector(30,6,5)); 
+        output.draw_line(C3DFVector(30,6, 5), 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(8,7,-5)); 
+        output.draw_line(C3DFVector(1,6, -5), C3DFVector(1,6,-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>(roundf(p.x)), 
-                            static_cast<unsigned>(roundf(p.y)), 
-                            static_cast<unsigned>(roundf(p.z))); 
+               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.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>(roundf(p.x)), 
-                            static_cast<unsigned>(roundf(p.y)), 
-                            static_cast<unsigned>(roundf(p.z))); 
+               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); 
@@ -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>(roundf(p.x)), 
-                            static_cast<unsigned>(roundf(p.y)), 
-                            static_cast<unsigned>(roundf(p.z))); 
+               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.z < img.get_size().z) 
                        pixels.insert(ip); 
diff --git a/mia/3d/vectorfield.cc b/mia/3d/vectorfield.cc
index 269d3e0..f082531 100644
--- a/mia/3d/vectorfield.cc
+++ b/mia/3d/vectorfield.cc
@@ -56,14 +56,13 @@ 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

_______________________________________________
debian-med-commit mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/debian-med-commit

Reply via email to