Isovists & Viewshed
Isovist Geometric Metrics:
A_v): Total square footage directly visible from the observation point. 2. Compactness Ratio: 4 π A / P^2 measures whether the visual field is circular (open) or fractured (labyrinthine). 3. Occlusivity: Length of visual boundary segments that correspond to occluding edges rather than solid walls.1import numpy as np23def compute_isovist_polygon(viewpoint, obstacles, max_radius=10.0, num_rays=360):4 """5 Computes Benedikt (1979) 2D isovist polygon from a viewpoint.6 Casts radial rays in 360 degrees and finds the nearest intersection with room obstacles.7 Key metrics: Area, Perimeter, Compactness (Circularity), and Occlusivity.8 """9 isovist_vertices = []10 angles = np.linspace(0, 2 * np.pi, num_rays, endpoint=False)1112 for theta in angles:13 ray_dir = np.array([np.cos(theta), np.sin(theta)])14 closest_t = max_radius1516 for segment in obstacles:17 t = ray_segment_intersect(viewpoint, ray_dir, segment)18 if t is not None and t < closest_t:19 closest_t = t2021 isovist_vertices.append(viewpoint + ray_dir * closest_t)2223 return isovist_vertices
Isovist Fields & Spatial Visibility: First formalized by Michael Benedikt in 1979, an isovist is the set of all spatial points visible from a single vantage point in space. By casting radial 360-degree sightlines until striking walls or columns, computational architects quantify human visual perception, measuring spatial openness, perimeter occlusivity, and surveillance sightlines.
Viewshed Invariant:
1import numpy as np23def compute_cumulative_viewshed(dem_grid, observer_points, observer_height=1.7):4 """5 Computes Digital Elevation Model (DEM) cumulative viewshed across a 2D terrain grid.6 Scans radial Line-of-Sight (LOS) rays from each observer and tracks the running7 maximum horizon elevation slope tan(alpha) = (z_cell - z_obs) / dist.8 """9 rows, cols = dem_grid.shape10 viewshed = np.zeros((rows, cols), dtype=int)1112 for ox, oy in observer_points:13 z_obs = dem_grid[oy, ox] + observer_height14 for ty in range(rows):15 for tx in range(cols):16 steps = max(abs(tx - ox), abs(ty - oy))17 if steps == 0:18 viewshed[ty, tx] += 119 continue20 max_slope = -np.inf21 visible = True22 for s in range(1, steps + 1):23 cx = int(round(ox + (tx - ox) * (s / steps)))24 cy = int(round(oy + (ty - oy) * (s / steps)))25 dist = np.hypot(cx - ox, cy - oy)26 slope = (dem_grid[cy, cx] - z_obs) / max(dist, 1e-6)27 if s < steps and slope > max_slope:28 max_slope = slope29 elif s == steps and slope < max_slope:30 visible = False31 if visible:32 viewshed[ty, tx] += 133 return viewshed
Cumulative Viewshed & Urban Sightlines: In regional master planning and skyline design, a viewshed identifies terrain and building zones visible from critical landmark viewpoints (such as historic monuments or observation decks). Computing mutual line-of-sight (LOS) across 3D city blocks highlights blind spots, public surveillance zones, and protected view corridors.
Related Concepts
Isovists, viewsheds, solar shadows, and acoustic ray tracing.
Interactive geometrical visualization of Planar Quad meshes and conical beam offsets.
Interactive geometrical visualization of solar shadow envelopes and specular acoustic ray tracing.