bowntz: audio-visual pseudo-physical simulation of colliding circles

[ demo, gpl, program ] [ Propose Tags ] [ Report a vulnerability ]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 0, 1, 2
Dependencies base (>=4.8 && <4.10), containers (>=0.5 && <0.6), GLUT (>=2.7 && <2.8), hosc (>=0.15 && <0.16), hsc3 (>=0.15 && <0.16), random (>=1.1 && <1.2) [details]
License GPL-3.0-only
Copyright 2010,2013,2015,2016 Claude Heiland-Allen
Author Claude Heiland-Allen
Maintainer claude@mathr.co.uk
Category Demo
Home page https://code.mathr.co.uk/bowntz
Source repo head: git clone https://code.mathr.co.uk/bowntz.git
this: git clone https://code.mathr.co.uk/bowntz.git(tag v1)
Uploaded by ClaudeHeilandAllen at 2016-06-18T00:10:13Z
Distributions
Reverse Dependencies 1 direct, 0 indirect [details]
Executables bowntz
Downloads 1979 total (8 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
Last success reported on 2016-10-27 [all 4 reports]

Readme for bowntz-1

[back to package description]
Bowntz -- an audio-visual pseudo-physical simulation of colliding circles
Copyright (C) 2010,2013,2015,2016 Claude-Heiland-Allen <claude@mathr.co.uk>


Build
-----

    $ ghc -O2 -Wall --make bowntz.hs

    Bowntz requires hsc3 >= 0.8 (newer than Hackage, as of 2010-03-12).


Usage
-----

    $ scsynth -u 57110 &
    -- wait for scsynth to start, connect its JACK ports --
    $ ./bowntz

    Bowntz requires a "clean" SC3 server to be running on its usual port.
    Bowntz leaves this SC3 server in an "unclean" state when it exits.

    This situation is far from ideal, but it's the current state of the code.


Notes
-----

    The world is a collection of N circles which each move at a constant speed
    in a straight line (in the absence of collisions).  Given two such circles
    it is possible to calculate the precise time of their next collision.  For
    N circles, O(N^2) such "next" collisions may occur.

    Pick the soonest next collision between circles A and B.  This collision
    will change the velocities of A and B, but no other circle.  Update the
    collection of collisions, by removing all the other "next" collisions
    involving either A or B, and computing the new collisions of A and B with
    all the other circles (O(N) collisions).  For maintaining a consistent
    time-base for all circles in the world, it makes sense to advance in a
    straight line each circle to its position at the time of the collision.

    Given a world at time T, to find the world at time T+dT simply step
    through the future collisions one by one until the soonest collision is
    after T+dT, at which point one can just advance the circles in straight
    lines to T+dT.

        T       T+1      T+2      T+3      T+4      T+5      T+6      T+7
    ... |        |        |        |        |        |        |        | ...
        ----*---*---*---------*---------------**-*--*-*-------*------*--

    Care needs to be taken in case of numerical imprecision: one can get an
    infinite number of collisions without time increasing.


To do
-----

    General code clean-up and documentation.

    Optimizations based on collision possibility tree, example:

        A               7 possible
        |               A~*~B
        +---B           A~*~E    5 impossible
        |   +---C       B~*~C    !A~*~C
        |   +---D       B~*~D    !A~*~D
        |               C~*~D    !C~*~F
        +---E           B~*~E    !D~*~F
            +---F       E~*~F    !A~*~F

        data Node = Node ID [Node]
        possibles n@(Node _ ns) = possible n `map` ns ++ liftM2 possible ns

    Infinite zoom into circles within circles within circles within circles?
    When (if ever) would it be safe to prune "outside"?

    Some kind of loop where circles contain themselves (I did try this in
    another unreleased version but it resulted in hyperexponential kinetic
    energy increase, which naturally caused problems).

    Non-flat space.

    Angular momentum affecting collisions.

    Remove all sources of non-determinism to enable two-pass rendering:
        1 pass to record audio from SC3    in realtime
        2 pass to record video from OpenGL in non-realtime
    Or just record ball positions in the first pass for later drawing (because
    callback races and/or timing instability might affect the reproducibility
    unless very precise care is taken at all stages..)

    Interactivity.

    More impressive audio-visuals.


Won't
-----

    Anything other than circles (ok, maybe infinite lines would be ok, but
    asymmetry with angular momentum would quickly make collision detection
    get horribly complicated).


Legal
-----

    License: GPL

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.