changeset 119:571db4b478f2

strict cmath: no round() and ceil() operates on floating point types.
author pkienzle
date Mon, 06 Sep 2004 05:59:04 +0000
parents 54020e975476
children 7d3721f4a079
files graycomatrix.cc houghtf.cc
diffstat 2 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/graycomatrix.cc
+++ b/graycomatrix.cc
@@ -84,8 +84,8 @@
 		    
 		    double angle = th(th_idx);
 		    
-		    int row = r + (int)round(cos(angle) * d_val);
-		    int col = c - (int)round(sin(angle) * d_val);
+		    int row = r + (int)floor(cos(angle) * d_val + 0.5);
+		    int col = c - (int)floor(sin(angle) * d_val + 0.5);
 
 		    if ( ( row >= 0 ) && ( row < I.rows() ) &&
 			 ( col >= 0 ) && ( col < I.cols() ) ) {
--- a/houghtf.cc
+++ b/houghtf.cc
@@ -79,7 +79,7 @@
     size(0) = r; size(1) = c;
     double diag_length = sqrt( size.sumsq()(0) );
     int nr_bins = 2 * (int)ceil(diag_length) - 1;
-    RowVector bins = RowVector( Range(1, nr_bins).matrix_value() ) - (int)ceil(nr_bins/2);
+    RowVector bins = RowVector( Range(1, nr_bins).matrix_value() ) - ceil(nr_bins/2.);
 
     Matrix J = Matrix(bins.length(), 0);
 
@@ -91,7 +91,7 @@
 	for (int x = 0; x < r; x++) {
 	    for (int y = 0; y < c; y++) {
 		if ( I(y, x) == 1 ) {
-		    int rho = (int)round( cT*x + sT*y );
+		    int rho = (int)floor( cT*x + sT*y + 0.5 );
 		    int bin = (int)(rho - bins(0));
 		    if ( (bin > 0) && (bin < bins.length()) ) {
 			rho_count( bin )++;