1
0
Fork 0
mirror of https://github.com/ruby-opencv/ruby-opencv synced 2023-03-27 23:22:12 -04:00

added error handling to Curve methods

This commit is contained in:
ser1zw 2011-07-21 23:14:12 +09:00
parent 354d47830a
commit a7e180a5db

View file

@ -95,9 +95,16 @@ rb_arc_length(int argc, VALUE *argv, VALUE self)
{
VALUE slice, is_closed;
rb_scan_args(argc, argv, "02", &slice, &is_closed);
return rb_float_new(cvArcLength(CVARR(self),
NIL_P(slice) ? CV_WHOLE_SEQ : VALUE_TO_CVSLICE(slice),
TRUE_OR_FALSE(is_closed, -1)));
double length = 0;
try {
length = cvArcLength(CVARR(self),
NIL_P(slice) ? CV_WHOLE_SEQ : VALUE_TO_CVSLICE(slice),
TRUE_OR_FALSE(is_closed, -1));
}
catch (cv::Exception& e) {
raise_cverror(e);
}
return rb_float_new(length);
}
__NAMESPACE_END_CURVE