-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathtest_geo_reference.cpp
More file actions
75 lines (59 loc) · 2.7 KB
/
test_geo_reference.cpp
File metadata and controls
75 lines (59 loc) · 2.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#include <gtest/gtest.h>
#include <plateau/geometry/geo_coordinate.h>
#include <plateau/geometry/geo_reference.h>
#include "../src/geometry/polar_to_plane_cartesian.cpp"
namespace plateau::geometry {
class GeoReferenceTest : public ::testing::Test {
protected:
void SetUp() override {
}
void TearDown() override {
}
// テスト設定
int zone_id = 9;
TVec3d ref_point = TVec3d(0, 0, 0);
float unit_scale = 1.0;
CoordinateSystem coordinate = CoordinateSystem::EUN;
GeoReference ref = GeoReference(zone_id, ref_point, unit_scale, coordinate);
TVec3d base_point = TVec3d(100, 100, 0);
};
TEST_F(GeoReferenceTest, ConvertAxisProject) { // NOLINT
// 平面直角座標変換・座標軸変換を行う
TVec3d converted = ref.convert(base_point, true, true);
TVec3d projected = ref.project(base_point);
// Expected
TVec3d position = base_point;
PolarToPlaneCartesian().project(position, zone_id);
TVec3 expected_point = GeoReference::convertAxisFromENUTo(coordinate, position);
expected_point = expected_point / unit_scale - ref_point;
ASSERT_EQ(expected_point, converted);
ASSERT_EQ(expected_point, projected);
}
TEST_F(GeoReferenceTest, ConvertProjectOnly) { // NOLINT
// 平面直角座標変換を行う・座標軸変換を行わない
TVec3d converted = ref.convert(base_point, false, true);
TVec3d projected = ref.projectWithoutAxisConvert(base_point);
// Expected
TVec3d position = base_point;
PolarToPlaneCartesian().project(position, zone_id);
TVec3 expected_point = position / unit_scale - GeoReference::convertAxisToENU(coordinate, ref_point);
ASSERT_EQ(expected_point, converted);
ASSERT_EQ(expected_point, projected);
}
TEST_F(GeoReferenceTest, ConvertAxisOnly) { // NOLINT
// 平面直角座標変換を行わない・座標軸変換を行う
TVec3d point = ref.convert(base_point, true, false);
// Expected
TVec3 expected_point = GeoReference::convertAxisFromENUTo(coordinate, base_point);
expected_point = expected_point / unit_scale - ref_point;
ASSERT_EQ(expected_point, point);
}
TEST_F(GeoReferenceTest, ConvertOnly) { // NOLINT
// 平面直角座標変換・座標軸変換を行わない
TVec3d point = ref.convert(base_point, false, false);
// Expected
TVec3 expected_point = base_point / unit_scale - GeoReference::convertAxisToENU(coordinate, ref_point);
ASSERT_EQ(expected_point, point);
}
// fetch のテストは test_dataset.cpp にあります。
}