pooltool.objects.ball.params#

Overview#

Classes#

BallParams

Ball parameters and physical constants

PrebuiltBallParams

An Enum specifying prebuilt ball parameters

Classes#

class pooltool.objects.ball.params.BallParams(m: float = 0.170097, R: float = 0.028575, u_s: float = 0.2, u_r: float = 0.01, u_sp_proportionality: float = 0.4444444444444444, e_c: float = 0.85, f_c: float = 0.2, g: float = 9.81)[source]#

Ball parameters and physical constants

m#

The mass of the ball (default = 0.170097

Type:

float

R#

The radius of the ball (default = 0.028575).

Type:

float

u_s#

The sliding coefficient of friction (default = 0.2).

Type:

float

u_r#

The rolling coefficient of friction (default = 0.01).

Type:

float

u_sp_proportionality#

The spinning coefficient of friction, with R factored out (default = 0.01).

See also

  • For the coefficient of spinning friction, use the property u_sp().

Type:

float

e_c#

The cushion coefficient of restitution (default = 0.85).

Note

This is a potentially model-dependent ball-cushion parameter and should be placed elsewhere, either as a model parameter or as a cushion segment parameter.

Type:

float

f_c#

The cushion coefficient of friction (default = 0.2).

Note

This is a potentially model-dependent ball-cushion parameter and should be placed elsewhere, either as a model parameter or as a cushion segment parameter.

Type:

float

g#

The gravitational constant (default = 9.81).

Type:

float

Most of the default values (SI units) are taken from or based off of https://billiards.colostate.edu/faq/physics/physical-properties/.

Some of the parameters aren’t truly ball parameters, e.g. the gravitational constant. However, it is nice to be able to tune such parameters on a ball-by-ball basis, so they are included here.

Methods:

u_sp() float#

Coefficient of spinning friction

This is equal to u_sp_proportionality * R

Cached Property Note

This is a cached property, and should be accessed as an attribute, not as a method call.

Return type:

float

copy() BallParams[source]#

Return a copy

Note

  • Since the class is frozen and its attributes are immutable, this just returns self.

Return type:

BallParams

classmethod default(game_type: pooltool.game.datatypes.GameType = GameType.EIGHTBALL) BallParams[source]#

Return prebuilt ball parameters based on game type

Parameters:

game_type (pooltool.game.datatypes.GameType) -- What type of game is being played?

Returns:

The prebuilt ball parameters associated with the passed game type.

Return type:

BallParams

classmethod prebuilt(name: PrebuiltBallParams) BallParams[source]#

Return prebuilt ball parameters based on name

Parameters:

name (PrebuiltBallParams) -- A PrebuiltBallParams member.

Return type:

BallParams

All prebuilt ball parameters are named with the PrebuiltBallParams Enum. This constructor takes a prebuilt name and returns the corresponding ball parameters.

class pooltool.objects.ball.params.PrebuiltBallParams(value)[source]#

An Enum specifying prebuilt ball parameters

Bases: pooltool.utils.strenum.StrEnum