Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef COORDINATECONVERTER_H
00011 #define COORDINATECONVERTER_H
00012
00013 #include <vector>
00014
00015 #include "Workers/Math/Point2D.h"
00016 #include "Workers/Math/Vector3D.h"
00017 #include "Workers/Math/Pixel.h"
00018 #include "Workers/Math/Pose.h"
00019 #include "Workers/Math/Transformation2D.h"
00020
00021 #define M_PI 3.14159265358979323846
00022
00026 class CoordinateConverter {
00027
00028 public:
00029
00033 virtual ~CoordinateConverter();
00034
00035
00039 static Point2D robotToWorld(Pose robotPose, Point2D robotPoint);
00040 static Pose robotToWorld( Pose robotPose, Pose pose);
00041 static Transformation2D robotToWorld(Pose robotPose, Transformation2D transformation);
00042 static std::vector<Point2D> robotToWorld(Pose robotPose, const std::vector<Point2D>& robotPoints);
00043
00048 static Point2D worldToRobot(Pose robotPose, Point2D worldPoint);
00049 static Transformation2D worldToRobot(Pose robotPose, Transformation2D transformation);
00050
00051 static Point2D polarToCartesian(float theta, float distance);
00052
00061 static Vector3D sphericalToCartesian(float range, float phi, float theta);
00062
00070 static Vector3D sphericalPlaneToWorldCoordRad(float range, float h, float theta_rad, float phi_rad);
00071 static Vector3D sphericalPlaneToWorldCoordDeg(float range, float h, float theta_deg, float phi_deg){
00072 return sphericalPlaneToWorldCoordRad(range, h, (theta_deg*M_PI/180.0), (phi_deg*M_PI/180.0));
00073 }
00074
00078 static Vector3D simLaser3DToLaser3D(float alpha, float beta, float range);
00079
00084 static std::vector<Vector3D> simLaser3DToLaser3D(float fovH, float fovV, float resH, float resH2, std::vector<float>* range);
00085
00086
00087
00089 static CoordinateConverter* getInstance();
00090
00091 void robotToMap(float robotX, float robotY, float robotTheta, float pointX, float pointY, int& mapX, int& mapY);
00092 Pixel robotToMap(Pose robotPose, Point2D robotPoint);
00093 std::vector<Pixel> robotToMap(Pose robotPose, const std::vector<Point2D>& robotPoints);
00094 Pixel worldToMap(Point2D worldPoint);
00095 Point2D worldToMapPoint(Point2D worldPoint);
00096 Pixel worldToMap(Pose worldPose);
00097 void worldToMap(float worldX, float worldY, int& mapX, int& mapY);
00098 std::vector<Pixel> worldToMap( const std::vector<Point2D>& worldPoints);
00099 Point2D mapToWorld(Pixel mapPoint);
00100 std::vector<Point2D> mapToWorld( const std::vector<Pixel>& mapPoints );
00101
00102 private:
00103
00107 CoordinateConverter();
00108
00112 static CoordinateConverter* m_Instance;
00113
00114
00115 float m_CellSize;
00116 float m_MapWidth;
00117 float m_MapHeight;
00118 float m_MapHalfWidth;
00119 float m_MapHalfHeight;
00120
00121 };
00122
00123 #endif