forked from acts-project/acts
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathVisualization.cpp
More file actions
63 lines (53 loc) · 2.12 KB
/
Visualization.cpp
File metadata and controls
63 lines (53 loc) · 2.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// This file is part of the ACTS project.
//
// Copyright (C) 2016 CERN for the benefit of the ACTS project
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
#include "Acts/Visualization/IVisualization3D.hpp"
#include "Acts/Visualization/ObjVisualization3D.hpp"
#include "Acts/Visualization/ViewConfig.hpp"
#include "ActsPython/Utilities/Helpers.hpp"
#include "ActsPython/Utilities/Macros.hpp"
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
#include <pybind11/stl/filesystem.h>
namespace py = pybind11;
using namespace Acts;
namespace ActsPython {
/// @brief Add visualization bindings to the given module.
/// @param m The module to add the bindings to.
void addVisualization(py::module& m) {
{
auto c = py::class_<ViewConfig>(m, "ViewConfig").def(py::init<>());
ACTS_PYTHON_STRUCT(c, visible, color, offset, lineThickness,
surfaceThickness, quarterSegments, triangulate,
outputName);
patchKwargsConstructor(c);
py::class_<Color>(m, "Color")
.def(py::init<>())
.def(py::init<int, int, int>())
.def(py::init<double, double, double>())
.def(py::init<std::string_view>())
.def_readonly("rgb", &Color::rgb);
}
py::class_<IVisualization3D>(m, "IVisualization3D")
.def("write", py::overload_cast<const std::filesystem::path&>(
&IVisualization3D::write, py::const_));
py::class_<ObjVisualization3D, IVisualization3D>(m, "ObjVisualization3D")
.def(py::init<unsigned int, double>(), py::arg("prec") = 4u,
py::arg("scale") = 1.)
.def("write",
py::overload_cast<const std::filesystem::path&>(
&ObjVisualization3D::write, py::const_),
py::arg("path"))
.def("clear", &ObjVisualization3D::clear)
.def(
"object",
[](ObjVisualization3D& self, const std::string& name) {
self.object(name);
},
py::arg("name"));
}
} // namespace ActsPython