analysis¶
occulus.analysis
¶
Point cloud analysis — volume computation and cross-section extraction.
Available functions
- :func:
compute_volume— cut/fill volume between two surfaces - :func:
extract_cross_section— profile extraction along a polyline - :func:
extract_profiles— perpendicular profiles at regular intervals
Data classes
- :class:
VolumeResult— cut/fill/net volume and area statistics - :class:
CrossSection— station-elevation profile with source points
All implementations use pure NumPy. No optional dependencies required.
CrossSection
dataclass
¶
A cross-section profile extracted from a point cloud.
Attributes:
| Name | Type | Description |
|---|---|---|
station |
NDArray[float64]
|
Station distances along the profile, shape (M,). |
elevation |
NDArray[float64]
|
Elevation values at each station, shape (M,). |
points |
NDArray[float64]
|
The 3D points contributing to this cross-section, shape (K, 3). |
width |
float
|
Corridor half-width used to select points. |
polyline |
NDArray[float64]
|
The polyline vertices defining this cross-section, shape (P, 2) or (P, 3). |
Source code in src/occulus/analysis/cross_section.py
VolumeResult
dataclass
¶
Result of a cut/fill volume computation.
Attributes:
| Name | Type | Description |
|---|---|---|
cut_volume |
float
|
Volume of material removed (surface above reference), in cubic units. |
fill_volume |
float
|
Volume of material added (surface below reference), in cubic units. |
net_volume |
float
|
Net volume change (cut - fill). Positive means net removal. |
resolution |
float
|
Grid cell size used for the computation. |
area |
float
|
Total planimetric area covered by the computation grid. |
cut_area |
float
|
Planimetric area where the surface is above the reference. |
fill_area |
float
|
Planimetric area where the surface is below the reference. |
Source code in src/occulus/analysis/volume.py
compute_volume(surface, reference, resolution=1.0, method='grid')
¶
Compute cut/fill volumes between two point cloud surfaces.
Both surfaces are rasterized onto a common 2D grid. For each cell the
mean elevation of each surface is computed, and the per-cell difference
(surface_z - reference_z) is multiplied by the cell area to obtain
volume.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
surface
|
PointCloud
|
The measured (as-built or post-event) surface. |
required |
reference
|
PointCloud
|
The reference (design or pre-event) surface. |
required |
resolution
|
float
|
Grid cell size in coordinate units, by default 1.0. |
1.0
|
method
|
str
|
Volume computation method. Currently only |
'grid'
|
Returns:
| Type | Description |
|---|---|
VolumeResult
|
Dataclass containing cut, fill, and net volumes together with area statistics. |
Raises:
| Type | Description |
|---|---|
OcculusValidationError
|
If |
Source code in src/occulus/analysis/volume.py
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | |
extract_cross_section(cloud, polyline, width=1.0, resolution=0.1)
¶
Extract a cross-section profile along a polyline.
Points within width distance of the polyline are projected onto the
polyline centreline. The resulting station-elevation profile is binned at
the specified resolution.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cloud
|
PointCloud
|
Input point cloud. |
required |
polyline
|
NDArray[float64]
|
Polyline vertices as (P, 2) or (P, 3) array. Only XY coordinates are used for the corridor selection; Z is ignored if present. |
required |
width
|
float
|
Half-width of the corridor around the polyline, by default 1.0. Points within this distance of the polyline centreline are included. |
1.0
|
resolution
|
float
|
Station spacing for the output profile, by default 0.1. |
0.1
|
Returns:
| Type | Description |
|---|---|
CrossSection
|
Extracted profile with station distances and elevations. |
Raises:
| Type | Description |
|---|---|
OcculusValidationError
|
If inputs are invalid (empty cloud, degenerate polyline, non-positive width or resolution). |
Source code in src/occulus/analysis/cross_section.py
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | |
extract_profiles(cloud, polyline, interval=10.0, width=5.0, resolution=0.1)
¶
Extract perpendicular profiles at regular intervals along a polyline.
At each station along the centreline, a perpendicular cross-section of
length 2 * width is extracted and sampled at resolution.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cloud
|
PointCloud
|
Input point cloud. |
required |
polyline
|
NDArray[float64]
|
Centreline polyline vertices as (P, 2) or (P, 3) array. |
required |
interval
|
float
|
Spacing between profile stations along the centreline, by default 10.0. |
10.0
|
width
|
float
|
Half-width of each perpendicular profile, by default 5.0. |
5.0
|
resolution
|
float
|
Station spacing within each profile, by default 0.1. |
0.1
|
Returns:
| Type | Description |
|---|---|
list[CrossSection]
|
One |
Raises:
| Type | Description |
|---|---|
OcculusValidationError
|
If inputs are invalid (empty cloud, degenerate polyline, non-positive interval, width, or resolution). |
Source code in src/occulus/analysis/cross_section.py
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 | |