|
| 1 | +// ########################################################################## |
| 2 | +// # # |
| 3 | +// # CLOUDCOMPARE PLUGIN: PythonRuntime # |
| 4 | +// # # |
| 5 | +// # This program is free software; you can redistribute it and/or modify # |
| 6 | +// # it under the terms of the GNU General Public License as published by # |
| 7 | +// # the Free Software Foundation; version 2 of the License. # |
| 8 | +// # # |
| 9 | +// # This program is distributed in the hope that it will be useful, # |
| 10 | +// # but WITHOUT ANY WARRANTY; without even the implied warranty of # |
| 11 | +// # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # |
| 12 | +// # GNU General Public License for more details. # |
| 13 | +// # # |
| 14 | +// # COPYRIGHT: Thomas Montaigu # |
| 15 | +// # # |
| 16 | +// ########################################################################## |
| 17 | + |
| 18 | +#include <pybind11/pybind11.h> |
| 19 | +#include <pybind11/stl.h> |
| 20 | +#include <pybind11/stl_bind.h> |
| 21 | + |
| 22 | +#include <ccDisc.h> |
| 23 | + |
| 24 | +#include "../casters.h" |
| 25 | + |
| 26 | +namespace py = pybind11; |
| 27 | +using namespace pybind11::literals; |
| 28 | + |
| 29 | +void define_ccDisc(py::module &m) |
| 30 | +{ |
| 31 | + py::class_<ccDisc, ccGenericPrimitive>(m, "ccDisc", R"doc( |
| 32 | + ccDisc |
| 33 | +
|
| 34 | + Parameters |
| 35 | + ---------- |
| 36 | + radius : PointCoordinateType |
| 37 | + radius of the disc |
| 38 | + transMat : , optional |
| 39 | + optional 3D transformation (can be set afterwards with ccDrawableObject::setGLTransformation) |
| 40 | + name : str, default: Disc |
| 41 | + name of the disc object |
| 42 | + precision : int, default: 24 |
| 43 | + drawing precision (angular step = 360/precision) |
| 44 | + uniqueID : int, optional |
| 45 | + unique ID (handle with care) |
| 46 | +
|
| 47 | + Example |
| 48 | + ------- |
| 49 | +
|
| 50 | + .. code:: Python |
| 51 | +
|
| 52 | + disc = pycc.ccDisc(3.0) |
| 53 | + disc2 = pycc.ccDisc(5.0, name="Disc2") |
| 54 | +)doc") |
| 55 | + .def( |
| 56 | + py::init<PointCoordinateType, const ccGLMatrix *, QString, unsigned, unsigned>(), |
| 57 | + "radius"_a, |
| 58 | + "transMat"_a = nullptr, |
| 59 | + "name"_a = QString("Disc"), |
| 60 | + "precision"_a = 24, |
| 61 | + "uniqueId"_a = []() { return ccUniqueIDGenerator::InvalidUniqueID; }()) |
| 62 | + .def("getRadius", &ccDisc::getRadius) |
| 63 | + .def("setRadius", &ccDisc::setRadius, "radius"_a); |
| 64 | +} |
0 commit comments