Baseball: The location of the on-deck circle

In most ballparks, the locations of the on-deck circles seem to be dangerously close to the batters boxes. However, rarely does anyone see balls hit directly at batters waiting in the on deck circle. You see plenty of line drives directly into dugouts, which is actually further than the on-deck circle.

Is this planned? Did someone study the angles that foul ball line drives are hit, and determine where to place the on-deck circle? Or was the optimal location “learned” through experience?

I think that’s exactly it. A foul ball will generally either go straight back (if the bat hits under the ball), or forward at an angle (if the bat hits the ball too late or too early). The on deck circle is placed behind, but off to the side of the batter, where it’s very unlikely that a ball can be hit.

ETA: dimensions of the approved layout of a MLB diamond can be found at