Skip to content

Point

kloppy.domain.Point dataclass

Point(x, y)

Point on the pitch.

ATTRIBUTE DESCRIPTION
x

x coordinate in unit of PitchDimensions

TYPE: float

y

y coordinate in unit of PitchDimensions

TYPE: float

x instance-attribute

x

y instance-attribute

y

distance_to

distance_to(other)

Calculates the euclidean distance between the point and another provided point

PARAMETER DESCRIPTION
other

See Point

TYPE: Point

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.Point3D dataclass

Point3D(x, y, z)

Bases: Point

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

ATTRIBUTE DESCRIPTION
z

z coordinate in unit of PitchDimensions

TYPE: Optional[float]

z instance-attribute

z

x instance-attribute

x

y instance-attribute

y

distance_to

distance_to(other)

Calculates the euclidean distance between the point and another provided point

PARAMETER DESCRIPTION
other

See Point

TYPE: Point

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)