|
| 1 | +#include "PythonHeaders.h" |
| 2 | +#include "Position.h" |
| 3 | + |
| 4 | +namespace bp = boost::python; |
| 5 | + |
| 6 | +/** |
| 7 | + * @brief Position struct - 3D coordinates with orientation |
| 8 | + */ |
| 9 | +void export_position_struct() |
| 10 | +{ |
| 11 | + bp::class_<Position> position_struct("Position", bp::no_init); |
| 12 | + |
| 13 | + // coordinates and orientation |
| 14 | + position_struct.def("GetPositionX", &Position::GetPositionX); |
| 15 | + position_struct.def("GetPositionY", &Position::GetPositionY); |
| 16 | + position_struct.def("GetPositionZ", &Position::GetPositionZ); |
| 17 | + position_struct.def("GetOrientation", &Position::GetOrientation); |
| 18 | + |
| 19 | + // distance helpers |
| 20 | + position_struct.def("GetExactDist2d", |
| 21 | + static_cast<float (Position::*)(float, float) const>(&Position::GetExactDist2d)); |
| 22 | + position_struct.def("GetExactDist", |
| 23 | + static_cast<float (Position::*)(float, float, float) const>(&Position::GetExactDist)); |
| 24 | + position_struct.def("GetExactDist2dSq", |
| 25 | + static_cast<float (Position::*)(float, float) const>(&Position::GetExactDist2dSq)); |
| 26 | + position_struct.def("GetExactDistSq", |
| 27 | + static_cast<float (Position::*)(float, float, float) const>(&Position::GetExactDistSq)); |
| 28 | + position_struct.def("GetExactDist2dTo", |
| 29 | + static_cast<float (Position::*)(Position const&) const>(&Position::GetExactDist2d)); |
| 30 | + position_struct.def("GetExactDistTo", |
| 31 | + static_cast<float (Position::*)(Position const&) const>(&Position::GetExactDist)); |
| 32 | + position_struct.def("GetExactDist2dSqTo", |
| 33 | + static_cast<float (Position::*)(Position const&) const>(&Position::GetExactDist2dSq)); |
| 34 | + position_struct.def("GetExactDistSqTo", |
| 35 | + static_cast<float (Position::*)(Position const&) const>(&Position::GetExactDistSq)); |
| 36 | + |
| 37 | + // angle helpers |
| 38 | + position_struct.def("GetAngle", static_cast<float (Position::*)(float, float) const>(&Position::GetAngle)); |
| 39 | + |
| 40 | + // validity |
| 41 | + position_struct.def("IsPositionValid", &Position::IsPositionValid); |
| 42 | +} |
| 43 | + |
| 44 | +/** |
| 45 | + * @brief WorldLocation class - Position with map context |
| 46 | + * @note Inherits from Position |
| 47 | + */ |
| 48 | +void export_worldlocation_class() |
| 49 | +{ |
| 50 | + bp::class_<WorldLocation, bp::bases<Position>> worldlocation_class("WorldLocation", bp::no_init); |
| 51 | + |
| 52 | + // map id accessors |
| 53 | + worldlocation_class.def("GetMapId", &WorldLocation::GetMapId); |
| 54 | + worldlocation_class.def("SetMapId", &WorldLocation::SetMapId); |
| 55 | +} |
0 commit comments