Apollo 11.0
自动驾驶开放平台
apollo::common::math::AABoxKDTree2d< ObjectType > 模板类 参考

The class of KD-tree of Aligned Axis Bounding Box(AABox). 更多...

#include <aaboxkdtree2d.h>

apollo::common::math::AABoxKDTree2d< ObjectType > 的协作图:

Public 类型

using ObjectPtr = const ObjectType *
 

Public 成员函数

 AABoxKDTree2d (const std::vector< ObjectType > &objects, const AABoxKDTreeParams &params)
 Constructor which takes a vector of objects and parameters.
 
ObjectPtr GetNearestObject (const Vec2d &point) const
 Get the nearest object to a target point.
 
std::vector< ObjectPtr > GetObjects (const Vec2d &point, const double distance) const
 Get objects within a distance to a point.
 
AABox2d GetBoundingBox () const
 Get the axis-aligned bounding box of the objects.
 

详细描述

template<class ObjectType>
class apollo::common::math::AABoxKDTree2d< ObjectType >

The class of KD-tree of Aligned Axis Bounding Box(AABox).

在文件 aaboxkdtree2d.h 第 415 行定义.

成员类型定义说明

◆ ObjectPtr

template<class ObjectType >
using apollo::common::math::AABoxKDTree2d< ObjectType >::ObjectPtr = const ObjectType *

在文件 aaboxkdtree2d.h 第 417 行定义.

构造及析构函数说明

◆ AABoxKDTree2d()

template<class ObjectType >
apollo::common::math::AABoxKDTree2d< ObjectType >::AABoxKDTree2d ( const std::vector< ObjectType > &  objects,
const AABoxKDTreeParams &  params 
)
inline

Constructor which takes a vector of objects and parameters.

参数
paramsParameters to build the KD-tree.

在文件 aaboxkdtree2d.h 第 423 行定义.

424 {
425 if (!objects.empty()) {
426 std::vector<ObjectPtr> object_ptrs;
427 for (const auto &object : objects) {
428 object_ptrs.push_back(&object);
429 }
430 root_.reset(new AABoxKDTree2dNode<ObjectType>(object_ptrs, params, 0));
431 }
432 }

成员函数说明

◆ GetBoundingBox()

template<class ObjectType >
AABox2d apollo::common::math::AABoxKDTree2d< ObjectType >::GetBoundingBox ( ) const
inline

Get the axis-aligned bounding box of the objects.

返回
The axis-aligned bounding box of the objects.

在文件 aaboxkdtree2d.h 第 461 行定义.

461 {
462 return root_ == nullptr ? AABox2d() : root_->GetBoundingBox();
463 }
AABox2d GetBoundingBox() const
Get the axis-aligned bounding box of the objects.

◆ GetNearestObject()

template<class ObjectType >
ObjectPtr apollo::common::math::AABoxKDTree2d< ObjectType >::GetNearestObject ( const Vec2d &  point) const
inline

Get the nearest object to a target point.

参数
pointThe target point. Search it's nearest object.
返回
The nearest object to the target point.

在文件 aaboxkdtree2d.h 第 439 行定义.

439 {
440 return root_ == nullptr ? nullptr : root_->GetNearestObject(point);
441 }

◆ GetObjects()

template<class ObjectType >
std::vector< ObjectPtr > apollo::common::math::AABoxKDTree2d< ObjectType >::GetObjects ( const Vec2d &  point,
const double  distance 
) const
inline

Get objects within a distance to a point.

参数
pointThe center point of the range to search objects.
distanceThe radius of the range to search objects.
返回
All objects within the specified distance to the specified point.

在文件 aaboxkdtree2d.h 第 449 行定义.

450 {
451 if (root_ == nullptr) {
452 return {};
453 }
454 return root_->GetObjects(point, distance);
455 }

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