Skip to content

Commit

Permalink
Update example
Browse files Browse the repository at this point in the history
  • Loading branch information
ekiefl committed Jan 8, 2025
1 parent b4d5fa5 commit 9a149ad
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docs/examples/30_degree_rule.pct.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
12 changes: 12 additions & 0 deletions pooltool/physics/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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__ = [
Expand 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",
]

0 comments on commit 9a149ad

Please sign in to comment.