Added optional scaling factor to Voronoi construction.

This commit is contained in:
Markus Lampert
2020-09-05 23:36:14 -07:00
committed by sliptonic
parent 94a44bcbfe
commit f860339658
2 changed files with 8 additions and 2 deletions

View File

@@ -107,6 +107,9 @@ namespace Path
return new T(vd, index);
}
double getScale() const { return vd->getScale(); }
void setScale(double scale) { vd->setScale(scale); }
private:
Base::Reference<diagram_type> vd;
};

View File

@@ -68,10 +68,13 @@ PyObject *VoronoiPy::PyMake(struct _typeobject *, PyObject *, PyObject *) // Py
// constructor
int VoronoiPy::PyInit(PyObject* args, PyObject* /*kwds*/)
{
if (!PyArg_ParseTuple(args, "")) {
PyErr_SetString(PyExc_RuntimeError, "no arguments accepted");
Voronoi *vo = getVoronoiPtr();
double scale = vo->getScale();
if (!PyArg_ParseTuple(args, "|d", &scale)) {
PyErr_SetString(PyExc_RuntimeError, "scale argument (double) accepted, default = 1000");
return -1;
}
vo->setScale(scale);
return 0;
}