Mercurial > forge
changeset 1692:fdd97ed3e888 octave-forge
strict cmath: no round() and ceil() operates on floating point types.
author | pkienzle |
---|---|
date | Mon, 06 Sep 2004 05:59:04 +0000 |
parents | c93fbebdb692 |
children | 52ec826105e5 |
files | main/image/graycomatrix.cc main/image/houghtf.cc |
diffstat | 2 files changed, 4 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/main/image/graycomatrix.cc Fri Sep 03 21:07:16 2004 +0000 +++ b/main/image/graycomatrix.cc Mon Sep 06 05:59:04 2004 +0000 @@ -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/main/image/houghtf.cc Fri Sep 03 21:07:16 2004 +0000 +++ b/main/image/houghtf.cc Mon Sep 06 05:59:04 2004 +0000 @@ -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 )++;