Go to the documentation of this file.00001 #include "SphericalCameraModel.hpp"
00002
00003 namespace virtual_camera {
00004
00005
00006 std::string SphericalCameraModel::getIndentifier() {
00007 return "spherical";
00008 }
00009
00010
00011 TableV3Ptr SphericalCameraModel::createPointCloud(
00012 const VirtualCameraParametersPtr & params) {
00013 const int & width = params->viewportWidth;
00014 const int & height = params->viewportHeight;
00015 const double & radius = params->approxDistance;
00016 TableV3Ptr ret = TableV3Ptr(new TableV3(boost::extents[height][width]));
00017 double verStep = boost::math::constants::pi<double>()/height;
00018 double verStart = -0.5*boost::math::constants::pi<double>();
00019 double horStep = 2*boost::math::constants::pi<double>()/width;
00020 double horStart = 1.5*boost::math::constants::pi<double>();
00021 for (int y=0; y<height; y++) {
00022 double cosVer = std::cos(verStart+y*verStep);
00023 double sinVer = std::sin(verStart+y*verStep);
00024 for (int x=0; x<width; x++) {
00025 tf::Vector3 & pt = (*(ret))[y][x];
00026 pt[0] = radius*std::cos(horStart-x*horStep)*cosVer;
00027 pt[1] = radius*sinVer;
00028 pt[2] = radius*std::sin(horStart-x*horStep)*cosVer;
00029 }
00030 }
00031 return ret;
00032 }
00033
00034
00035 }
00036