-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathmodule.m
More file actions
36 lines (32 loc) · 1.62 KB
/
Copy pathmodule.m
File metadata and controls
36 lines (32 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#import <Python.h>
#import "pathmatics/pathmatics.h"
// Pathmatics routines written for NodeBox by Tom De Smedt and Frederik De Bleser
PyMethodDef methods[] = {
// pathmatics
{"linepoint", cPathmatics_linepoint, METH_VARARGS, "Calculate linepoint."},
{"linelength", cPathmatics_linelength, METH_VARARGS, "Calculate linelength."},
{"curvepoint", cPathmatics_curvepoint, METH_VARARGS, "Calculate curvepoint."},
{"curvelength", cPathmatics_curvelength, METH_VARARGS, "Calculate curvelength."},
// polymagic
{"intersects", cPathmatics_intersects, METH_VARARGS, "Check if two NSBezierPaths intersect."},
{"union", cPathmatics_union, METH_VARARGS, "Calculates the union of two NSBezierPaths."},
{"intersect", cPathmatics_intersect, METH_VARARGS, "Calculates the intersection of two NSBezierPaths."},
{"difference", cPathmatics_difference, METH_VARARGS, "Calculates the difference of two NSBezierPaths."},
{"xor", cPathmatics_xor, METH_VARARGS, "Calculates the exclusive or of two NSBezierPaths."},
// trig
{"fast_inverse_sqrt", fast_inverse_sqrt, METH_VARARGS },
{"angle", angle, METH_VARARGS },
{"distance", distance, METH_VARARGS },
{"coordinates", coordinates, METH_VARARGS },
{NULL, NULL, 0, NULL} /* Sentinel */
};
PyMODINIT_FUNC PyInit__plotdevice(void){
static struct PyModuleDef moduledef = {
PyModuleDef_HEAD_INIT, "_plotdevice", "Typography, image/video export, and bezier math routines", -1, methods
};
PyObject *m = PyModule_Create(&moduledef);
PyObject *err = PyErr_NewException("cPathmatics.error", NULL, NULL);
Py_INCREF(err);
PyModule_AddObject(m, "error", err);
return m;
}