NAME

Physics::Balls::Engine - the door to the C engine

VERSION

Version 0.01

SYNOPSIS

my $engine = Physics::Balls::Engine->new(%description);
my $raw = $engine->strike(\@layout, { ball => 0, dx => 1_000_000, dy => 0, power => 500, sx => 0, sy => 0 });

DESCRIPTION

Owns one world and frees it when it goes away. Physics::Balls::World builds one of these lazily and Physics::Balls::Strike calls it; nothing else needs to. The description and the answer are the plain hashes and arrays the outcome classes wrap, in the shape the prototype's fixtures use.

METHODS

new

my $engine = Physics::Balls::Engine->new(L => ..., W => ..., R => ..., walls => [...], noses => [...], gates => [...], mu => {...}, e => {...}, vmax => 8, g => 9.81);

strike

my $raw = $engine->strike(\@layout, \%shot);

Returns a hash with t, n, error, events, rest, holed, segments and, when $shot->{trace} is set, energy.

DESTROY

Frees the world.