Added colorColinear and resetColor algorithms

This commit is contained in:
Markus Lampert
2020-09-07 18:12:26 -07:00
committed by sliptonic
parent 10ce91f873
commit 7e6975a154
9 changed files with 258 additions and 51 deletions

View File

@@ -173,8 +173,8 @@ Py::List VoronoiPy::getCells(void) const {
}
PyObject* VoronoiPy::colorExterior(PyObject *args) {
int color = 0;
if (!PyArg_ParseTuple(args, "i", &color)) {
Voronoi::color_type color = 0;
if (!PyArg_ParseTuple(args, "k", &color)) {
throw Py::RuntimeError("colorExterior requires an integer (color) argument");
}
getVoronoiPtr()->colorExterior(color);
@@ -184,8 +184,8 @@ PyObject* VoronoiPy::colorExterior(PyObject *args) {
}
PyObject* VoronoiPy::colorTwins(PyObject *args) {
int color = 0;
if (!PyArg_ParseTuple(args, "i", &color)) {
Voronoi::color_type color = 0;
if (!PyArg_ParseTuple(args, "k", &color)) {
throw Py::RuntimeError("colorTwins requires an integer (color) argument");
}
getVoronoiPtr()->colorTwins(color);
@@ -194,6 +194,30 @@ PyObject* VoronoiPy::colorTwins(PyObject *args) {
return Py_None;
}
PyObject* VoronoiPy::colorColinear(PyObject *args) {
Voronoi::color_type color = 0;
double degree = 10.;
if (!PyArg_ParseTuple(args, "k|d", &color, &degree)) {
throw Py::RuntimeError("colorColinear requires an integer (color) and optionally a derivation in degrees argument (default 10)");
}
getVoronoiPtr()->colorColinear(color, degree);
Py_INCREF(Py_None);
return Py_None;
}
PyObject* VoronoiPy::resetColor(PyObject *args) {
Voronoi::color_type color = 0;
if (!PyArg_ParseTuple(args, "k", &color)) {
throw Py::RuntimeError("clearColor requires an integer (color) argument");
}
getVoronoiPtr()->resetColor(color);
Py_INCREF(Py_None);
return Py_None;
}
// custom attributes get/set
PyObject *VoronoiPy::getCustomAttributes(const char* /*attr*/) const