NAME

Physics::Balls::World - a surface, its walls, noses and gates, and the constants

VERSION

Version 0.01

SYNOPSIS

my $world = Physics::Balls::World->from_table($table,
    mu => { s => 0.2, r => 0.015, sp => 0.044 },
    e  => { bb => 0.95, c => 0.8, cf => 0.2, rc => 0.7 },
    vmax => 8,
);

# or straight from geometry you built yourself, in metres
my $world = Physics::Balls::World->new(L => 2.54, W => 1.27, R => 0.028575,
    walls => \@walls, noses => \@noses, gates => \@gates);

DESCRIPTION

Everything the engine needs to know before a strike. A world is built once and shared between shots; the C engine behind it is created on the first strike and freed with the world.

ATTRIBUTES

L

W

R

The playing area and the ball radius, metres.

g

Gravity, default 9.81.

vmax

The speed of a full-power strike, metres per second, default 8.

mu

s sliding, r rolling and sp spinning friction, defaults 0.2, 0.02 and 0.044.

e

bb ball-ball restitution, c cushion restitution, cf cushion friction and rc the share of a ball's roll a cushion keeps, defaults 0.95, 0.8, 0.2 and 0.7.

walls

noses

gates

As Physics::Balls::Table returns them.

engine

The Physics::Balls::Engine, built lazily.

METHODS

from_table

my $world = Physics::Balls::World->from_table($table, %constants);

description

The hash the engine is built from.