Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Obj.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file Obj.cpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2023 CERN for the benefit of the Acts project
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
16 
17 #include <memory>
18 
19 #include <pybind11/pybind11.h>
20 #include <pybind11/stl.h>
21 
22 namespace py = pybind11;
23 using namespace pybind11::literals;
24 
25 using namespace Acts;
26 
27 namespace Acts::Python {
28 void addObj(Context& ctx) {
29  auto [m, mex] = ctx.get("main", "examples");
30 
31  {
39  mex.def("writeSurfacesObj",
40  [](const std::vector<std::shared_ptr<Surface>>& surfaces,
41  const GeometryContext& viewContext,
42  const std::array<int, 3>& viewRgb, const std::string& fileName) {
43  Acts::ViewConfig sConfig = Acts::ViewConfig{viewRgb};
44  Acts::GeometryView3D view3D;
46 
47  for (const auto& surface : surfaces) {
48  view3D.drawSurface(obj, *surface, viewContext,
49  Acts::Transform3::Identity(), sConfig);
50  }
51  obj.write(fileName);
52  });
53  }
54 }
55 } // namespace Acts::Python