aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/matplotlib/py3/src/tri/_tri_wrapper.cpp
diff options
context:
space:
mode:
authorAlexander Smirnov <alex@ydb.tech>2025-05-14 00:51:55 +0000
committerAlexander Smirnov <alex@ydb.tech>2025-05-14 00:51:55 +0000
commitb2d03716ee053cd32dccb8dd189d0b4bc3540d90 (patch)
treed329b3f92d5f80b8a76cac17d9e30bd1c8dc4b06 /contrib/python/matplotlib/py3/src/tri/_tri_wrapper.cpp
parent645c59acc8ced6d89eb8559e26a7405d42ae9fb4 (diff)
parent0bf9db6399352012396e7791bcfd762e944b33c2 (diff)
downloadydb-b2d03716ee053cd32dccb8dd189d0b4bc3540d90.tar.gz
Merge branch 'rightlib' into merge-libs-250514-0050
Diffstat (limited to 'contrib/python/matplotlib/py3/src/tri/_tri_wrapper.cpp')
-rw-r--r--contrib/python/matplotlib/py3/src/tri/_tri_wrapper.cpp58
1 files changed, 58 insertions, 0 deletions
diff --git a/contrib/python/matplotlib/py3/src/tri/_tri_wrapper.cpp b/contrib/python/matplotlib/py3/src/tri/_tri_wrapper.cpp
new file mode 100644
index 00000000000..1b0c3d75555
--- /dev/null
+++ b/contrib/python/matplotlib/py3/src/tri/_tri_wrapper.cpp
@@ -0,0 +1,58 @@
+#include "_tri.h"
+
+PYBIND11_MODULE(_tri, m) {
+ py::class_<Triangulation>(m, "Triangulation")
+ .def(py::init<const Triangulation::CoordinateArray&,
+ const Triangulation::CoordinateArray&,
+ const Triangulation::TriangleArray&,
+ const Triangulation::MaskArray&,
+ const Triangulation::EdgeArray&,
+ const Triangulation::NeighborArray&,
+ bool>(),
+ py::arg("x"),
+ py::arg("y"),
+ py::arg("triangles"),
+ py::arg("mask"),
+ py::arg("edges"),
+ py::arg("neighbors"),
+ py::arg("correct_triangle_orientations"),
+ "Create a new C++ Triangulation object.\n"
+ "This should not be called directly, use the python class\n"
+ "matplotlib.tri.Triangulation instead.\n")
+ .def("calculate_plane_coefficients", &Triangulation::calculate_plane_coefficients,
+ "Calculate plane equation coefficients for all unmasked triangles.")
+ .def("get_edges", &Triangulation::get_edges,
+ "Return edges array.")
+ .def("get_neighbors", &Triangulation::get_neighbors,
+ "Return neighbors array.")
+ .def("set_mask", &Triangulation::set_mask,
+ "Set or clear the mask array.");
+
+ py::class_<TriContourGenerator>(m, "TriContourGenerator")
+ .def(py::init<Triangulation&,
+ const TriContourGenerator::CoordinateArray&>(),
+ py::arg("triangulation"),
+ py::arg("z"),
+ "Create a new C++ TriContourGenerator object.\n"
+ "This should not be called directly, use the functions\n"
+ "matplotlib.axes.tricontour and tricontourf instead.\n")
+ .def("create_contour", &TriContourGenerator::create_contour,
+ "Create and return a non-filled contour.")
+ .def("create_filled_contour", &TriContourGenerator::create_filled_contour,
+ "Create and return a filled contour.");
+
+ py::class_<TrapezoidMapTriFinder>(m, "TrapezoidMapTriFinder")
+ .def(py::init<Triangulation&>(),
+ py::arg("triangulation"),
+ "Create a new C++ TrapezoidMapTriFinder object.\n"
+ "This should not be called directly, use the python class\n"
+ "matplotlib.tri.TrapezoidMapTriFinder instead.\n")
+ .def("find_many", &TrapezoidMapTriFinder::find_many,
+ "Find indices of triangles containing the point coordinates (x, y).")
+ .def("get_tree_stats", &TrapezoidMapTriFinder::get_tree_stats,
+ "Return statistics about the tree used by the trapezoid map.")
+ .def("initialize", &TrapezoidMapTriFinder::initialize,
+ "Initialize this object, creating the trapezoid map from the triangulation.")
+ .def("print_tree", &TrapezoidMapTriFinder::print_tree,
+ "Print the search tree as text to stdout; useful for debug purposes.");
+}