本文整理汇总了C++中Array1::accessor方法的典型用法代码示例。如果您正苦于以下问题:C++ Array1::accessor方法的具体用法?C++ Array1::accessor怎么用?C++ Array1::accessor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Array1
的用法示例。
在下文中一共展示了Array1::accessor方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: searcher
TEST(PointParallelHashGridSearcher3, Serialization) {
Array1<Vector3D> points = {
Vector3D(0, 1, 3),
Vector3D(2, 5, 4),
Vector3D(-1, 3, 0)
};
PointParallelHashGridSearcher3 searcher(4, 4, 4, std::sqrt(10));
searcher.build(points.accessor());
std::vector<uint8_t> buffer;
searcher.serialize(&buffer);
PointParallelHashGridSearcher3 searcher2(1, 1, 1, 1.0);
searcher2.deserialize(buffer);
int cnt = 0;
searcher2.forEachNearbyPoint(
Vector3D(0, 0, 0),
std::sqrt(10.0),
[&](size_t i, const Vector3D& pt) {
EXPECT_TRUE(i == 0 || i == 2);
if (i == 0) {
EXPECT_EQ(points[0], pt);
} else if (i == 2) {
EXPECT_EQ(points[2], pt);
}
++cnt;
});
EXPECT_EQ(2, cnt);
}
示例2: if
TEST(PointSimpleListSearcher3, ForEachNearbyPoint) {
Array1<Vector3D> points = {
Vector3D(0, 1, 3),
Vector3D(2, 5, 4),
Vector3D(-1, 3, 0)
};
PointSimpleListSearcher3 searcher;
searcher.build(points.accessor());
int cnt = 0;
searcher.forEachNearbyPoint(
Vector3D(0, 0, 0),
std::sqrt(10.0),
[&](size_t i, const Vector3D& pt) {
EXPECT_TRUE(i == 0 || i == 2);
if (i == 0) {
EXPECT_EQ(points[0], pt);
} else if (i == 2) {
EXPECT_EQ(points[2], pt);
}
++cnt;
});
EXPECT_EQ(2, cnt);
}
示例3:
TEST(PointKdTreeSearcher3, ForEachNearbyPointEmpty) {
Array1<Vector3D> points;
PointKdTreeSearcher3 searcher;
searcher.build(points.accessor());
searcher.forEachNearbyPoint(Vector3D(0, 0, 0), std::sqrt(10.0),
[](size_t, const Vector3D&) {});
}