BasicCylinderCameraModel.cpp
Go to the documentation of this file.
00001 #include "BasicCylinderCameraModel.hpp"
00002 
00003 namespace virtual_camera {
00004 
00005 
00006 std::string BasicCylinderCameraModel::getIndentifier() {
00007         return "cylindric";
00008 }
00009 
00010 
00011 TableV3Ptr BasicCylinderCameraModel::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 vFovRad = angles::from_degrees(params->verticalFov);
00018         double vLength = 2*radius*std::tan(vFovRad/2);
00019         double vStep = vLength/height;
00020         double angStep = 2*boost::math::constants::pi<double>()/width;
00021         double angStart = 1.5*boost::math::constants::pi<double>();
00022         for (int y=0; y<height; y++) {
00023                 double yPos = (y-height/2)*vStep;
00024                 for (int x=0; x<width; x++) {
00025                         tf::Vector3 & pt = (*(ret))[y][x];
00026                         pt[0] = radius*std::cos(angStart-x*angStep);
00027                         pt[1] = yPos;
00028                         pt[2] = radius*std::sin(angStart-x*angStep);
00029                 }
00030         }
00031         return ret;
00032 }
00033 
00034 
00035 }
00036 
00037 
00038 
 All Classes Namespaces Files Functions Variables Typedefs Defines


virtual_camera
Author(s): Jan Brabec; maintained by Tomas Petricek / petrito1@cmp.felk.cvut
autogenerated on Tue Dec 10 2013 14:58:11