| 
									
										
										
										
											2015-11-20 01:31:38 +08:00
										 |  |  | /* ----------------------------------------------------------------------------
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |  * GTSAM Copyright 2010, Georgia Tech Research Corporation,  | 
					
						
							|  |  |  |  * Atlanta, Georgia 30332-0415 | 
					
						
							|  |  |  |  * All Rights Reserved | 
					
						
							|  |  |  |  * Authors: Frank Dellaert, et al. (see THANKS for the full author list) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |  * See LICENSE for the license information | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |  * -------------------------------------------------------------------------- */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |  * @brief wraps Point2 class to python | 
					
						
							|  |  |  |  * @author Andrew Melim | 
					
						
							|  |  |  |  * @author Ellon Paiva Mendes (LAAS-CNRS) | 
					
						
							|  |  |  |  **/ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-11-15 14:59:02 +08:00
										 |  |  | #include <boost/python.hpp>
 | 
					
						
							| 
									
										
										
										
											2015-11-21 04:40:40 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | #define NO_IMPORT_ARRAY
 | 
					
						
							|  |  |  | #include <numpy_eigen/NumpyEigenConverter.hpp>
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-11-15 14:59:02 +08:00
										 |  |  | #include "gtsam/geometry/Point2.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | using namespace boost::python; | 
					
						
							|  |  |  | using namespace gtsam; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-09 09:34:24 +08:00
										 |  |  | #ifndef GTSAM_TYPEDEF_POINTS_TO_VECTORS
 | 
					
						
							| 
									
										
										
										
											2013-11-16 06:59:36 +08:00
										 |  |  | BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(print_overloads, Point2::print, 0, 1) | 
					
						
							|  |  |  | BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(equals_overloads, Point2::equals, 1, 2) | 
					
						
							|  |  |  | BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(compose_overloads, Point2::compose, 1, 3) | 
					
						
							| 
									
										
										
										
											2016-06-06 14:52:04 +08:00
										 |  |  | BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(distance_overloads, Point2::distance, 1, 3) | 
					
						
							| 
									
										
										
										
											2016-06-09 09:34:24 +08:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2013-11-15 14:59:02 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | void exportPoint2(){ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-09 09:34:24 +08:00
										 |  |  | #ifndef GTSAM_TYPEDEF_POINTS_TO_VECTORS
 | 
					
						
							| 
									
										
										
										
											2013-11-15 14:59:02 +08:00
										 |  |  |   class_<Point2>("Point2", init<>()) | 
					
						
							|  |  |  |     .def(init<double, double>()) | 
					
						
							| 
									
										
										
										
											2015-11-20 23:05:42 +08:00
										 |  |  |     .def(init<const Vector2 &>()) | 
					
						
							| 
									
										
										
										
											2015-11-20 01:31:38 +08:00
										 |  |  |     .def("identity", &Point2::identity) | 
					
						
							| 
									
										
										
										
											2016-06-06 14:52:04 +08:00
										 |  |  |     .def("distance", &Point2::distance, distance_overloads(args("q","H1","H2"))) | 
					
						
							| 
									
										
										
										
											2013-11-16 06:59:36 +08:00
										 |  |  |     .def("equals", &Point2::equals, equals_overloads(args("q","tol"))) | 
					
						
							| 
									
										
										
										
											2015-11-20 01:31:38 +08:00
										 |  |  |     .def("norm", &Point2::norm) | 
					
						
							|  |  |  |     .def("print", &Point2::print, print_overloads(args("s"))) | 
					
						
							|  |  |  |     .def("unit", &Point2::unit) | 
					
						
							| 
									
										
										
										
											2016-06-06 14:52:04 +08:00
										 |  |  |     .def("vector", &Point2::vector, return_value_policy<copy_const_reference>()) | 
					
						
							| 
									
										
										
										
											2013-11-15 14:59:02 +08:00
										 |  |  |     .def("x", &Point2::x) | 
					
						
							|  |  |  |     .def("y", &Point2::y) | 
					
						
							| 
									
										
										
										
											2015-11-20 01:31:38 +08:00
										 |  |  |     .def(self * other<double>()) // __mult__
 | 
					
						
							|  |  |  |     .def(other<double>() * self) // __mult__
 | 
					
						
							|  |  |  |     .def(self + self) | 
					
						
							|  |  |  |     .def(-self) | 
					
						
							|  |  |  |     .def(self - self) | 
					
						
							|  |  |  |     .def(self / other<double>()) | 
					
						
							|  |  |  |     .def(self_ns::str(self)) | 
					
						
							|  |  |  |     .def(repr(self)) | 
					
						
							|  |  |  |     .def(self == self) | 
					
						
							| 
									
										
										
										
											2013-11-15 14:59:02 +08:00
										 |  |  |   ; | 
					
						
							| 
									
										
										
										
											2016-06-09 09:34:24 +08:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2016-06-06 14:52:04 +08:00
										 |  |  | } |