# sight.ludic - in the picture, within reach, and actually seen. A frustum says a subject is in FRONT # of the lens, not that the lens can see it: the line must be clear of the ground and the still # things (the port's). It is forgiving on purpose - the subject passes if its body or its head is clear. function pht_ray_point(x: float, y: float, z: float) -> bool { return PhotoLens.clear(PhotoLens.x(), PhotoLens.y(), PhotoLens.z(), x, y, z) } # is (x, y, z) in the picture, within `far`, and can the lens see it? export function photo_in_view(x: float, y: float, z: float, far: float) -> bool { let dx = x - PhotoLens.x() let dy = y - PhotoLens.y() let dz = z - PhotoLens.z() let d = Math.sqrt(dx * dx + dy * dy + dz * dz) if d > far or d < 0.5 { return false } if (dx * PhotoLens.fx() + dy * PhotoLens.fy() + dz * PhotoLens.fz()) / d < 0.72 { return false } if not PhotoLens.visible(x, y, z, 1.0) { return false } return pht_ray_point(x, y, z) or pht_ray_point(x, y + 0.55, z) }