Skip to main content

Hockey features

The features a hockey surface is drawn from (sportypy._feature_classes.hockey).

BaseHockeyFeature​

An extension of the BaseFeature class for hockey features.

The following attributes are specific to hockey features only. For more information on inherited attributes, please see the BaseFeature class definition. The default values are provided to ensure that the feature can at least be created.

Attributes​

  • rink_length (float): The length of the rink in TV view. The default is 0.0
  • rink_width (float): The width of the rink in TV view. The default is 0.0
  • feature_radius (float): The radius needed to draw the feature. This may not be needed for all features. The default is 0.0
  • feature_thickness (float): The thickness with which to draw the feature. This is normally given as the horizontal width of the feature in TV view, however it may be used to specify other thicknesses as needed. The default is 0.0
  • field_units (str): The units with which the feature is drawn. The default is "ft"

Boards​

A parameterization of the boards of a hockey rink.

The method below specifies one half of the rink's boards. The rest of the boards are produced via a reflection over the x-axis when viewing the rink in TV view.

The rink's boards are rounded in the arc of a circle of a specified radius, so the x and y coordinates of its center must be taken and shifted to their correct location on the ice surface

BoardsConstraint​

A parameterization of the constraint of the boards of a hockey rink.

This corresponds to the inner edges of the boards and is used to constrain other features from extending beyond the inner boundary of the ice rink.

Unlike the Boards class (defined above), this feature is designed to function over the entire surface of an ice rink

DefensiveZone​

A parameterization of the defensive zone of a hockey rink.

The offensive zone is the left "third" of the rink in TV view. This is the area that a team defends when attacking from left to right

Attributes​

  • nzone_length (float): The length of the neutral zone, measured from the interior edges of the zone lines (blue lines)

NeutralZone​

A parameterization of the neutral zone of a hockey rink.

The neutral zone is the middle "third" of the rink. This is the area between the two zone (blue) lines. The center of the neutral zone should lie along the line x = 0

OffensiveZone​

A parameterization of the offensive zone of a hockey rink.

The offensive zone is the right "third" of the rink in TV view. This is the area that a team attacks to try to score a goal when attacking from left to right

Attributes​

  • nzone_length (float): The length of the neutral zone, measured from the interior edges of the zone lines (blue lines)

CenterLine​

A parameterization of the center line of a hockey rink.

The center line is the line that divides the ice surface in half. Its center should lie directly in the center of the ice surface. Its line thickness should be given by major_line_thickness as this is a major line on the ice surface

Attributes​

  • center_faceoff_spot_gap (float): The gap in the center line that surrounds the center faceoff spot. This is measured between the inner edges of the two halves of the center line

RefereeCrease​

A parameterization of the referee's crease.

The referee's crease is a semi-circle on the "bottom" of the boards (in TV view), centered on the line y = 0 (the center of the center line)

CenterFaceoffSpot​

A parameterization of the center faceoff spot of a hockey rink.

The center faceoff spot is the spot at which the game begins. Its center should lie directly in the center of the ice surface. Its radius is passed as a key in rink_params

ZoneLine​

A parameterization of the zone lines of a hockey rink.

The zone lines are the lines that separate the neutral zone from the offensive and defensive zones. Its line thickness should be given by major_line_thickness as this is a major line on the ice surface

GoalLine​

A parameterization of the goal lines of a hockey rink.

The goal lines are the lines over which a puck must cross (within the goal frame) in order to be considered a goal. Its line thickness should be given by minor_line_thickness as this is a minor line on the ice surface

GoalCreaseOutline​

A parameterization of the goal crease's outline.

The goal crease is the area where a goaltender plays their position. It is comprised of two components: the outline of the crease, and the filling in its boundary (see documentation for GoalCreaseFill class). The goal crease may have two notches (one on each side of the line y = 0).

Attributes​

  • crease_length (float): The distance from the center of the goal line to the start of the arc of the goal crease

  • crease_width (float): The exterior width of the goal crease

  • notch_dist_x (float): The distance from the center of the goal line to the notch (if one exists) in the goal crease

  • notch_width (float): The width of the notch (if one exists) in the goal crease

  • crease_style (str): The style of goal crease to implement. Viable options are:

    • nhl98 (the current iteration of the NHL goal crease. This is): what is used for most professional leagues
    • nhl92 (the previous iteration of an NHL goal crease. It is drawn): as a semi-circle with two L-shaped notches at the edge of the crease intersecting the semi-circle
    • ushl1 (the current iteration of a USA Hockey goal crease. This): is what is currently used in the USHL (United States Hockey League)

GoalCreaseFill​

A parameterization of the goal crease's filling.

The goal crease is the area where a goaltender plays their position. It is comprised of two components: the outline of the crease (see documentation for GoalCreaseOutline class), and the filling in its boundary. The goal crease may have two notches (one on each side of the line y = 0).

Attributes​

  • crease_length (float): The distance from the center of the goal line to the start of the arc of the goal crease

  • crease_width (float): The exterior width of the goal crease

  • notch_dist_x (float): The distance from the center of the goal line to the notch (if one exists) in the goal crease

  • notch_width (float): The width of the notch (if one exists) in the goal crease

  • crease_style (str): The style of goal crease to implement. Viable options are:

    • nhl98 (the current iteration of the NHL goal crease. This is): what is used for most professional leagues
    • nhl92 (the previous iteration of an NHL goal crease. It is drawn): as a semi-circle with two L-shaped notches at the edge of the crease intersecting the semi-circle
    • ushl1 (the current iteration of a USA Hockey goal crease. This): is what is currently used in the USHL (United States Hockey League)

GoaltendersRestrictedArea​

A parameterization of the goaltender's restricted area of a hockey rink.

The goaltender's restricted area marks where a goaltender is legally allowed to handle the puck behind the net. This is often referred to as "the trapezoid" as it is trapezoidal in shape. Its line thickness should be given by minor_line_thickness as this is a minor line on the ice surface.

NOTE: This is not a requirement in all leagues, and may be omitted via the has_trapezoid key in the rink_params passed to the HockeyRink class

Attributes​

  • short_base_width (float): The exterior base-width of the trapezoid (should it exist) that along the goal line
  • long_base_width (float): The exterior base-width of the trapezoid (should it exist) that lies along the boards

CenterFaceoffCircle​

A parameterization of the faceoff circle at the center of a hockey rink.

The center faceoff circle is where the each period of the game begins. It differs from the non-centered faceoff circles in that there are no adjoining hash marks on this circle. It is also a different color than the non-centered faceoff circles. Its line thickness should be given by minor_line_thickness as this is a minor line on the ice surface

ODZoneFaceoffCircle​

A parameterization of the off-centered faceoff circles of a hockey rink.

The non-centered faceoff circles are located in the offensive and defensive zones of the ice, with one on each side of the x-axis. These circles differ from the center faceoff circle because they have hash marks that extend towards the boards on each side of the circle

Attributes​

  • hashmark_width (float): The width of the hashmarks on the exterior of the defensive and offensive faceoff circles. Note that width refers to a distance solely in the y direction
  • hashmark_ext_spacing (float): The exterior horizontal spacing between the hashmarks on the exterior of the defensive and offensive faceoff circles. Note that this is solely in the x direction

NODZoneFaceoffSpotRing​

A parameterization of the off-centered faceoff spot of a hockey rink.

The non-centered faceoff spots are located in the neutral, offensive and defensive zones of the ice, with one on each side of the x-axis. These spots differ from the center faceoff spot because they have a larger diameter, differ in color, and have a colored stripe that runs through its center.

This class is responsible for creating the outer ring, not the colored stripe running through it. Please see the documentation for the NODZoneFaceoffSpotStripe class for more information on it

NODZoneFaceoffSpotStripe​

A parameterization of the off-centered faceoff spot of a hockey rink.

The non-centered faceoff spots are located in the neutral, offensive and defensive zones of the ice, with one on each side of the x-axis. These spots differ from the center faceoff spot because they have a larger diameter, differ in color, and have a colored stripe that runs through its center.

This class is responsible for creating the inner stripe, not the colored outer ring around it. Please see the documentation for the NODZoneFaceoffSpotRing class for more information on it

Attributes​

  • gap_width (float): The gap between the interior edge of a non-centered faceoff spot ring and the stripe running across it

ODZoneFaceoffLines​

A parameterization of the faceoff lines in the offensive/defensive zone.

These lines are the L-shaped lines where players on each team line up when taking a faceoff in either the offensive or defensive zones. There are four of these faceoff lines around each offensive/defensive faceoff spot

Attributes​

  • faceoff_line_dist_x (float): The distance from the center of the defensive and offensive faceoff spot to the left-most edge of the upper-right faceoff line
  • faceoff_line_dist_y (float): The distance from the center of the defensive and offensive faceoff spot to the bottom edge of the upper-right faceoff line
  • faceoff_line_length (float): The exterior length of the faceoff line
  • faceoff_line_width (float): The exterior width of the faceoff line
  • over_x (bool): Whether or not the line should be reflected over the x axis
  • over_y (bool): Whether or not the line should be reflected over the y axis

GoalFrame​

A parameterization of a goal frame.

The goal frame is where the puck enters after crossing the goal line to score a legal goal. The front face of the goal is flush with the goal line, while the back edge features rounded corners and expands outside of the front posts. The goal frame is composed of two pieces: the frame (this class) and the fill (see GoalFrameFill documentation)

Attributes​

  • goal_mouth_width (float): The interior distance between the goalposts
  • goal_back_width (float): The exterior distance between the widest part of the goal frame's footprint
  • goal_depth (float): The depth of the goal frame from the center of the goal line to the exterior of the back pipe of the goal frame
  • post_diameter (float): The diameter of the posts of the goal frame

GoalFrameFill​

A parameterization of the filling of a goal frame.

The goal frame is where the puck enters after crossing the goal line to score a legal goal. The front face of the goal is flush with the goal line, while the back edge features rounded corners and expands outside of the front posts. The goal frame is composed of two pieces: the frame (see GoalFrame documentation) and the fill (this class)

Attributes​

  • goal_mouth_width (float): The interior distance between the goalposts
  • goal_back_width (float): The exterior distance between the widest part of the goal frame's footprint
  • goal_depth (float): The depth of the goal frame from the center of the goal line to the exterior of the back pipe of the goal frame
  • post_diameter (float): The diameter of the posts of the goal frame

PlayerBenchOutline​

A parameterization of the player bench area's outline for a single team.

The player benches are the areas outside the confines of the rink where players not currently on the ice are seated. They are to be on the same side of the ice surface and separate, as close to center ice as possible

Attributes​

  • bench_length (float): The exterior length of a single team's bench area
  • bench_depth (float): The interior depth off the boards of a single team's bench area

PenaltyBoxOutline​

A parameterization of the penalty box for a single team.

The penalty boxes are the areas outside the confines of the rink where players serve time for a penalty incurred. They are to be on the same side of the ice surface and separate, as close to center ice as possible, for each team. This will also include the off-ice officials' box

Attributes​

  • penalty_box_length (float): The interior length of a single penalty box
  • penalty_box_depth (float): The interior depth off of the boards of a single team's penalty box
  • penalty_box_separation (float): The distance that separates each team's penalty box area. This should be equivalent to the length of the off-ice officials' box

PlayerBenchFill​

A parameterization of the interior of the player bench area.

The player benches are the areas outside the confines of the rink where players not currently on the ice are seated. They are to be on the same side of the ice surface and separate, as close to center ice as possible

Attributes​

  • bench_length (float): The exterior length of a single team's bench area
  • bench_depth (float): The interior depth off the boards of a single team's bench area

PenaltyBoxFill​

A parameterization of the interior of the penalty box for a single team.

The penalty boxes are the areas outside the confines of the rink where players serve time for a penalty incurred. They are to be on the same side of the ice surface and separate, as close to center ice as possible, for each team. This will not include the off-ice officials' box; see the documentation for the OffIceOfficialsBox class for more information

Attributes​

  • penalty_box_length (float): The interior length of a single penalty box
  • penalty_box_depth (float): The interior depth off of the boards of a single team's penalty box
  • penalty_box_separation (float): The distance that separates each team's penalty box area. This should be equivalent to the length of the off-ice officials' box

OffIceOfficialsBox​

A parameterization of the interior of the off-ice officials' box.

The off-ice officials' box is located between the two penalty boxes, opposite the team bench areas

Attributes​

  • officials_box_length (float): The interior length of the off-ice officials' box
  • officials_box_depth (float): The interior depth off of the boards of the off-ice officials' box