From 9a149ad6ece060588bb35719c1c7911a05379f3a Mon Sep 17 00:00:00 2001 From: Evan Kiefl Date: Tue, 7 Jan 2025 23:41:18 -0800 Subject: [PATCH] Update example --- docs/examples/30_degree_rule.pct.py | 6 +++--- pooltool/physics/__init__.py | 12 ++++++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/docs/examples/30_degree_rule.pct.py b/docs/examples/30_degree_rule.pct.py index 7b08d7b9..69f9bad8 100644 --- a/docs/examples/30_degree_rule.pct.py +++ b/docs/examples/30_degree_rule.pct.py @@ -7,7 +7,7 @@ # extension: .py # format_name: percent # format_version: '1.3' -# jupytext_version: 1.16.4 +# jupytext_version: 1.16.6 # kernelspec: # display_name: Python 3 (ipykernel) # language: python @@ -123,9 +123,9 @@ # Now, we [simulate](../autoapi/pooltool/index.rst#pooltool.simulate) the shot and then [continuize](../autoapi/pooltool/evolution/continuize/index.html#pooltool.evolution.continuize.continuize) it to store ball state data (like coordinates) in $10\text{ms}$ timestep intervals. # %% trusted=true -# Create a default physics engine and overwrite ball-ball model with frictionless, elastic model. +# Create a default physics engine, then overwrite ball-ball model with frictionless, elastic model. engine = pt.physics.PhysicsEngine() -engine.resolver.ball_ball = pt.physics.get_ball_ball_model(pt.physics.BallBallModel.FRICTIONLESS_ELASTIC) +engine.resolver.ball_ball = pt.physics.ball_ball_models[pt.physics.BallBallModel.FRICTIONLESS_ELASTIC]() pt.simulate(system, engine=engine, inplace=True) pt.continuize(system, dt=0.01, inplace=True) diff --git a/pooltool/physics/__init__.py b/pooltool/physics/__init__.py index 6721aa0a..c8fe53c6 100644 --- a/pooltool/physics/__init__.py +++ b/pooltool/physics/__init__.py @@ -5,16 +5,20 @@ from pooltool.physics.resolve.ball_ball import ( BallBallCollisionStrategy, BallBallModel, + ball_ball_models, ) from pooltool.physics.resolve.ball_cushion import ( BallCCushionCollisionStrategy, BallCCushionModel, BallLCushionCollisionStrategy, BallLCushionModel, + ball_ccushion_models, + ball_lcushion_models, ) from pooltool.physics.resolve.ball_pocket import ( BallPocketModel, BallPocketStrategy, + ball_pocket_models, ) from pooltool.physics.resolve.resolver import ( RESOLVER_PATH, @@ -23,10 +27,12 @@ from pooltool.physics.resolve.stick_ball import ( StickBallCollisionStrategy, StickBallModel, + stick_ball_models, ) from pooltool.physics.resolve.transition import ( BallTransitionModel, BallTransitionStrategy, + ball_transition_models, ) __all__ = [ @@ -47,4 +53,10 @@ "BallPocketModel", "StickBallModel", "BallTransitionModel", + "ball_ball_models", + "ball_lcushion_models", + "ball_ccushion_models", + "ball_pocket_models", + "stick_ball_models", + "ball_transition_models", ]