findVisiblePointFromVirtualEye

fun findVisiblePointFromVirtualEye(virtualEyes: Vec3, box: AABB, rangeToTest: Double, visibilityPredicate: VisibilityPredicate = ArrowVisibilityPredicate): Vec3?

Finds a point that is visible from the virtual eyes.

Algorithm

  1. Projects points on the box from the virtual eyes.

  2. Sorts the points by distance to the box center.

  3. For each point:

    • Creates a ray starting from the point, extending for twice the range.

    • Raycasts the ray against the box to find the intersection point.

    • Checks if the intersection point is within the range and satisfies the visibilityPredicate.

  4. Returns the first visible point found, or null if no point is visible.

Return

the best visible spot found or null

Parameters

rangeToTest

The maximum distance to test for visibility.

visibilityPredicate

An optional predicate to determine if a given point is visible