23 nargchk(nrhs>=2 && (nrhs%2)==0 && nlhs<=1);
33 bool doublePrecision =
false;
34 for (
int i=2; i<nrhs; i+=2) {
35 string key(rhs[i].toString());
37 angle = rhs[i+1].toInt();
38 else if (key ==
"StartAngle")
39 arcStart = rhs[i+1].toInt();
40 else if (key ==
"EndAngle")
41 arcEnd = rhs[i+1].toInt();
42 else if (key ==
"Delta")
43 delta = rhs[i+1].toInt();
44 else if (key ==
"DoublePrecision")
45 doublePrecision = rhs[i+1].toBool();
48 "Unrecognized option %s", key.
c_str());
52 if (doublePrecision) {
53 Point2d center(rhs[0].toPoint_<double>());
54 Size2d axes(rhs[1].toSize_<double>());
56 ellipse2Poly(center, axes, angle, arcStart, arcEnd, delta, pts);
57 plhs[0] =
MxArray(
Mat(pts,
false).reshape(1,0));
60 Point center(rhs[0].toPoint());
61 Size axes(rhs[1].toSize());
63 ellipse2Poly(center, axes, angle, arcStart, arcEnd, delta, pts);
64 plhs[0] =
MxArray(
Mat(pts,
false).reshape(1,0));
struct mxArray_tag mxArray
Forward declaration for mxArray.
LIBMWMEX_API_EXTERN_C void mexErrMsgIdAndTxt(const char *identifier, const char *err_msg,...)
Issue formatted error message with corresponding error identifier and return to MATLAB prompt...
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.
mxArray object wrapper for data conversion and manipulation.
void nargchk(bool cond)
Alias for input/output arguments number check.
Global constant definitions.
void ellipse2Poly(Point center, Size axes, int angle, int arcStart, int arcEnd, int delta, std::vector< Point > &pts)