coverage method

double coverage(
  1. Vector3 cameraPosition
)

The probe's coverage at cameraPosition, 1 inside the box fading to 0 across blendDistance outside (before weight).

Implementation

double coverage(Vector3 cameraPosition) {
  final center = worldCenter;
  final dx = (cameraPosition.x - center.x).abs() - extents.x;
  final dy = (cameraPosition.y - center.y).abs() - extents.y;
  final dz = (cameraPosition.z - center.z).abs() - extents.z;
  final ox = dx > 0 ? dx : 0.0;
  final oy = dy > 0 ? dy : 0.0;
  final oz = dz > 0 ? dz : 0.0;
  final dist = math.sqrt(ox * ox + oy * oy + oz * oz);
  if (dist <= 0) return 1.0;
  if (blendDistance <= 0) return 0.0;
  return (1.0 - dist / blendDistance).clamp(0.0, 1.0);
}