加载中...
搜索中...
无匹配项
最近点

计算几何体之间最近点的API。更多...

文件

文件  nearest_points.hpp
 
文件  nearest_points.cuh
 

结构体  cuspatial::point_linestring_nearest_points_result
 pairwise_point_linestring_nearest_points 的结果容器。更多...
 

函数

point_linestring_nearest_points_result cuspatial::pairwise_point_linestring_nearest_points (std::optional< cudf::device_span< cudf::size_type const > > multipoint_geometry_offsets, cudf::column_view points_xy, std::optional< cudf::device_span< cudf::size_type const > > multilinestring_geometry_offsets, cudf::device_span< cudf::size_type const > linestring_part_offsets, cudf::column_view linestring_points_xy, rmm::device_async_resource_ref mr=rmm::mr::get_current_device_resource())
 计算(多)点和(多)线串对之间的最近点和几何体ID。
 

详细描述

计算几何体之间最近点的API。

函数文档

◆ pairwise_point_linestring_nearest_points()

point_linestring_nearest_points_result cuspatial::pairwise_point_linestring_nearest_points ( std::optional< cudf::device_span< cudf::size_type const > > multipoint_geometry_offsets,
cudf::column_view points_xy,
std::optional< cudf::device_span< cudf::size_type const > > multilinestring_geometry_offsets,
cudf::device_span< cudf::size_type const > linestring_part_offsets,
cudf::column_view linestring_points_xy,
rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource() )

计算(多)点和(多)线串对之间的最近点和几何体ID。

测试点到线串的最近点是线串上的一个点,与线串上的其他点相比,该点到测试点的距离最短。

测试多点到多线串的最近点是多线串中的一个点,该点在所有点和线串对中具有最短距离。

返回一个包含列的结构体,其中包含(对于每一对)(多)点中最近点的ID、(多)线串中线串的ID、线串中线段的ID以及(多)线串上最近点的坐标。详情请参阅 point_linestring_nearest_points_result

下面的示例计算了从2个点到2个线串的最近点

第一对
点: (0.0, 0.0)
线串: (1.0, -1.0) -> (1.0, 0.0) -> (0.0, 1.0)
线串中最近线段的ID: 1
线串上最近点的坐标: (0.5, 0.5)
第二对
点: (1.0, 2.0)
线串: (0.0, 0.0) -> (3.0, 1.0) -> (3.9, 4) -> (5.5, 1.2)
线串中最近线段的ID: 0
线串上最近点的坐标: (1.5, 0.5)
输入
multipoint_parts_offsets: std::nullopt
points_xy: {0.0, 0.0, 1.0, 2.0}
multilinestring_parts_offsets: std::nullopt
linestring_offsets: {0, 3, 7}
linestring_points_xy: {1, -1, 1, 0, 0, 1, 0, 0, 3, 1, 3.9, 4, 5.5, 1.2}
输出
std::nullopt,
std::nullopt,
{1, 0},
{0.5, 0.5, 1.5, 0.5}
}
一个通用线段类型。
pairwise_point_linestring_nearest_points 的结果容器

下面的示例计算了从3个多点到3个多线串的最近点

第一对
多点: {(1.1, 3.0), (3.6, 2.4)}
多线串: {(2.1, 3.14) -> (8.4, -0.5) -> (6.0, 1.4), (-1.0, 0.0) -> (-1.7, 0.83)}
多点中最近点的ID: 1
多线串中最近线串的ID: 0
线串中最近线段的ID: 0
线串上最近点的坐标: (3.54513, 2.30503)
第二对
多点: {(10.0, 15.0)}
多线串: {(20.14, 13.5) -> (18.3, 14.3), (8.34, 9.1) -> (9.9, 9.4)}
多点中最近点的ID: 0
多线串中最近线串的ID: 1
线串中最近线段的ID: 0
线串中最近点的坐标: (9.9, 9.4)
第三对
多点: {(-5.0, -8.7), (-6.28, -7.0), (-10.0, -10.0)}
多线串: {(-20.0, 0.0) -> (-15.0, -15.0) -> (0.0, -18.0) -> (0.0, 0.0)}
多点中最近点的ID: 0
多线串中最近线串的ID: 0
线串中最近线段的ID: 2
线串中最近点的坐标: (0.0, -8.7)
输入
multipoint_parts_offsets: {0, 2, 3, 6}
points_xy: {1.1, 3.0, 3.6, 2.4, 10.0, 15.0, -5.0, -8.7, -6.28, -7.0, -10.0, -10.0}
multilinestring_parts_offsets: {0, 2, 4, 5}
linestring_offsets: {0, 3, 5, 7, 9, 13}
linestring_points_xy: {
2.1, 3.14, 8.4, -0.5, 6.0, 1.4, -1.0, 0.0,
-1.7, 0.83, 20.14, 13.5, 18.3, 14.3, 8.34, 9.1,
9.9, 9.4, -20.0, 0.0, -15.0, -15.0, 0.0, -18.0,
0.0, 0.0
}
输出
{1, 0, 0},
{0, 1, 0},
{0, 0, 2},
{3.545131432802666, 2.30503517215846, 9.9, 9.4, 0.0, -8.7}
}
参数
multipoint_geometry_offsets每个多点的起始和结束索引
points_xy点的交错 x, y 坐标
multilinestring_geometry_offsets每个多线串的起始和结束索引
linestring_part_offsets每个线串的起始和结束索引
linestring_points_xy线串点的交错 x, y 坐标
mr用于分配返回列的设备内存资源。
返回值
point_linestring_nearest_points_result
异常
cuspatial::logic_error如果 points_xylinestring_points_xy 包含奇数个坐标。
cuspatial::logic_error如果 points_xylinestring_points_xy 不是浮点类型。
cuspatial::logic_error如果(多)点数量与(多)线串数量不匹配。
cuspatial::logic_error如果 point_xylinestring_points_xy 的类型不匹配。
cuspatial::logic_error如果 point_xylinestring_points_xy 中的任何一个包含 null。