@@ -30,19 +30,36 @@ namespace {
30
30
if (extent.contains (city_obj))
31
31
return false ;
32
32
}
33
-
34
33
return true ;
35
34
}
36
35
36
+ // / extentsの幅と奥行きの長さを multiplier 倍にします。
37
+ std::vector<geometry::Extent> extendExtents (const std::vector<geometry::Extent>& src_extents, float multiplier) {
38
+ auto result = std::vector<geometry::Extent>();
39
+
40
+ for (const auto & src_extent : src_extents) {
41
+ const auto center = src_extent.centerPoint ();
42
+ const auto prev_min = src_extent.min ;
43
+ const auto prev_max = src_extent.max ;
44
+ auto next_min = center + (prev_min - center) * multiplier;
45
+ auto next_max = center + (prev_max - center) * multiplier;
46
+ result.emplace_back (next_min, next_max);
47
+ }
48
+ return result;
49
+ }
50
+
37
51
void extractInner (
38
52
Model& out_model, const CityModel& city_model,
39
53
const MeshExtractOptions& options,
40
- const std::vector<geometry::Extent>& extents ) {
54
+ const std::vector<geometry::Extent>& extents_before_adjust ) {
41
55
42
56
if (options.max_lod < options.min_lod ) throw std::logic_error (" Invalid LOD range." );
43
57
44
58
const auto geo_reference = geometry::GeoReference (options.coordinate_zone_id , options.reference_point , options.unit_scale , options.mesh_axes );
45
59
60
+ // 範囲の境界上にある地物を取り逃さないように、範囲を少し広げます。
61
+ auto extents = extendExtents (extents_before_adjust, 1 .2f );
62
+
46
63
// rootNode として LODノード を作ります。
47
64
for (unsigned lod = options.min_lod ; lod <= options.max_lod ; lod++) {
48
65
auto lod_node = Node (" LOD" + std::to_string (lod));
@@ -188,7 +205,6 @@ namespace plateau::polygonMesh {
188
205
const MeshExtractOptions& options,
189
206
const std::vector<plateau::geometry::Extent>& extents) {
190
207
191
-
192
208
extractInner (out_model, city_model, options, extents);
193
209
}
194
210
0 commit comments