我有一个C函数:
int isInPolygon(Point testPoint, Point* polygon, int n);
,重点是一个简单的结构:
typedef struct {
int x;
int y;} Point;
Polygon也是Points.I在Point的接口中定义了一个typemap:
%typemap(in) (Point testPoint){
if (!PyTuple_Check($input)) {
PyErr_SetString(PyExc_ValueError, "Expecting a point in a tupple!");
return NULL;
}}
如何为Polygon做到这一点?