Open direct paths through a forest

43 Views Asked by At

I'm struggling to find a formula to solve a real life engineering problem, and I hope someone can help me.

Imagine a rectangular forest, with trees planted in a grid/matrix pattern (in the corners of all "cells" from a bird's eye view). The number of trees within the rectangular forest is given by user input (must be a number divisible as required by numbers of rows/columns), as well as the dimensions of the forest itself ("L" x "W").

A very simple example would be a 2 x 2 area, with 4 trees (one in each corner). My problem is to calculate how much sun would penetrate the forest (assuming uniform distribution along the projected width), from any given angle, assuming only the tree trunks (with diameter "d") are in the way (height can be disregarded, assuming the trees are cylindrical with constant diameter along the z-axis). In our example this would result in light on the opposite side of the forest to be equal to (2 - (2 x d) when at an angle equal to one of the sides (as two trees would be directly behind the front ones). While if the angle was directly onto a corner (45 degrees), the result would be SQRT(L^2 + W^2) - (3 x d) as the fourth tree would be directly behind another.

Is there any way to make a general formula to calculate how much light would reach the opposite side of any size forest with any number of trees, in said pattern?

Finding the projected width of a rectangle from any angle should be L x B x cos a, right? But how can I find out how many trees block the view, and how much of the projected width is "open"?