Skip to content

Commit e333402

Browse files
Merge pull request #1168 from Geode-solutions/feat/poly-tiff
feat(MeshHelpers): convert raster info grid
2 parents 01dd9e0 + 56ab597 commit e333402

29 files changed

+214
-36
lines changed

include/geode/geometry/point.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ namespace geode
7676
[[nodiscard]] std::string string() const;
7777

7878
[[nodiscard]] Point< dimension - 1 > project_point(
79-
geode::local_index_t axis_to_remove ) const;
79+
local_index_t axis_to_remove ) const;
8080

8181
private:
8282
friend class bitsery::Access;

include/geode/mesh/helpers/convert_edged_curve.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ namespace geode
3939
{
4040
[[nodiscard]] std::unique_ptr< EdgedCurve2D >
4141
opengeode_mesh_api convert_edged_curve3d_into_2d(
42-
const EdgedCurve3D& curve3d, index_t axis_to_remove );
42+
const EdgedCurve3D& curve3d, local_index_t axis_to_remove );
4343

4444
[[nodiscard]] std::unique_ptr< EdgedCurve3D > opengeode_mesh_api
4545
convert_edged_curve2d_into_3d( const EdgedCurve2D& curve2d,
46-
index_t axis_to_add,
46+
local_index_t axis_to_add,
4747
double axis_coordinate );
4848

4949
template < index_t dimension >
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*
2+
* Copyright (c) 2019 - 2025 Geode-solutions
3+
*
4+
* Permission is hereby granted, free of charge, to any person obtaining a copy
5+
* of this software and associated documentation files (the "Software"), to deal
6+
* in the Software without restriction, including without limitation the rights
7+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
* copies of the Software, and to permit persons to whom the Software is
9+
* furnished to do so, subject to the following conditions:
10+
*
11+
* The above copyright notice and this permission notice shall be included in
12+
* all copies or substantial portions of the Software.
13+
*
14+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20+
* SOFTWARE.
21+
*
22+
*/
23+
24+
#pragma once
25+
26+
#include <geode/mesh/common.hpp>
27+
28+
namespace geode
29+
{
30+
FORWARD_DECLARATION_DIMENSION_CLASS( CoordinateSystem );
31+
FORWARD_DECLARATION_DIMENSION_CLASS( LightRegularGrid );
32+
FORWARD_DECLARATION_DIMENSION_CLASS( RasterImage );
33+
} // namespace geode
34+
35+
namespace geode
36+
{
37+
template < index_t dimension >
38+
[[nodiscard]] LightRegularGrid< dimension > convert_raster_image_into_grid(
39+
const RasterImage< dimension >& raster,
40+
const CoordinateSystem< dimension >& coordinate_system );
41+
} // namespace geode

include/geode/mesh/helpers/convert_point_set.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ namespace geode
3737
{
3838
[[nodiscard]] std::unique_ptr< PointSet2D >
3939
opengeode_mesh_api convert_point_set3d_into_2d(
40-
const PointSet3D& point_set3d, index_t axis_to_remove );
40+
const PointSet3D& point_set3d, local_index_t axis_to_remove );
4141

4242
[[nodiscard]] std::unique_ptr< PointSet3D > opengeode_mesh_api
4343
convert_point_set2d_into_3d( const PointSet2D& point_set2d,
44-
index_t axis_to_add,
44+
local_index_t axis_to_add,
4545
double axis_coordinate );
4646
} // namespace geode

include/geode/mesh/helpers/convert_surface_mesh.hpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ namespace geode
5858
[[nodiscard]] std::unique_ptr< TriangulatedSurface2D > opengeode_mesh_api
5959
convert_grid_into_triangulated_surface( const Grid2D& grid );
6060

61+
[[nodiscard]] std::unique_ptr< PolygonalSurface2D > opengeode_mesh_api
62+
convert_grid_into_polygonal_surface( const Grid2D& grid );
63+
6164
[[nodiscard]] std::unique_ptr< TriangulatedSurface2D > opengeode_mesh_api
6265
convert_grid_into_densified_triangulated_surface( const Grid2D& grid,
6366
absl::Span< const geode::index_t > cells_to_densify );
@@ -71,32 +74,33 @@ namespace geode
7174

7275
[[nodiscard]] std::unique_ptr< SurfaceMesh3D > opengeode_mesh_api
7376
convert_surface_mesh2d_into_3d( const SurfaceMesh2D& surface2d,
74-
index_t axis_to_add,
77+
local_index_t axis_to_add,
7578
double axis_coordinate );
7679

7780
[[nodiscard]] std::unique_ptr< SurfaceMesh2D >
7881
opengeode_mesh_api convert_surface_mesh3d_into_2d(
79-
const SurfaceMesh3D& surface3d, index_t axis_to_remove );
82+
const SurfaceMesh3D& surface3d, local_index_t axis_to_remove );
8083

8184
[[nodiscard]] std::unique_ptr< PolygonalSurface3D >
8285
opengeode_mesh_api convert_polygonal_surface2d_into_3d(
8386
const PolygonalSurface2D& surface2d,
84-
index_t axis_to_add,
87+
local_index_t axis_to_add,
8588
double axis_coordinate );
8689

8790
[[nodiscard]] std::unique_ptr< PolygonalSurface2D >
8891
opengeode_mesh_api convert_polygonal_surface3d_into_2d(
89-
const PolygonalSurface3D& surface3d, index_t axis_to_remove );
92+
const PolygonalSurface3D& surface3d, local_index_t axis_to_remove );
9093

9194
[[nodiscard]] std::unique_ptr< TriangulatedSurface3D >
9295
opengeode_mesh_api convert_triangulated_surface2d_into_3d(
9396
const TriangulatedSurface2D& surface2d,
94-
index_t axis_to_add,
97+
local_index_t axis_to_add,
9598
double axis_coordinate );
9699

97100
[[nodiscard]] std::unique_ptr< TriangulatedSurface2D >
98101
opengeode_mesh_api convert_triangulated_surface3d_into_2d(
99-
const TriangulatedSurface3D& surface3d, index_t axis_to_remove );
102+
const TriangulatedSurface3D& surface3d,
103+
local_index_t axis_to_remove );
100104

101105
template < index_t dimension >
102106
[[nodiscard]] std::unique_ptr< SurfaceMesh< dimension > >

include/geode/mesh/helpers/internal/copy.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,9 @@ namespace geode
3737
namespace internal
3838
{
3939
template < typename MeshFrom, typename Builder >
40-
void copy_points3d_into_2d(
41-
const MeshFrom& from, Builder& builder, index_t axis_to_remove )
40+
void copy_points3d_into_2d( const MeshFrom& from,
41+
Builder& builder,
42+
local_index_t axis_to_remove )
4243
{
4344
OPENGEODE_EXCEPTION( axis_to_remove < 3,
4445
"[copy_points3d_into_2d] Invalid axis to remove." );
@@ -47,16 +48,15 @@ namespace geode
4748
async::irange( index_t{ 0 }, from.nb_vertices() ),
4849
[&from, &builder, axis_to_remove]( index_t v ) {
4950
const auto& pt_3d = from.point( v );
50-
builder.set_point( v,
51-
Point2D{ { pt_3d.value( axis_to_remove == 0 ? 1 : 0 ),
52-
pt_3d.value( axis_to_remove == 2 ? 1 : 2 ) } } );
51+
builder.set_point(
52+
v, pt_3d.project_point( axis_to_remove ) );
5353
} );
5454
}
5555

5656
template < typename MeshFrom, typename Builder >
5757
void copy_points2d_into_3d( const MeshFrom& from,
5858
Builder& builder,
59-
index_t axis_to_add,
59+
local_index_t axis_to_add,
6060
double axis_coordinate )
6161
{
6262
OPENGEODE_EXCEPTION( axis_to_add < 3,

include/geode/mesh/io/edged_curve_input.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ namespace geode
7373
{
7474
}
7575
};
76+
ALIAS_2D_AND_3D( EdgedCurveInput );
7677

7778
template < index_t dimension >
7879
[[nodiscard]] typename EdgedCurveInput< dimension >::MissingFiles

include/geode/mesh/io/edged_curve_output.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ namespace geode
5858
{
5959
}
6060
};
61+
ALIAS_2D_AND_3D( EdgedCurveOutput );
6162

6263
template < index_t dimension >
6364
[[nodiscard]] bool is_edged_curve_saveable(

include/geode/mesh/io/hybrid_solid_input.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ namespace geode
7676
{
7777
}
7878
};
79+
ALIAS_3D( HybridSolidInput );
7980

8081
template < index_t dimension >
8182
[[nodiscard]] typename HybridSolidInput< dimension >::MissingFiles

include/geode/mesh/io/hybrid_solid_output.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ namespace geode
6161
{
6262
}
6363
};
64+
ALIAS_3D( HybridSolidOutput );
6465

6566
template < index_t dimension >
6667
[[nodiscard]] bool is_hybrid_solid_saveable(

0 commit comments

Comments
 (0)