-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6889db5
commit 30bc857
Showing
1 changed file
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#ifndef XTGEO_XYZ_HPP | ||
#define XTGEO_XYZ_HPP | ||
|
||
#include <pybind11/pybind11.h> | ||
#include <xtgeo/types.hpp> | ||
|
||
namespace py = pybind11; | ||
|
||
namespace xtgeo { | ||
namespace xyz { | ||
|
||
inline void | ||
init(py::module &m) | ||
{ | ||
auto m_points = | ||
m.def_submodule("points", "Internal functions for operations on point(s)."); | ||
|
||
py::class_<Point>(m_points, "Point") | ||
.def(py::init<>()) | ||
.def(py::init<double, double>()) // Constructor with 2 arguments | ||
.def(py::init<double, double, double>()) // Constructor with 3 arguments | ||
|
||
.def_readwrite("x", &Point::x) | ||
.def_readwrite("y", &Point::y) | ||
.def_readwrite("z", &Point::z); | ||
|
||
py::class_<Polygon>(m, "Polygon") | ||
.def(py::init<>()) | ||
.def(py::init<const std::vector<xtgeo::xyz::Point> &>()) | ||
.def(py::init<const py::array_t<double> &>()) | ||
.def("add_point", &xtgeo::xyz::Polygon::add_point) | ||
.def("size", &xtgeo::xyz::Polygon::size) | ||
.def_readwrite("points", &xtgeo::xyz::Polygon::points); | ||
} | ||
|
||
} // namespace xyz | ||
} // namespace xtgeo | ||
|
||
#endif // XTGEO_XYZ_HPP |