ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
ccDisc.cpp
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #include <pybind11/pybind11.h>
9 #include <pybind11/stl.h>
10 #include <pybind11/stl_bind.h>
11 
12 #include <ecvDisc.h>
13 #include <ecvGLMatrix.h>
14 #include <ecvGenericPrimitive.h>
15 
16 #include "../casters.h"
17 
18 namespace py = pybind11;
19 using namespace pybind11::literals;
20 
21 void define_ccDisc(py::module &m)
22 {
23  py::class_<ccDisc, ccGenericPrimitive>(m, "ccDisc", R"doc(
24  ccDisc
25 
26  A 3D disc primitive.
27 
28  Parameters
29  ----------
30  radius : PointCoordinateType
31  disc radius
32  transMat : ccGLMatrix, optional
33  optional 3D transformation (can be set afterwards with ccDrawableObject::setGLTransformation)
34  name : str, default: "Disc"
35  name of the disc object
36  precision : int, default: 72
37  drawing precision (angular step = 360/precision)
38 
39  Example
40  -------
41 
42  .. code:: Python
43 
44  disc = pycc.ccDisc(5.0)
45  disc2 = pycc.ccDisc(radius=10.0, precision=64, name="MyDisc")
46 )doc")
47  .def(
48  py::init<PointCoordinateType, const ccGLMatrix *, QString, unsigned>(),
49  "radius"_a,
50  "transMat"_a = nullptr,
51  "name"_a = QString("Disc"),
52  "precision"_a = []() { return ccDisc::DEFAULT_DRAWING_PRECISION; }())
53  .def(py::init<QString>(), "name"_a = QString("Disc"))
54  .def("getRadius", &ccDisc::getRadius, R"doc(
55  Returns the radius of the disc.
56 
57  Returns
58  -------
59  PointCoordinateType
60  The radius of the disc.
61 )doc")
62  .def("setRadius", &ccDisc::setRadius, "radius"_a, R"doc(
63  Sets the radius of the disc.
64 
65  Parameters
66  ----------
67  radius : PointCoordinateType
68  The desired radius.
69 
70  Note
71  ----
72  This changes the primitive content (calls ccGenericPrimitive::updateRepresentation).
73 )doc")
74  .def("clone",
76  R"doc(
77  Clones this disc.
78 
79  Returns
80  -------
81  ccDisc
82  A new disc object that is a copy of this disc.
83 )doc",
84  py::return_value_policy::take_ownership);
85 }
void define_ccDisc(py::module &m)
Definition: ccDisc.cpp:21
PointCoordinateType getRadius() const
Returns radius.
Definition: ecvDisc.h:41
void setRadius(PointCoordinateType radius)
Sets radius.
ccGenericPrimitive * clone() const override
Clones primitive.
static const unsigned DEFAULT_DRAWING_PRECISION
Default drawing precision.
Definition: ecvDisc.h:21