Module ball_spec
This module defines the specifications for a ball in the ball drop simulation.
It includes the BallSpecDefaults class, which holds the default values for
the ball's physical properties such as mass, radius, and drag coefficient, and
the BallSpec data class that can be used to represent these properties for individual balls.
Classes
class BallSpec (mass: float = 1.0, radius: float = 1.0, drag_coefficient: float = 0.47)-
Specifications for the ball, including mass, radius, and drag coefficient.
Attributes
mass:float- The mass of the ball in kilograms. Defaults to
BallSpecDefaults.MASS. radius:float- The radius of the ball in meters. Defaults to
BallSpecDefaults.RADIUS. drag_coefficient:float- The drag coefficient of the ball. Defaults to
BallSpecDefaults.SPHERE_DRAG_COEFFICIENT.
Expand source code
@dataclass class BallSpec: """ Specifications for the ball, including mass, radius, and drag coefficient. Attributes: mass (float): The mass of the ball in kilograms. Defaults to `BallSpecDefaults.MASS`. radius (float): The radius of the ball in meters. Defaults to `BallSpecDefaults.RADIUS`. drag_coefficient (float): The drag coefficient of the ball. Defaults to `BallSpecDefaults.SPHERE_DRAG_COEFFICIENT`. """ mass: float = BallSpecDefaults.MASS radius: float = BallSpecDefaults.RADIUS drag_coefficient: float = BallSpecDefaults.SPHERE_DRAG_COEFFICIENTClass variables
var drag_coefficient : floatvar mass : floatvar radius : float
class BallSpecDefaults-
Default values for ball specifications.
Attributes
MASS:float- The default mass of the ball in kilograms.
RADIUS:float- The default radius of the ball in meters.
SPHERE_DRAG_COEFFICIENT:float- The default drag coefficient for a spherical ball.
Expand source code
class BallSpecDefaults: """ Default values for ball specifications. Attributes: MASS (float): The default mass of the ball in kilograms. RADIUS (float): The default radius of the ball in meters. SPHERE_DRAG_COEFFICIENT (float): The default drag coefficient for a spherical ball. """ MASS: Final[float] = 1.0 # kg RADIUS: Final[float] = 1.0 # meters SPHERE_DRAG_COEFFICIENT: Final[float] = 0.47 # Drag coefficient for a sphere in airClass variables
var MASS : Final[float]var RADIUS : Final[float]var SPHERE_DRAG_COEFFICIENT : Final[float]