Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Heres' some quickly-hacked-together implementation of a better precipitation sampling, that properly takes cells into account which are only partially inside the loss cone.
The actual cell-cone intersection test is done by formulating the loss cone as a signed distance function and sampling it in the cell centre. If the distance from the cell centre to the cone boundary is large than the cell's spatial diagonal, it is clearly full inside or fully outside, and handled as such.
For cells close to the loss cone boundary, an octree subdivision is performed, until the subcells are either fully inside, outside, or the iteration limit (currently hardcoded to 6 iterations) is reached. In that last case, the cell coverage is approximated by (lossConeBoundaryDistance - cellDiagonal) / cellDiagonal.
This compiles, but is untested in the actual precipitation code.
A miniApp comes along with it, that at least confirms that the coverage routine produces correctly cone-shaped patterns, but I am not 100% sure that there isn't a sign error in the cone direction.