Gap-Free Bounding Boxes & Increase Sample Size
Problem
The existing code uses corner offsets of width / (2 * sqrt(2)) at 45-degree angles, producing boxes with side length width / sqrt(2) (approximately 70% of intended size). Combined with spacing of width/2, this results in gaps between bounding boxes and sample size reduction.
How to Fix
Each box is a width x width square aligned with the road segment direction. For a segment with angle theta:
- Along-road unit vector:
(cos theta, sin theta)
- Perpendicular unit vector:
(-sin theta, cos theta)
- Four corners:
midpoint +/- (width/2) * along +/- (width/2) * perpendicular
Overlap
Add a fixed 25% overlap (no UI control). Spacing formula:
step = width * (1 - 0.25) = width * 0.75
With width = 10m: boxes are 10m wide, spaced 7.5m apart, giving 2.5m overlap between adjacent boxes. This maximises raster data coverage along road centre lines and gives more data for your efforts :)
Gap-Free Bounding Boxes & Increase Sample Size
Problem
The existing code uses corner offsets of
width / (2 * sqrt(2))at 45-degree angles, producing boxes with side lengthwidth / sqrt(2)(approximately 70% of intended size). Combined with spacing ofwidth/2, this results in gaps between bounding boxes and sample size reduction.How to Fix
Each box is a
width x widthsquare aligned with the road segment direction. For a segment with angletheta:(cos theta, sin theta)(-sin theta, cos theta)midpoint +/- (width/2) * along +/- (width/2) * perpendicularOverlap
Add a fixed 25% overlap (no UI control). Spacing formula:
With
width = 10m: boxes are 10m wide, spaced 7.5m apart, giving 2.5m overlap between adjacent boxes. This maximises raster data coverage along road centre lines and gives more data for your efforts :)