Skip to content

Pitch

kloppy.domain.models.pitch.Point dataclass

Point on the pitch.

Attributes:

Name Type Description
x float

x coordinate in unit of PitchDimensions

y float

y coordinate in unit of PitchDimensions

distance_to(self, other)

Calculates the euclidean distance between the point and another provided point

Parameters:

Name Type Description Default
other Point

See Point

required
Source code in kloppy/domain/models/pitch.py
def distance_to(self, other: "Point") -> float:
    """
    Calculates the euclidean distance between the point and another provided point

    Arguments:
        other: See [`Point`][kloppy.domain.models.pitch.Point]
    """
    return sqrt((self.x - other.x) ** 2 + (self.y - other.y) ** 2)

kloppy.domain.models.pitch.Point3D dataclass

Point on the pitch that includes the z coordinate for height (e.g. of the ball).

Attributes:

Name Type Description
z float

z coordinate in unit of PitchDimensions

kloppy.domain.models.pitch.PitchDimensions dataclass

Attributes:

Name Type Description
x_dim Dimension

See Dimension

y_dim Dimension

See Dimension

x_per_meter float

number of units per meter in the x dimension

y_per_meter float

number of units per meter in the y dimension

length: float property readonly

Calculates the length of the pitch in meters if possible.

width: float property readonly

Calculates the width of the pitch in meters if possible.

kloppy.domain.models.pitch.Dimension dataclass

Attributes:

Name Type Description
min float

Minimal possible value within this dimension

max float

Maximal possible value within this dimension