Apollo 11.0
自动驾驶开放平台
apollo::perception::algorithm::VoxelGridXYPyramid< DATA_TYPE > 模板类 参考

#include <i_struct_s.h>

apollo::perception::algorithm::VoxelGridXYPyramid< DATA_TYPE > 的协作图:

Public 成员函数

 VoxelGridXYPyramid ()
 
 VoxelGridXYPyramid (unsigned int nr_scale, unsigned int nr_voxel_x_base, unsigned int nr_voxel_y_base, unsigned int dsf_x, unsigned int dsf_y, DATA_TYPE spatial_bound_x_min, DATA_TYPE spatial_bound_x_max, DATA_TYPE spatial_bound_y_min, DATA_TYPE spatial_bound_y_max, DATA_TYPE spatial_bound_z_min, DATA_TYPE spatial_bound_z_max)
 
void CleanUp ()
 
 ~VoxelGridXYPyramid ()
 
bool Alloc (unsigned int nr_scale, unsigned int nr_voxel_x_base, unsigned int nr_voxel_y_base, unsigned int dsf_x, unsigned int dsf_y, DATA_TYPE spatial_bound_x_min, DATA_TYPE spatial_bound_x_max, DATA_TYPE spatial_bound_y_min, DATA_TYPE spatial_bound_y_max, DATA_TYPE spatial_bound_z_min, DATA_TYPE spatial_bound_z_max)
 
bool Set (const DATA_TYPE *pc, unsigned int nr_points, unsigned int nr_point_element)
 
bool SetS (const float *pc, unsigned int nr_points, unsigned int nr_point_element)
 
bool Set (const DATA_TYPE *pc, unsigned int nr_scale, unsigned int nr_points, unsigned int nr_point_element, unsigned int nr_voxel_x_base, unsigned int nr_voxel_y_base, unsigned int dsf_x, unsigned int dsf_y, DATA_TYPE spatial_bound_x_min, DATA_TYPE spatial_bound_x_max, DATA_TYPE spatial_bound_y_min, DATA_TYPE spatial_bound_y_max, DATA_TYPE spatial_bound_z_min, DATA_TYPE spatial_bound_z_max)
 
unsigned int NrScale () const
 
unsigned int NrVoxel (unsigned int i=0) const
 
unsigned int NrVoxelX (unsigned int i=0) const
 
unsigned int NrVoxelY (unsigned int i=0) const
 
unsigned int NrVoxelZ (unsigned int i=0) const
 
unsigned int NrPoints (unsigned int scale) const
 
unsigned int NrPoints () const
 
unsigned int NrPointElement () const
 
bool Initialized () const
 
unsigned int GetDsfX () const
 
unsigned int GetDsfY () const
 
unsigned int GetDsfZ () const
 
VoxelGridXY< DATA_TYPE > & operator[] (unsigned int i)
 
const VoxelGridXY< DATA_TYPE > & operator[] (unsigned int i) const
 
VoxelGridXY< DATA_TYPE > & operator[] (int i)
 
const VoxelGridXY< DATA_TYPE > & operator[] (int i) const
 
const DATA_TYPE * ConstData () const
 
DATA_TYPE * Data ()
 

详细描述

template<typename DATA_TYPE>
class apollo::perception::algorithm::VoxelGridXYPyramid< DATA_TYPE >

在文件 i_struct_s.h 第 1202 行定义.

构造及析构函数说明

◆ VoxelGridXYPyramid() [1/2]

template<typename DATA_TYPE >
apollo::perception::algorithm::VoxelGridXYPyramid< DATA_TYPE >::VoxelGridXYPyramid ( )

在文件 i_struct_s.h 第 1309 行定义.

1310 : pc_(nullptr),
1311 nr_points_(0),
1312 nr_point_element_(0),
1313 dsf_x_(0),
1314 dsf_y_(0),
1315 dsf_z_(0) {}

◆ VoxelGridXYPyramid() [2/2]

template<typename DATA_TYPE >
apollo::perception::algorithm::VoxelGridXYPyramid< DATA_TYPE >::VoxelGridXYPyramid ( unsigned int  nr_scale,
unsigned int  nr_voxel_x_base,
unsigned int  nr_voxel_y_base,
unsigned int  dsf_x,
unsigned int  dsf_y,
DATA_TYPE  spatial_bound_x_min,
DATA_TYPE  spatial_bound_x_max,
DATA_TYPE  spatial_bound_y_min,
DATA_TYPE  spatial_bound_y_max,
DATA_TYPE  spatial_bound_z_min,
DATA_TYPE  spatial_bound_z_max 
)
inline

在文件 i_struct_s.h 第 1205 行定义.

1212 {
1213 Alloc(nr_scale, nr_voxel_x_base, nr_voxel_y_base, dsf_x, dsf_y,
1214 spatial_bound_x_min, spatial_bound_x_max, spatial_bound_y_min,
1215 spatial_bound_y_max, spatial_bound_z_min, spatial_bound_z_max);
1216 }
bool Alloc(unsigned int nr_scale, unsigned int nr_voxel_x_base, unsigned int nr_voxel_y_base, unsigned int dsf_x, unsigned int dsf_y, DATA_TYPE spatial_bound_x_min, DATA_TYPE spatial_bound_x_max, DATA_TYPE spatial_bound_y_min, DATA_TYPE spatial_bound_y_max, DATA_TYPE spatial_bound_z_min, DATA_TYPE spatial_bound_z_max)

◆ ~VoxelGridXYPyramid()

template<typename DATA_TYPE >
apollo::perception::algorithm::VoxelGridXYPyramid< DATA_TYPE >::~VoxelGridXYPyramid ( )
inline

在文件 i_struct_s.h 第 1220 行定义.

成员函数说明

◆ Alloc()

template<typename DATA_TYPE >
bool apollo::perception::algorithm::VoxelGridXYPyramid< DATA_TYPE >::Alloc ( unsigned int  nr_scale,
unsigned int  nr_voxel_x_base,
unsigned int  nr_voxel_y_base,
unsigned int  dsf_x,
unsigned int  dsf_y,
DATA_TYPE  spatial_bound_x_min,
DATA_TYPE  spatial_bound_x_max,
DATA_TYPE  spatial_bound_y_min,
DATA_TYPE  spatial_bound_y_max,
DATA_TYPE  spatial_bound_z_min,
DATA_TYPE  spatial_bound_z_max 
)

在文件 i_struct_s.h 第 1318 行定义.

1323 {
1324 if (!nr_scale || !nr_voxel_x_base || !nr_voxel_y_base) {
1325 return false;
1326 }
1327
1328 unsigned int scale;
1329 unsigned int nr_voxel_x = nr_voxel_x_base;
1330 unsigned int nr_voxel_y = nr_voxel_y_base;
1331 unsigned int sf_x = (unsigned int)IPow((unsigned int)2, dsf_x);
1332 unsigned int sf_y = (unsigned int)IPow((unsigned int)2, dsf_y);
1333
1334 dsf_x_ = dsf_x;
1335 dsf_y_ = dsf_y;
1336 dsf_z_ = 0;
1337
1338 vgrids_.clear();
1339 vgrids_.resize(nr_scale);
1340
1341 for (scale = 0; scale < nr_scale; ++scale) {
1342 if (!vgrids_[scale].alloc(nr_voxel_x, nr_voxel_y, spatial_bound_x_min,
1343 spatial_bound_x_max, spatial_bound_y_min,
1344 spatial_bound_y_max, spatial_bound_z_min,
1345 spatial_bound_z_max)) {
1346 break;
1347 }
1348 nr_voxel_x /= sf_x;
1349 nr_voxel_y /= sf_y;
1350 }
1351
1352 if (scale == 0) {
1353 vgrids_.clear();
1354 return false;
1355 } else {
1356 if (scale != nr_scale) {
1357 vgrids_.resize(scale);
1358 }
1359 }
1360
1361 return (true);
1362}
float IPow(float a, float b)
Definition i_basic.h:142

◆ CleanUp()

template<typename DATA_TYPE >
void apollo::perception::algorithm::VoxelGridXYPyramid< DATA_TYPE >::CleanUp ( )

在文件 i_struct_s.h 第 1470 行定义.

1470 {
1471 pc_ = nullptr;
1472 vgrids_.clear();
1473 nr_points_ = nr_point_element_ = dsf_x_ = dsf_y_ = dsf_z_ = 0;
1474}

◆ ConstData()

template<typename DATA_TYPE >
const DATA_TYPE * apollo::perception::algorithm::VoxelGridXYPyramid< DATA_TYPE >::ConstData ( ) const
inline

在文件 i_struct_s.h 第 1297 行定义.

1297{ return pc_; }

◆ Data()

template<typename DATA_TYPE >
DATA_TYPE * apollo::perception::algorithm::VoxelGridXYPyramid< DATA_TYPE >::Data ( )
inline

在文件 i_struct_s.h 第 1299 行定义.

1299{ return pc_; }

◆ GetDsfX()

template<typename DATA_TYPE >
unsigned int apollo::perception::algorithm::VoxelGridXYPyramid< DATA_TYPE >::GetDsfX ( ) const
inline

在文件 i_struct_s.h 第 1273 行定义.

1273{ return dsf_x_; }

◆ GetDsfY()

template<typename DATA_TYPE >
unsigned int apollo::perception::algorithm::VoxelGridXYPyramid< DATA_TYPE >::GetDsfY ( ) const
inline

在文件 i_struct_s.h 第 1274 行定义.

1274{ return dsf_y_; }

◆ GetDsfZ()

template<typename DATA_TYPE >
unsigned int apollo::perception::algorithm::VoxelGridXYPyramid< DATA_TYPE >::GetDsfZ ( ) const
inline

在文件 i_struct_s.h 第 1275 行定义.

1275{ return (0); }

◆ Initialized()

template<typename DATA_TYPE >
bool apollo::perception::algorithm::VoxelGridXYPyramid< DATA_TYPE >::Initialized ( ) const

在文件 i_struct_s.h 第 1477 行定义.

1477 {
1478 unsigned int i;
1479 if (vgrids_.empty()) {
1480 return false;
1481 }
1482 for (i = 0; i < vgrids_.size(); ++i) {
1483 if (!vgrids_[i].initialized()) {
1484 break;
1485 }
1486 }
1487 return (i == vgrids_.size());
1488}

◆ NrPointElement()

template<typename DATA_TYPE >
unsigned int apollo::perception::algorithm::VoxelGridXYPyramid< DATA_TYPE >::NrPointElement ( ) const
inline

在文件 i_struct_s.h 第 1269 行定义.

1269{ return nr_point_element_; }

◆ NrPoints() [1/2]

template<typename DATA_TYPE >
unsigned int apollo::perception::algorithm::VoxelGridXYPyramid< DATA_TYPE >::NrPoints ( ) const
inline

在文件 i_struct_s.h 第 1267 行定义.

1267{ return nr_points_; }

◆ NrPoints() [2/2]

template<typename DATA_TYPE >
unsigned int apollo::perception::algorithm::VoxelGridXYPyramid< DATA_TYPE >::NrPoints ( unsigned int  scale) const
inline

在文件 i_struct_s.h 第 1263 行定义.

1263 {
1264 return (scale < vgrids_.size()) ? vgrids_[scale].nr_points() : 0;
1265 }

◆ NrScale()

template<typename DATA_TYPE >
unsigned int apollo::perception::algorithm::VoxelGridXYPyramid< DATA_TYPE >::NrScale ( ) const
inline

在文件 i_struct_s.h 第 1245 行定义.

1245{ return (unsigned int)vgrids_.size(); }

◆ NrVoxel()

template<typename DATA_TYPE >
unsigned int apollo::perception::algorithm::VoxelGridXYPyramid< DATA_TYPE >::NrVoxel ( unsigned int  i = 0) const
inline

在文件 i_struct_s.h 第 1247 行定义.

1247 {
1248 return (i < vgrids_.size()) ? vgrids_[i].nr_voxel() : 0;
1249 }

◆ NrVoxelX()

template<typename DATA_TYPE >
unsigned int apollo::perception::algorithm::VoxelGridXYPyramid< DATA_TYPE >::NrVoxelX ( unsigned int  i = 0) const
inline

在文件 i_struct_s.h 第 1251 行定义.

1251 {
1252 return (i < vgrids_.size()) ? vgrids_[i].nr_voxel_x() : 0;
1253 }

◆ NrVoxelY()

template<typename DATA_TYPE >
unsigned int apollo::perception::algorithm::VoxelGridXYPyramid< DATA_TYPE >::NrVoxelY ( unsigned int  i = 0) const
inline

在文件 i_struct_s.h 第 1255 行定义.

1255 {
1256 return (i < vgrids_.size()) ? vgrids_[i].nr_voxel_y() : 0;
1257 }

◆ NrVoxelZ()

template<typename DATA_TYPE >
unsigned int apollo::perception::algorithm::VoxelGridXYPyramid< DATA_TYPE >::NrVoxelZ ( unsigned int  i = 0) const
inline

在文件 i_struct_s.h 第 1259 行定义.

1259 {
1260 return (i < vgrids_.size()) ? vgrids_[i].nr_voxel_z() : 0;
1261 }

◆ operator[]() [1/4]

template<typename DATA_TYPE >
VoxelGridXY< DATA_TYPE > & apollo::perception::algorithm::VoxelGridXYPyramid< DATA_TYPE >::operator[] ( int  i)
inline

在文件 i_struct_s.h 第 1287 行定义.

1287 {
1288 assert(i >= 0 && i < static_cast<int>(vgrids_.size()));
1289 return vgrids_[i];
1290 }

◆ operator[]() [2/4]

template<typename DATA_TYPE >
const VoxelGridXY< DATA_TYPE > & apollo::perception::algorithm::VoxelGridXYPyramid< DATA_TYPE >::operator[] ( int  i) const
inline

在文件 i_struct_s.h 第 1292 行定义.

1292 {
1293 assert(i >= 0 && i < static_cast<int>(vgrids_.size()));
1294 return vgrids_[i];
1295 }

◆ operator[]() [3/4]

template<typename DATA_TYPE >
VoxelGridXY< DATA_TYPE > & apollo::perception::algorithm::VoxelGridXYPyramid< DATA_TYPE >::operator[] ( unsigned int  i)
inline

在文件 i_struct_s.h 第 1277 行定义.

1277 {
1278 assert(i >= 0 && i < vgrids_.size());
1279 return vgrids_[i];
1280 }

◆ operator[]() [4/4]

template<typename DATA_TYPE >
const VoxelGridXY< DATA_TYPE > & apollo::perception::algorithm::VoxelGridXYPyramid< DATA_TYPE >::operator[] ( unsigned int  i) const
inline

在文件 i_struct_s.h 第 1282 行定义.

1282 {
1283 assert(i >= 0 && i < vgrids_.size());
1284 return vgrids_[i];
1285 }

◆ Set() [1/2]

template<typename DATA_TYPE >
bool apollo::perception::algorithm::VoxelGridXYPyramid< DATA_TYPE >::Set ( const DATA_TYPE *  pc,
unsigned int  nr_points,
unsigned int  nr_point_element 
)

在文件 i_struct_s.h 第 1365 行定义.

1367 {
1368 if (!pc || !nr_points || !nr_point_element || vgrids_.empty()) {
1369 return false;
1370 }
1371
1372 unsigned int scale, nr_scale = (unsigned int)vgrids_.size();
1373
1374 pc_ = pc;
1375 nr_points_ = nr_points;
1376 nr_point_element_ = nr_point_element;
1377
1378 for (scale = 0; scale < nr_scale; ++scale) {
1379 if (!vgrids_[scale].set(pc, nr_points, nr_point_element)) {
1380 break;
1381 }
1382 }
1383
1384 // break in the middle - last (NrScale - s) grids are invalid
1385 if (scale < nr_scale) {
1386 vgrids_.resize(scale);
1387 }
1388
1389 return (vgrids_.size() == nr_scale);
1390}

◆ Set() [2/2]

template<typename DATA_TYPE >
bool apollo::perception::algorithm::VoxelGridXYPyramid< DATA_TYPE >::Set ( const DATA_TYPE *  pc,
unsigned int  nr_scale,
unsigned int  nr_points,
unsigned int  nr_point_element,
unsigned int  nr_voxel_x_base,
unsigned int  nr_voxel_y_base,
unsigned int  dsf_x,
unsigned int  dsf_y,
DATA_TYPE  spatial_bound_x_min,
DATA_TYPE  spatial_bound_x_max,
DATA_TYPE  spatial_bound_y_min,
DATA_TYPE  spatial_bound_y_max,
DATA_TYPE  spatial_bound_z_min,
DATA_TYPE  spatial_bound_z_max 
)

在文件 i_struct_s.h 第 1421 行定义.

1427 {
1428 if (!pc || !nr_scale || !nr_points || !nr_point_element || !nr_voxel_x_base ||
1429 !nr_voxel_y_base) {
1430 return false;
1431 }
1432
1433 unsigned int i, s;
1434 pc_ = pc;
1435 nr_points_ = nr_points;
1436 nr_point_element_ = nr_point_element;
1437
1438 dsf_x_ = dsf_x;
1439 dsf_y_ = dsf_y;
1440 dsf_z_ = 0;
1441
1442 vgrids_.clear();
1443 vgrids_.resize(nr_scale);
1444
1445 // Set the base level pyramid
1446 if (!vgrids_[0].set(pc_, nr_points, nr_point_element, nr_voxel_x_base,
1447 nr_voxel_y_base, spatial_bound_x_min, spatial_bound_x_max,
1448 spatial_bound_y_min, spatial_bound_y_max,
1449 spatial_bound_z_min, spatial_bound_z_max)) {
1450 vgrids_.clear();
1451 return false;
1452 }
1453
1454 for (s = 1; s < nr_scale; ++s) {
1455 if (!IDownsampleVoxelGridXY(vgrids_[s - 1], &vgrids_[s], dsf_x_, dsf_y_)) {
1456 break;
1457 }
1458 }
1459
1460 if (s < nr_scale) {
1461 for (i = 0; i < (nr_scale - s); ++i) {
1462 vgrids_.pop_back();
1463 }
1464 }
1465
1466 return (vgrids_.size() == nr_scale); // check if all scales are valid
1467}
bool IDownsampleVoxelGridXY(const VoxelGridXY< T > &src, VoxelGridXY< T > *dst, unsigned int dsf_dim_x, unsigned int dsf_dim_y)

◆ SetS()

template<typename DATA_TYPE >
bool apollo::perception::algorithm::VoxelGridXYPyramid< DATA_TYPE >::SetS ( const float *  pc,
unsigned int  nr_points,
unsigned int  nr_point_element 
)

在文件 i_struct_s.h 第 1393 行定义.

1395 {
1396 if (!pc || !nr_points || !nr_point_element || vgrids_.empty()) {
1397 return false;
1398 }
1399
1400 unsigned int scale, nr_scale = (unsigned int)vgrids_.size();
1401
1402 pc_ = pc;
1403 nr_points_ = nr_points;
1404 nr_point_element_ = nr_point_element;
1405
1406 for (scale = 0; scale < nr_scale; ++scale) {
1407 if (!vgrids_[scale].set_s(pc, nr_points, nr_point_element)) {
1408 break;
1409 }
1410 }
1411
1412 // break in the middle - last (NrScale - s) grids are invalid
1413 if (scale < nr_scale) {
1414 vgrids_.resize(scale);
1415 }
1416
1417 return (vgrids_.size() == nr_scale);
1418}

该类的文档由以下文件生成: