feat: 添加点云大小的接口和根据索引的访问接口
parent
6e858135ce
commit
44a47e6541
|
@ -17,6 +17,12 @@ void reserve_pointcloud_xyz(void* cloud, int count);
|
|||
void set_point_xyz(void* cloud, int index, float x, float y, float z);
|
||||
void set_point_xyzi(void* cloud, int index, float x, float y, float z, float intensity);
|
||||
void delete_pointcloud(void* cloud);
|
||||
// 统一接口:获取点数量
|
||||
int get_pointcloud_size(void* cloud);
|
||||
// 读取 PointXYZ
|
||||
bool get_point_xyz(void* cloud, int index, float* x, float* y, float* z);
|
||||
// 读取 PointXYZI
|
||||
bool get_point_xyzi(void* cloud, int index, float* x, float* y, float* z, float* intensity);
|
||||
|
||||
// ========== Voxel Filter ==========
|
||||
|
||||
|
|
26
wrapper.cpp
26
wrapper.cpp
|
@ -40,6 +40,32 @@ void delete_pointcloud(void* cloud) {
|
|||
delete static_cast<PointCloudXYZ*>(cloud); // 可根据类型再区分
|
||||
}
|
||||
|
||||
int get_pointcloud_size(void* cloud) {
|
||||
auto* pc = static_cast<PointCloudXYZ*>(cloud);
|
||||
return static_cast<int>(pc->cloud->size());
|
||||
}
|
||||
|
||||
bool get_point_xyz(void* cloud, int index, float* x, float* y, float* z) {
|
||||
auto* pc = static_cast<PointCloudXYZ*>(cloud);
|
||||
if (index < 0 || index >= pc->cloud->size()) return false;
|
||||
const auto& pt = (*pc->cloud)[index];
|
||||
*x = pt.x;
|
||||
*y = pt.y;
|
||||
*z = pt.z;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool get_point_xyzi(void* cloud, int index, float* x, float* y, float* z, float* intensity) {
|
||||
auto* pc = static_cast<PointCloudXYZI*>(cloud);
|
||||
if (index < 0 || index >= pc->cloud->size()) return false;
|
||||
const auto& pt = (*pc->cloud)[index];
|
||||
*x = pt.x;
|
||||
*y = pt.y;
|
||||
*z = pt.z;
|
||||
*intensity = pt.intensity;
|
||||
return true;
|
||||
}
|
||||
|
||||
// === 滤波器相关 ===
|
||||
|
||||
void* create_voxel_filter_xyz() {
|
||||
|
|
Loading…
Reference in New Issue