Develop and Download Open Source Software

Browse Subversion Repository

Contents of /rangesCtrl/ConvertToGrid.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 279 - (show annotations) (download) (as text)
Wed Mar 12 05:28:19 2008 UTC (16 years, 1 month ago) by satofumi
File MIME type: text/x-c++src
File size: 867 byte(s)
adjust tab index
1 /*!
2 \file
3 \brief ‹——Łƒf[ƒ^‚Ě X-Y •˝–Ę“WŠJ
4
5 \author Satofumi KAMIMURA
6
7 $Id$
8 */
9
10 #include "ConvertToGrid.h"
11 #include "RangeSensorInterface.h"
12 #include "MathUtils.h"
13
14
15 void beego::convertToGrid(std::vector<Grid<int> >& points, long data[],
16 size_t size, const RangeSensorInterface* ranges,
17 const Position<int>& offset) {
18
19 long min_length = ranges->getMinDistance();
20 long max_length = ranges->getMaxDistance();
21 Grid<int> p;
22 for (size_t i = 0; i < size; ++i) {
23 long length = data[i];
24 if ((length < min_length) || (length > max_length)) {
25 continue;
26 }
27 // “_‚Ě“o˜^
28 double radian = ranges->index2rad(i) - offset.angle.to_rad();
29 p.x = static_cast<int>(length * cos(radian)) + offset.x;
30 p.y = static_cast<int>(length * sin(radian)) + offset.y;
31
32 points.push_back(p);
33 }
34 }

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26