pooltool.events.factory

Abstracted functions for easy event creation

This submodule provides a collection of factory functions for creating Event objects.

Each function is designed to encapsulate the creation of specific types of events, such as collisions between balls, collisions between balls and cushions, and various transitions in the ball’s state (e.g., from rolling to stationary, spinning to rolling).

Overview

Function

null_event(time, set_initial)

Create a null event.

ball_ball_collision(ball1, ball2, time, set_initial)

Create a ball-ball collision.

ball_linear_cushion_collision(ball, cushion, time, set_initial)

Create a ball-linear-cushion collision.

ball_circular_cushion_collision(ball, cushion, time, set_initial)

Create a ball-circular-cushion collision.

ball_pocket_collision(ball, pocket, time, set_initial)

Create a ball-pocket collision.

stick_ball_collision(stick, ball, time, set_initial)

Create a cue stick-ball collision.

spinning_stationary_transition(ball, time, set_initial)

Create a spinning-stationary transition.

rolling_stationary_transition(ball, time, set_initial)

Create a rolling-stationary transition.

rolling_spinning_transition(ball, time, set_initial)

Create a rolling-spinning transition.

sliding_rolling_transition(ball, time, set_initial)

Create a sliding-rolling transition.

Functions

pooltool.events.factory.null_event(time: float, set_initial: bool = False) pooltool.events.datatypes.Event[source]

Create a null event.

Return type:

pooltool.events.datatypes.Event

pooltool.events.factory.ball_ball_collision(ball1: pooltool.objects.ball.datatypes.Ball, ball2: pooltool.objects.ball.datatypes.Ball, time: float, set_initial: bool = False) pooltool.events.datatypes.Event[source]

Create a ball-ball collision.

Return type:

pooltool.events.datatypes.Event

pooltool.events.factory.ball_linear_cushion_collision(ball: pooltool.objects.ball.datatypes.Ball, cushion: pooltool.objects.table.components.LinearCushionSegment, time: float, set_initial: bool = False) pooltool.events.datatypes.Event[source]

Create a ball-linear-cushion collision.

Return type:

pooltool.events.datatypes.Event

pooltool.events.factory.ball_circular_cushion_collision(ball: pooltool.objects.ball.datatypes.Ball, cushion: pooltool.objects.table.components.CircularCushionSegment, time: float, set_initial: bool = False) pooltool.events.datatypes.Event[source]

Create a ball-circular-cushion collision.

Return type:

pooltool.events.datatypes.Event

pooltool.events.factory.ball_pocket_collision(ball: pooltool.objects.ball.datatypes.Ball, pocket: pooltool.objects.table.components.Pocket, time: float, set_initial: bool = False) pooltool.events.datatypes.Event[source]

Create a ball-pocket collision.

Return type:

pooltool.events.datatypes.Event

pooltool.events.factory.stick_ball_collision(stick: pooltool.objects.cue.datatypes.Cue, ball: pooltool.objects.ball.datatypes.Ball, time: float, set_initial: bool = False) pooltool.events.datatypes.Event[source]

Create a cue stick-ball collision.

Return type:

pooltool.events.datatypes.Event

pooltool.events.factory.spinning_stationary_transition(ball: pooltool.objects.ball.datatypes.Ball, time: float, set_initial: bool = False) pooltool.events.datatypes.Event[source]

Create a spinning-stationary transition.

Return type:

pooltool.events.datatypes.Event

pooltool.events.factory.rolling_stationary_transition(ball: pooltool.objects.ball.datatypes.Ball, time: float, set_initial: bool = False) pooltool.events.datatypes.Event[source]

Create a rolling-stationary transition.

Return type:

pooltool.events.datatypes.Event

pooltool.events.factory.rolling_spinning_transition(ball: pooltool.objects.ball.datatypes.Ball, time: float, set_initial: bool = False) pooltool.events.datatypes.Event[source]

Create a rolling-spinning transition.

Return type:

pooltool.events.datatypes.Event

pooltool.events.factory.sliding_rolling_transition(ball: pooltool.objects.ball.datatypes.Ball, time: float, set_initial: bool = False) pooltool.events.datatypes.Event[source]

Create a sliding-rolling transition.

Return type:

pooltool.events.datatypes.Event