NAME
Physics::Balls::Table - a rectangular table with six pockets, as walls, noses and gates
VERSION
Version 0.01
SYNOPSIS
my $table = Physics::Balls::Table->new(
L => 3.569, W => 1.778, R => 0.02625,
corner => { mouth => 0.086, jaw_deg => 142, shelf => 0.030 },
side => { mouth => 0.095, jaw_deg => 104, shelf => 0.008 },
);
my $walls = $table->walls; # 24 segments, cloth on the left
my $gates = $table->gates; # 6 capture lines, one per pocket
DESCRIPTION
Geometry only, in whatever unit you give it (metres for the engine). The playing area is L by W between the cushion noses; each pocket is a cup whose jaws leave the cushion line at the cut angle and run to a back wall deep enough for a ball's centre to cross the gate, and the gate sits shelf beyond the line between the noses. The boundary is walked counter-clockwise, so every wall's left normal points into play, and every vertex is a nose point a ball can rattle off. Pockets are numbered bottom-left, bottom side, bottom-right, top-right, top side, top-left, with the long side along L.
What the numbers should be is a game's business: the WPA publishes a pool table's, the WPBSA rulebook does not publish snooker's.
ATTRIBUTES
L
W
R
The playing area and the ball radius.
corner
side
Hashes of mouth (between the noses), jaw_deg (the cut angle) and shelf (from the mouth line to the drop).
geometry
The built hash: points, walls, noses, gates, pockets.
METHODS
walls
[x1, y1, x2, y2] per wall.
noses
[x, y] per vertex.
gates
[x1, y1, x2, y2, nx, ny, pocket] per pocket, the normal into the pocket.
pockets
One hash per pocket: points, gate, hole (where to draw it), mouth, u (the axis into the pocket), index.
points
The boundary, counter-clockwise.