ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
ccGenericDisplayTools.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 "../casters.h"
9 #include <pybind11/native_enum.h>
10 #include <pybind11/pybind11.h>
11 #include <pybind11/stl.h>
12 #include <pybind11/stl_bind.h>
13 
14 #include <QPointF>
15 #include <QSize>
16 
17 #include <ecvGenericDisplayTools.h>
18 
19 namespace py = pybind11;
20 using namespace pybind11::literals;
21 
22 void define_ccGenericDisplayTools(py::module &m)
23 {
24  py::class_<ccGLCameraParameters>(m, "ccGLCameraParameters")
25  .def(py::init<>())
26  .def("project",
27  (bool(ccGLCameraParameters::*)(const CCVector3d &, CCVector3d &, bool *)
29  "input3D"_a,
30  "output2D"_a,
31  "checkInFrustrum"_a = false)
32  .def("project",
33  (bool(ccGLCameraParameters::*)(const CCVector3 &, CCVector3d &, bool *)
35  "input3D"_a,
36  "output2D"_a,
37  "checkInFrustrum"_a = false)
38  .def("unproject",
39  (bool(ccGLCameraParameters::*)(const CCVector3d &, CCVector3d &)
41  "input3D"_a,
42  "output2D"_a)
43 
44  .def("unproject",
45  (bool(ccGLCameraParameters::*)(const CCVector3 &, CCVector3d &)
47  "input3D"_a,
48  "output2D"_a)
49 
50  .def_readwrite("modelViewMat", &ccGLCameraParameters::modelViewMat)
51  .def_readwrite("projectionMat", &ccGLCameraParameters::projectionMat)
52  // .def_readwrite("viewport", &ccGLCameraParameters::viewport)
53  .def_readwrite("perspective", &ccGLCameraParameters::perspective)
54  .def_readwrite("fov_deg", &ccGLCameraParameters::fov_deg)
55  .def_readwrite("pixelSize", &ccGLCameraParameters::pixelSize);
56 
57  py::class_<ecvGenericDisplayTools> PyecvGenericDisplayTools(m, "ccGenericDisplayTools");
58 
59  py::native_enum<ecvGenericDisplayTools::TextAlign>(
60  PyecvGenericDisplayTools, "TextAlign", "enum.Enum", "ecvGenericDisplayTools::TextAlign.")
61  .value("ALIGN_HLEFT", ecvGenericDisplayTools::TextAlign::ALIGN_HLEFT)
62  .value("ALIGN_HMIDDLE", ecvGenericDisplayTools::TextAlign::ALIGN_HMIDDLE)
63  .value("ALIGN_HRIGHT", ecvGenericDisplayTools::TextAlign::ALIGN_HRIGHT)
64  .value("ALIGN_VTOP", ecvGenericDisplayTools::TextAlign::ALIGN_VTOP)
65  .value("ALIGN_VMIDDLE", ecvGenericDisplayTools::TextAlign::ALIGN_VMIDDLE)
66  .value("ALIGN_VBOTTOM", ecvGenericDisplayTools::TextAlign::ALIGN_VBOTTOM)
67  .value("ALIGN_DEFAULT", ecvGenericDisplayTools::TextAlign::ALIGN_DEFAULT)
68  .export_values()
69  .finalize();
70 
71  // TODO as widget
72 }
void define_ccGenericDisplayTools(py::module &m)
OpenGL camera parameters.
float fov_deg
F.O.V. (in degrees) - perspective mode only.
ccGLMatrixd projectionMat
Projection matrix (GL_PROJECTION)
ccGLMatrixd modelViewMat
Model view matrix (GL_MODELVIEW)
bool unproject(const CCVector3d &input2D, CCVector3d &output3D) const
Unprojects a 2D point (+ normalized 'z' coordinate) in 3D.
float pixelSize
Pixel size (i.e. zoom) - non perspective mode only.
bool perspective
Perspective mode.
bool project(const CCVector3d &input3D, CCVector3d &output2D, bool *inFrustum=nullptr) const
Projects a 3D point in 2D (+ normalized 'z' coordinate)