voxcity 0.3.22__py3-none-any.whl → 0.3.24__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of voxcity might be problematic. Click here for more details.

@@ -923,24 +923,32 @@ def visualize_point_grid_on_basemap(point_gdf, value_name='value', **kwargs):
923
923
  plt.tight_layout()
924
924
  plt.show()
925
925
 
926
- def create_multi_view_scene(meshes, output_directory="output"):
926
+ def create_multi_view_scene(meshes, output_directory="output", projection_type="perspective", distance_factor=1.0):
927
927
  """
928
928
  Create multiple views of the scene from different angles.
929
+
930
+ Args:
931
+ meshes: Dictionary of meshes to visualize
932
+ output_directory: Directory to save output images
933
+ projection_type: Either "perspective" or "orthographic" (default: "perspective")
929
934
  """
930
- # Get the first mesh to compute bounding box
931
- first_mesh = next(iter(meshes.values()))
932
- vertices = first_mesh.vertices
935
+ # Compute overall bounding box across all meshes
936
+ vertices_list = [mesh.vertices for mesh in meshes.values()]
937
+ all_vertices = np.vstack(vertices_list)
933
938
  bbox = np.array([
934
- [vertices[:, 0].min(), vertices[:, 1].min(), vertices[:, 2].min()],
935
- [vertices[:, 0].max(), vertices[:, 1].max(), vertices[:, 2].max()]
939
+ [all_vertices[:, 0].min(), all_vertices[:, 1].min(), all_vertices[:, 2].min()],
940
+ [all_vertices[:, 0].max(), all_vertices[:, 1].max(), all_vertices[:, 2].max()]
936
941
  ])
937
942
 
938
943
  # Compute the center and diagonal of the bounding box
939
944
  center = (bbox[1] + bbox[0]) / 2
940
945
  diagonal = np.linalg.norm(bbox[1] - bbox[0])
941
946
 
942
- # Use the diagonal to set the camera distance
943
- distance = diagonal * 2
947
+ # Adjust distance based on projection type
948
+ if projection_type.lower() == "orthographic":
949
+ distance = diagonal * 5 # Increase distance for orthographic to capture full scene
950
+ else:
951
+ distance = diagonal * 1.8 * distance_factor # Original distance for perspective
944
952
 
945
953
  # Define the isometric viewing angles
946
954
  iso_angles = {
@@ -972,6 +980,15 @@ def create_multi_view_scene(meshes, output_directory="output"):
972
980
  for view_name, camera_pos in camera_positions.items():
973
981
  # Create new plotter for each view
974
982
  plotter = pv.Plotter(notebook=True, off_screen=True)
983
+
984
+ # Set the projection type
985
+ if projection_type.lower() == "orthographic":
986
+ plotter.enable_parallel_projection()
987
+ # Set parallel scale to ensure the whole scene is visible
988
+ plotter.camera.parallel_scale = diagonal * 0.4 * distance_factor # Adjust this factor as needed
989
+
990
+ elif projection_type.lower() != "perspective":
991
+ print(f"Warning: Unknown projection_type '{projection_type}'. Using perspective projection.")
975
992
 
976
993
  # Add each mesh to the scene
977
994
  for class_id, mesh in meshes.items():
@@ -1038,6 +1055,8 @@ def visualize_voxcity_multi_view(voxel_array, meshsize, **kwargs):
1038
1055
  cmap_name = kwargs.get("colormap", "viridis")
1039
1056
  vmin = kwargs.get("vmin", np.nanmin(sim_grid))
1040
1057
  vmax = kwargs.get("vmax", np.nanmax(sim_grid))
1058
+ projection_type = kwargs.get("projection_type", "perspective")
1059
+ distance_factor = kwargs.get("distance_factor", 1.0)
1041
1060
 
1042
1061
  # Create meshes
1043
1062
  print("Creating voxel meshes...")
@@ -1078,7 +1097,7 @@ def visualize_voxcity_multi_view(voxel_array, meshsize, **kwargs):
1078
1097
  print("Creating multiple views...")
1079
1098
  # Create output directory if it doesn't exist
1080
1099
  os.makedirs(output_directory, exist_ok=True)
1081
- image_files = create_multi_view_scene(meshes, output_directory=output_directory)
1100
+ image_files = create_multi_view_scene(meshes, output_directory=output_directory, projection_type=projection_type, distance_factor=distance_factor)
1082
1101
 
1083
1102
  # Display each view separately
1084
1103
  for view_name, img_file in image_files:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: voxcity
3
- Version: 0.3.22
3
+ Version: 0.3.24
4
4
  Summary: voxcity is an easy and one-stop tool to output 3d city models for microclimate simulation by integrating multiple geospatial open-data
5
5
  Author-email: Kunihiko Fujiwara <kunihiko@nus.edu.sg>
6
6
  Maintainer-email: Kunihiko Fujiwara <kunihiko@nus.edu.sg>
@@ -27,11 +27,11 @@ voxcity/simulator/view.py,sha256=zNbfTLQ2Jo0V5-rFA3-xamRjOuw3H3MBrLKpQp8x3hY,367
27
27
  voxcity/utils/__init_.py,sha256=nLYrj2huBbDBNMqfchCwexGP8Tlt9O_XluVDG7MoFkw,98
28
28
  voxcity/utils/lc.py,sha256=RwPd-VY3POV3gTrBhM7TubgGb9MCd3nVah_G8iUEF7k,11562
29
29
  voxcity/utils/material.py,sha256=Vt3IID5Ft54HNJcEC4zi31BCPqi_687X3CSp7rXaRVY,5907
30
- voxcity/utils/visualization.py,sha256=WZkwxihy6XrSxMOPgAs0--MeoKK_lKIHRdPW9d-hQbQ,48626
30
+ voxcity/utils/visualization.py,sha256=QgcEc6SZb4J4mtk45rRjwJ6JCvfrh1rPxrZhHveyDn8,49852
31
31
  voxcity/utils/weather.py,sha256=P6s1y_EstBL1OGP_MR_6u3vr-t6Uawg8uDckJnoI7FI,21482
32
- voxcity-0.3.22.dist-info/AUTHORS.rst,sha256=m82vkI5QokEGdcHof2OxK39lf81w1P58kG9ZNNAKS9U,175
33
- voxcity-0.3.22.dist-info/LICENSE,sha256=-hGliOFiwUrUSoZiB5WF90xXGqinKyqiDI2t6hrnam8,1087
34
- voxcity-0.3.22.dist-info/METADATA,sha256=X27qtDw9i9619sVIcpoKLZ11DOHa_uOOLj3oRdSRcgc,25186
35
- voxcity-0.3.22.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
36
- voxcity-0.3.22.dist-info/top_level.txt,sha256=00b2U-LKfDllt6RL1R33MXie5MvxzUFye0NGD96t_8I,8
37
- voxcity-0.3.22.dist-info/RECORD,,
32
+ voxcity-0.3.24.dist-info/AUTHORS.rst,sha256=m82vkI5QokEGdcHof2OxK39lf81w1P58kG9ZNNAKS9U,175
33
+ voxcity-0.3.24.dist-info/LICENSE,sha256=-hGliOFiwUrUSoZiB5WF90xXGqinKyqiDI2t6hrnam8,1087
34
+ voxcity-0.3.24.dist-info/METADATA,sha256=s3WbdeRZe04Wo-_0-3WGZmX3Zd7AG0iuISi2Km5ROSo,25186
35
+ voxcity-0.3.24.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
36
+ voxcity-0.3.24.dist-info/top_level.txt,sha256=00b2U-LKfDllt6RL1R33MXie5MvxzUFye0NGD96t_8I,8
37
+ voxcity-0.3.24.dist-info/RECORD,,