# Building NBA Defenses Using the Convex Hull

When a basketball team employs a zone-type of defense, they are attempting to remove a specific element from the opposing team’s arsenal. For example, the 2-3 zone defense attempts to pack the lane by placing a strong defensive player in the center of the lane; a basket defender, if you will. This type of defense is an attempt to eliminate drives to the basket and push away strong post players from the basket.

The 1-3-1 zone defense attempts to harass guards and coax them into driving into the short corner in attempts to trap. This defense is to force a poorer passing team into making tough passes that are usually picked off by lengthy wing defenders.

The 1-2-2 zone defense attempts to chase shooters off the three point line in attempts to force an interior pass. This defense limits a strong outside shooting team with the hopes of using quick weak-side defense to steal interior passes.

Finally, man-to-man defense typically plays a “man-you-ball” style where the defender is positioned such that they can cut off their respective player from making a move towards the basket, but situated in such a way that they are between their man and the basketball. When an offensive set is played, the man-to-man scheme typically attempts to fit defense within the scheme of the offense.

Each defense has a particular schema: build a protective region such that a difficult shot or a steal is attained if the offense attempts to breach this region. In mathematical terms, this region can be defined as a polygon, where the vertices of the polygon are defined by the outer shell of the defenders.

In our previous post on location data from an NBA game, we have sampled points at the .04 second resolution in which we have 11 locations: 5 offense, 5 defense, 1 ball. From here, we can build the polygon that defines the defensive set. We perform this by  making a convex hull of the defensive players.

A convex hull is a smallest envelope that contains all the points of a set of interest, such that the set is convex. What we mean by convex is that if we pick any two points in the region, a straight line connecting those points is entirely contained in the region.

Examples of a convex region (left) and a non-convex region (right). Image Credit: Murray State CSC Lab.

Computation of such a set is a common problem to computational geometry as this algorithm does not yield an equation for a solution. Instead, it’s a set of instructions to compute the smallest region possible. Applying this methodology to a play from the Miami Heat versus San Antonio Spurs game from the 2014 NBA Finals Game One data, we obtain the convex hull for the offense and defense for a particular play.

Convex hull of Miami Heat defense (red) versus San Antonio Spurs offense (gray) from Game One of the 2014 NBA Finals.

In the NBA, teams play a mix of zone and man-to-man due to a set of illegal defense rules. Typically, an NBA defense will attempt to place a polygon over the key and attempt to keep the polygon contained within the offense polygon. In the example of the Spurs-Heat game, we see the Heat’s polygon does exactly this.

The definition of penetration for an NBA offense is to attack the key. We can extend this definition to penetrating the polygon. When a polygon is penetrated, this means there is a defender out of position. That is, the defense is put in a position where a man is completely uncovered, or the defense has less defenders than offensive players heading towards a basket.

Tony Parker (9) for the San Antonio Spurs penetrates the Miami Heat defense, turning the game into three on two, eventually leading to Thiago Splitter (22) being open for a lay-up.

This means we can start to measure the effectiveness of a defense based on how much the polygons overlap and how often penetration occurs. If two polygons overlap quite well, then all offensive players are covered by defenders. Alternatively, if there is not much overlap, there are players that are completely uncovered; think corner three when penetration occurs. Similarly, since we have the polygons defined, we can also measure the effectiveness of penetration by an offensive player.

We can then attach the convex hull to our animation on the NBA position data to obtain a spatio-temporal representation of the polygon movements over the course of a play.

So what do you think of the convex hull methods for displaying a defense? What teams would you like to see an analysis of?