From 8897b62c5b04b012850d61027e6e1a36fa4a513d Mon Sep 17 00:00:00 2001 From: kevin Date: Fri, 21 Feb 2014 22:46:37 -0800 Subject: [PATCH] cmVectOpsRICode.h : Fixed bug in IsClose(). --- vop/cmVectOpsRICode.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/vop/cmVectOpsRICode.h b/vop/cmVectOpsRICode.h index 91d2e09..99ec57a 100644 --- a/vop/cmVectOpsRICode.h +++ b/vop/cmVectOpsRICode.h @@ -878,8 +878,16 @@ bool VECT_OP_FUNC(IsClose)( const VECT_OP_TYPE* s0p, const VECT_OP_TYPE* s1p, un const VECT_OP_TYPE* ep = s0p + sn; for(; s0p < ep; ++s0p,++s1p ) { - double d = abs(*s1p - *s0p); + double d = *s1p - *s0p; double s = cmMin(*s1p,*s0p); + + // take abs value of d and s + if( d < 0 ) + d *= -1; + + if( s < 0 ) + s *= -1; + if( d*100.0/s > pct ) return false; }