Skip to content

Commit

Permalink
Merge branch 'release-0.5.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
ipadjen committed Jul 29, 2024
2 parents 8d54319 + 56bb32f commit 78ed8a2
Show file tree
Hide file tree
Showing 3,835 changed files with 103,989 additions and 1,173,557 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
18 changes: 14 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,16 @@ jobs:
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install libcgal-dev libboost-all-dev libeigen3-dev libomp-dev libgdal-dev
sudo apt-get install libgmp-dev libmpfr-dev libboost-all-dev libeigen3-dev libomp-dev libgdal-dev
- name: Download CGAL
run: |
wget https://github.com/CGAL/cgal/releases/download/v5.6.1/CGAL-5.6.1-library.tar.xz -P ${{ github.workspace }}
cd ${{ github.workspace }}
tar -xvf CGAL-5.6.1-library.tar.xz
- name: Build
run: |
mkdir build && cd build
cmake .. && make -j4
cmake .. -DCGAL_DIR=${{ github.workspace }}/CGAL-5.6.1 && make -j4
build_linux_2004:
runs-on: ubuntu-20.04
Expand All @@ -28,11 +33,16 @@ jobs:
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install libcgal-dev libboost-all-dev libeigen3-dev libomp-dev libgdal-dev
sudo apt-get install libgmp-dev libmpfr-dev libboost-all-dev libeigen3-dev libomp-dev libgdal-dev
- name: Download CGAL
run: |
wget https://github.com/CGAL/cgal/releases/download/v5.6.1/CGAL-5.6.1-library.tar.xz -P ${{ github.workspace }}
cd ${{ github.workspace }}
tar -xvf CGAL-5.6.1-library.tar.xz
- name: Build
run: |
mkdir build && cd build
cmake .. && make -j4
cmake .. -DCGAL_DIR=${{ github.workspace }}/CGAL-5.6.1 && make -j4
build_macos:
runs-on: macos-latest
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## [0.5.0] - 2024-07-29 - breaking changes
### Added
- LoD2.2 and LoD1.3 reconstruction
- Multiple reconstruction regions
- Geometric validity check
- Fallbacks for failed reconstructions
- Polygon simplification tool

## [0.4.6] - 2024-03-11
### Changed
- Improved robustness in handling bad polygons
Expand Down
33 changes: 18 additions & 15 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ project(city4cfd)
set(CMAKE_CXX_FLAGS "-O3")
set(CMAKE_BUILD_TYPE "Release")

if (COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
endif()
#if (COMMAND cmake_policy)
# cmake_policy(SET CMP0003 NEW)
#endif()

if (MSVC)
add_definitions(-DNOMINMAX)
add_definitions("/EHsc")
endif (MSVC)

# BOOST
find_package(Boost 1.66 REQUIRED COMPONENTS filesystem locale)
find_package(Boost 1.66 REQUIRED COMPONENTS filesystem locale QUIET)
if (WIN32)
FIND_PACKAGE(Boost)
if (Boost_FOUND)
Expand All @@ -29,26 +29,24 @@ if (WIN32)
endif (WIN32)

# CGAL
find_package(CGAL REQUIRED QUIET COMPONENTS)
if (CGAL_VERSION VERSION_GREATER_EQUAL "5.0")
message(STATUS "Found CGAL version greater than 5.0")
include_directories(${CMAKE_SOURCE_DIR}/thirdparty/CGAL/include)
set(CGAL_USE_INCLUDED_HEADERS ON)
find_package(CGAL REQUIRED)
if (CGAL_VERSION VERSION_GREATER_EQUAL "5.5")
message(STATUS "Found CGAL version ${CGAL_VERSION}")
else()
message(FATAL_ERROR "Found CGAL version ${CGAL_VERSION} which is not supported!"
"Please use CGAL version 5")
return()
message(FATAL_ERROR "Found CGAL version ${CGAL_VERSION} which is not supported!"
"Please use CGAL version 5.5 or higher")
return()
endif ()

# GDAL
find_package(GDAL REQUIRED 3.0)
find_package(GDAL 3.0 REQUIRED)
if (NOT GDAL_FOUND)
message(SEND_ERROR "City4CFD requires the GDAL library, check the README for configuration")
endif()
include_directories(${GDAL_INCLUDE_DIR})

# Eigen
find_package(Eigen3 3.2.0) #(requires 3.2.0 or greater)
find_package(Eigen3 3.3.4)
include(${CMAKE_SOURCE_DIR}/thirdparty/CGAL/cmake/CGAL_Eigen3_support.cmake)

# OpenMP
Expand All @@ -62,9 +60,12 @@ endif()
# Third-party
add_subdirectory(${CMAKE_SOURCE_DIR}/thirdparty/LAStools)
add_subdirectory(${CMAKE_SOURCE_DIR}/thirdparty/CSF/src)
add_subdirectory(${CMAKE_SOURCE_DIR}/thirdparty/roofer/src)
add_subdirectory(${CMAKE_SOURCE_DIR}/thirdparty/val3dity)
include_directories(${CMAKE_SOURCE_DIR}/thirdparty)
include_directories(${CMAKE_SOURCE_DIR}/thirdparty/valijson)
include_directories(${Boost_INCLUDE_DIR})
include_directories(${CMAKE_SOURCE_DIR}/thirdparty/roofer/src)

# Tools
add_subdirectory(${CMAKE_SOURCE_DIR}/tools/prepare_point_cloud)
Expand All @@ -74,7 +75,7 @@ FILE(GLOB SRC_FILES "src/*.cpp")
add_executable(city4cfd ${SRC_FILES})
set_target_properties(
city4cfd
PROPERTIES CXX_STANDARD 14
PROPERTIES CXX_STANDARD 17
)

target_link_libraries(city4cfd
Expand All @@ -86,6 +87,8 @@ target_link_libraries(city4cfd
${Boost_LOCALE_LIBRARY}
LASlib
CGAL::Eigen3_support
roofer_api
val3dity
${OpenMP_support}
)

Expand Down
28 changes: 18 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,19 @@
[![GitHub license](https://img.shields.io/github/license/tudelft3d/City4CFD?style=flat-square)](https://github.com/tudelft3d/City4CFD/blob/master/LICENSE)
[![DOI:10.3389/fbuil.2022.899332](http://img.shields.io/badge/DOI-10.3389/fbuil.2022.899332-B62030.svg?style=flat-square)](https://doi.org/10.3389/fbuil.2022.899332)

![welcome_figure](https://github.com/tudelft3d/City4CFD/blob/main/docs/images/workflow.png)
![welcome_figure](/docs/images/workflow.png)

City4CFD--*City for CFD*--is a tool that aims to automatically reconstruct 3D city geometries tailored for microscale urban flow simulations.
City4CFD--*City for CFD*--is a tool that aims to automatically reconstruct high-detailed 3D city geometries tailored for microscale urban flow simulations.

It can create automatically a terrain from a point cloud and imprint different surfaces (e.g. green areas, water, roads).
It can automatically create a terrain from a point cloud and imprint different surfaces (e.g. green areas, water, roads).

It enables us to reconstruct buildings from different sources and their combination, such as:
- Reconstruction with the combination of 2D polygons and a point cloud,
- Extrusion of footprints containing height or floor number attributes,
- The import of existing building models.

The reconstruction using the combination of point clouds and 2D polygons can be done in [LoD2.2, LoD1.3, and LoD1.2](https://3d.bk.tudelft.nl/lod/). You can use the [complexity factor](need link) to tune the overall complexity of the reconstructed geometry.

The resulting geometry is watertight -- buildings and surfaces are seamlessly integrated into a terrain.

It can automatically or manually define the zone of influence and domain boundaries.
Expand All @@ -38,19 +40,25 @@ You can directly compile City4CFD on your system using cmake, run it through a D

### Build from source
The following libraries are required to build the project:
- [CGAL](https://www.cgal.org/) version 5
- [CGAL](https://www.cgal.org/) >= 5.5
- Boost >= 1.66
- Eigen >= 3.2
- Eigen >= 3.3.4
- GMP >= 4.2
- MPFR >= 2.2.1
- GDAL >= 3.0

*OpenMP* is an optional dependency.

All dependencies are generally available in Linux distributions, e.g. in Debian/Ubuntu/Mint:
GMP, MFPR, and Eigen are necessary dependencies for CGAL.

Dependencies are generally available in Linux distributions, e.g. in Debian/Ubuntu/Mint:
```
sudo apt-get install libcgal-dev libboost-all-dev libeigen3-dev libomp-dev libgdal-dev
sudo apt-get install libcmpfr-dev libgmp-dev libboost-all-dev libeigen3-dev libomp-dev libgdal-dev
```

In macOS you can install dependencies with Homebrew:
CGAL can be directly downloaded from the [release page](https://github.com/CGAL/cgal/releases/tag/v5.6.1) (-library). No install is necessary, only the path to the unzipped folder is required (see below).

In macOS you can install all dependencies with Homebrew:

```
brew install cmake boost cgal eigen libomp gdal
Expand All @@ -61,11 +69,11 @@ The project uses CMake to generate makefiles, so make sure it is also installed.
To build City4CFD, do the following:
```
mkdir build && cd build
cmake ..
cmake .. -DCGAL_DIR=/path/to/cgal/dir
make
./city4cfd
```
You can speed up compilation by typing *make -j $numcores* where *$numcores* is the number of threads you can spare for compilation.
In case of Homebrew, you do not have to use the ```-DCGAL_DIR``` parameter. You can speed up compilation by typing *make -j $numcores* where *$numcores* is the number of threads you can spare for compilation.

### Docker
We offer built [Docker](https://www.docker.com/) images for every release, available at the [Docker Hub](https://hub.docker.com/r/tudelft3d/city4cfd). Running [the docker script](https://github.com/tudelft3d/City4CFD/tree/main/docker/run) for the first time will pull the docker image from the Docker Hub repository.
Expand Down
4 changes: 2 additions & 2 deletions docker/city4cfd-build-base.dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
FROM ubuntu:jammy
FROM ubuntu:noble
LABEL org.opencontainers.image.authors="Ivan Paden <[email protected]>"
LABEL org.opencontainers.image.source="https://github.com/tudelft3d/city4cfd"
LABEL org.opencontainers.image.vendor="Tudelft3D"
LABEL org.opencontainers.image.title="City4CFD build base"
LABEL org.opencontainers.image.description="Base image for building City4CFD"
LABEL org.opencontainers.image.licenses="GPL-3.0"
LABEL org.opencontainers.image.licenses="AGPL-3.0"
LABEL org.opencontainers.image.url="https://github.com/tudelft3d/city4cfd"

RUN apt-get update && apt-get install -y --no-install-recommends \
Expand Down
4 changes: 2 additions & 2 deletions docker/city4cfd.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ RUN bash /tmp/strip-docker-image-export \
-f /etc/passwd \
-f /bin/ls \
-f /data \
-f /usr/local/share/proj/proj.db \
-f /usr/share/proj/proj.db \
-f /usr/local/bin/city4cfd_pcprep \
-f /usr/local/bin/city4cfd_las2las \
-f /usr/local/bin/city4cfd
Expand All @@ -64,7 +64,7 @@ LABEL org.opencontainers.image.source="https://github.com/tudelft3d/city4cfd"
LABEL org.opencontainers.image.vendor="Tudelft3D"
LABEL org.opencontainers.image.title="City4CFD"
LABEL org.opencontainers.image.description="City4CFD image"
LABEL org.opencontainers.image.licenses="GPL-3.0"
LABEL org.opencontainers.image.licenses="AGPL-3.0"
LABEL org.opencontainers.image.url="https://github.com/tudelft3d/city4cfd"
LABEL org.opencontainers.image.version=$VERSION

Expand Down
Binary file added docs/images/alpha_wrap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/complexity_factor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/doc_welcome.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/lod13.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/rot_figs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/rot_poly.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/workflow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 9 additions & 4 deletions examples/TUDCampus/config_bpg.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"point_clouds" :
{
"ground": "point_cloud/sampled_ground_1m.ply",
"buildings" : "point_cloud/sampled_buildings_1m.ply"
"ground": "point_cloud/sampled_ground_1m.laz",
"buildings" : "point_cloud/sampled_buildings.laz"
},
"polygons" : [
{
Expand All @@ -21,9 +21,15 @@
"layer_name": "Water"
}
],
"reconstruction_regions": [
{
"influence_region": 300,
"lod": "2.2",
"complexity_factor": 0.7
}
],

"point_of_interest": [85376, 446125],
"influence_region": 300,
"domain_bnd": null,
"top_height": 300,

Expand All @@ -39,7 +45,6 @@
"max_pts": 100000
},

"lod": "1.2",
"building_percentile": 90,

"edge_max_len": 5,
Expand Down
14 changes: 10 additions & 4 deletions examples/TUDCampus/config_bpg_comments.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
{
"point_clouds" :
{
"ground": "point_cloud/sampled_ground_1m.ply",
"buildings" : "point_cloud/sampled_buildings_1m.ply"
"ground": "point_cloud/sampled_ground_1m.laz",
"buildings" : "point_cloud/sampled_buildings.laz"
},
"polygons" : [
{
Expand All @@ -26,10 +26,17 @@
"layer_name": "Water"
}
],
"reconstruction_regions": [
{
"influence_region": 300, // Radius, Polygon points, GeoJSON polygon, or null for BPG
"lod": "2.2", // 1.2, 1.3, or 2.2; base level of detail for reconstruction
"complexity_factor": 0.7, // Complexity factor of the graph-cut optimisation
"check_validity": true // Optional argument, report geometric validation in log
}
],

//-- Domain dimensions
"point_of_interest": [85376, 446125],
"influence_region": 300, // Radius, Polygon points, GeoJSON polygon, or null for BPG
"domain_bnd": null, // Same as above
"top_height": 300, // Doesn't matter if BPG are used for domain size
//- Arguments required only if using BPG
Expand All @@ -52,7 +59,6 @@
},
"flat_terrain": false, // Optional - make terrain flat
//- Buildings
"lod": "1.2",
"building_percentile": 90,

//-- Polygons related
Expand Down
14 changes: 9 additions & 5 deletions examples/TUDCampus/config_import_buildings.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"point_clouds" :
{
"ground": "point_cloud/sampled_ground_1m.ply",
"buildings" : "point_cloud/sampled_buildings_1m.ply"
"ground": "point_cloud/sampled_ground_1m.laz",
"buildings" : "point_cloud/sampled_buildings.laz"
},
"polygons" : [
{
Expand All @@ -21,15 +21,20 @@
"layer_name": "Water"
}
],
"reconstruction_regions": [
{
"influence_region": "polygons/influRegion.geojson",
"lod": "1.2",
"import_advantage": true
}
],
"import_geometries": {
"path": "import_buildings/TUD_geometries.json",
"advantage": true,
"true_height": true,
"lod": "1.3"
},

"point_of_interest": [85376, 446125],
"influence_region": "polygons/influRegion.geojson",
"domain_bnd": "polygons/domainBnd.geojson",
"top_height": 150,
"flow_direction": [1, 1],
Expand All @@ -42,7 +47,6 @@
"max_pts": 100000
},

"lod": "1.2",
"building_percentile": 90,

"edge_max_len": 5,
Expand Down
16 changes: 12 additions & 4 deletions examples/TUDCampus/config_manual.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"point_clouds" :
{
"ground": "point_cloud/sampled_ground_1m.ply",
"buildings" : "point_cloud/sampled_buildings_1m.ply"
"ground": "point_cloud/sampled_ground_1m.laz",
"buildings" : "point_cloud/sampled_buildings.laz"
},
"polygons" : [
{
Expand All @@ -21,9 +21,18 @@
"layer_name": "Water"
}
],
"reconstruction_regions": [
{
"influence_region": 30,
"lod": "2.2"
},
{
"influence_region": "polygons/influRegion.geojson",
"lod": "1.2"
}
],

"point_of_interest": [85376, 446125],
"influence_region": "polygons/influRegion.geojson",
"domain_bnd": "polygons/domainBnd.geojson",
"top_height": 150,
"flow_direction": [1, 1],
Expand All @@ -36,7 +45,6 @@
"max_pts": 100000
},

"lod": "1.2",
"building_percentile": 90,

"edge_max_len": 5,
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed examples/TUDCampus/point_cloud/sampled_ground_1m.ply
Binary file not shown.
Loading

0 comments on commit 78ed8a2

Please sign in to comment.