ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
ccCircle.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 <ecvCircle.h>
13 #include <ecvObject.h>
14 #include <ecvPolyline.h>
15 
16 #include "../casters.h"
17 
18 namespace py = pybind11;
19 using namespace pybind11::literals;
20 
21 void define_ccCircle(py::module &m)
22 {
23  py::class_<ccCircle, ccPolyline>(m, "ccCircle", R"doc(
24  ccCircle
25 
26  A 3D circle represented as a polyline.
27 
28  Parameters
29  ----------
30  radius : double, default: 0.0
31  radius of the circle
32  resolution : int, default: 48
33  circle displayed resolution (number of segments)
34  uniqueID : int, optional
35  unique ID (handle with care)
36 
37  Example
38  -------
39 
40  .. code:: Python
41 
42  circle = pycc.ccCircle(5.0, resolution=64)
43  circle2 = pycc.ccCircle(radius=10.0, resolution=32)
44 )doc")
45  .def(
46  py::init<double, unsigned, unsigned>(),
47  "radius"_a = 0.0,
48  "resolution"_a = 48,
49  "uniqueID"_a = []() { return ccUniqueIDGenerator::InvalidUniqueID; }())
50  .def("getRadius", &ccCircle::getRadius, R"doc(
51  Returns the radius of the circle.
52 
53  Returns
54  -------
55  double
56  The radius of the circle.
57 )doc")
58  .def("setRadius", &ccCircle::setRadius, "radius"_a, R"doc(
59  Sets the radius of the circle.
60 
61  Parameters
62  ----------
63  radius : double
64  The desired radius.
65 )doc")
66  .def("getResolution", &ccCircle::getResolution, R"doc(
67  Returns the resolution of the displayed circle.
68 
69  Returns
70  -------
71  int
72  The resolution (number of segments) of the circle.
73 )doc")
74  .def("setResolution", &ccCircle::setResolution, "resolution"_a, R"doc(
75  Sets the resolution of the displayed circle.
76 
77  Parameters
78  ----------
79  resolution : int
80  The displayed resolution (>= 4).
81 )doc")
82  .def("clone",
84  R"doc(
85  Clones this circle.
86 
87  Returns
88  -------
89  ccCircle
90  A new circle object that is a copy of this circle.
91 )doc",
92  py::return_value_policy::take_ownership);
93 }
void define_ccCircle(py::module &m)
Definition: ccCircle.cpp:21
ccCircle * clone() const
Clones this circle.
double getRadius() const
Returns the radius of the circle.
Definition: ecvCircle.h:50
unsigned getResolution() const
Returns the resolution of the displayed circle.
Definition: ecvCircle.h:58
void setRadius(double radius)
Sets the radius of the circle.
void setResolution(unsigned resolution)
Sets the resolution of the displayed circle.
static constexpr unsigned InvalidUniqueID
Definition: ecvObject.h:24