| 217 | } |
| 218 | |
| 219 | static double |
| 220 | icvCalcDist2D( CvPoint2D32f * points, int count, float *_line, float *dist ) |
| 221 | { |
| 222 | int j; |
| 223 | float px = _line[2], py = _line[3]; |
| 224 | float nx = _line[1], ny = -_line[0]; |
| 225 | double sum_dist = 0.; |
| 226 | |
| 227 | for( j = 0; j < count; j++ ) |
| 228 | { |
| 229 | float x, y; |
| 230 | |
| 231 | x = points[j].x - px; |
| 232 | y = points[j].y - py; |
| 233 | |
| 234 | dist[j] = (float) fabs( nx * x + ny * y ); |
| 235 | sum_dist += dist[j]; |
| 236 | } |
| 237 | |
| 238 | return sum_dist; |
| 239 | } |
| 240 | |
| 241 | static double |
| 242 | icvCalcDist3D( CvPoint3D32f * points, int count, float *_line, float *dist ) |