Your message dated Sat, 12 Mar 2005 15:38:31 +0100
with message-id <[EMAIL PROTECTED]>
and subject line This is fixed
has caused the attached Bug report to be marked as done.
This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.
(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere. Please contact me immediately.)
Debian bug tracking system administrator
(administrator, Debian Bugs database)
--------------------------------------
Received: (at submit) by bugs.debian.org; 26 Sep 2002 06:15:19 +0000
>From [EMAIL PROTECTED] Thu Sep 26 01:15:19 2002
Return-path: <[EMAIL PROTECTED]>
Received: from bgm-66-24-228-252.stny.rr.com (ivanhoe.blckknght.org)
[66.24.228.252]
by master.debian.org with esmtp (Exim 3.12 1 (Debian))
id 17uRvj-00079H-00; Thu, 26 Sep 2002 01:15:19 -0500
Received: by ivanhoe.blckknght.org (Postfix, from userid 1000)
id B7B54C95F; Thu, 26 Sep 2002 02:14:44 -0400 (EDT)
Date: Thu, 26 Sep 2002 02:14:44 -0400
From: Steven Barker <[EMAIL PROTECTED]>
To: Debian Bug Tracking System <[EMAIL PROTECTED]>
Subject: xscreensaver: fluidballs hack shows bogus physics
Message-ID: <[EMAIL PROTECTED]>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.4i
X-Reportbug-Version: 1.99.60
Delivered-To: [EMAIL PROTECTED]
Package: xscreensaver
Version: 4.05-9
Severity: wishlist
Tags: upstream patch
The fluidballs hack shows a number of balls bouncing around off the sides of
the screen. If you watch it for a bit, you'll notice that it's physics
implementation has some issues with respect to things like conservation of
momentum. Because bogus physics annoys me, I put together a patch (included
below) to fix the physics routine (and the coresponding part of the docs).
The fixed hack looks far more natural, and is more interesting than the
buggy version.
Please forward the fix to xscreensaver's upstream, so they can include it in
their releases. Until they do, please consider including it in future Debian
builds.
Thanks a lot for your work maintaining xscreensaver for Debian!
-----begin patch-----
diff -ru xscreensaver-4.05/hacks/fluidballs.c
xscreensaver-4.05-modified/hacks/fluidballs.c
--- xscreensaver-4.05/hacks/fluidballs.c 2002-04-30 23:53:09.000000000
-0400
+++ xscreensaver-4.05-modified/hacks/fluidballs.c 2002-09-26
01:45:08.000000000 -0400
@@ -52,7 +52,7 @@
float *r; /* ball radiuses */
float *m; /* ball mass, precalculated */
- float e; /* coefficient of friction, I think? */
+ float e; /* coeficient of elasticity */
float max_radius; /* largest radius of any ball */
Bool random_sizes_p; /* Whether balls should be various sizes up to max. */
@@ -243,7 +243,7 @@
state->accy = get_float_resource ("gravity", "Gravity");
if (state->accy < -1.0 || state->accy > 1.0) state->accy = 0.01;
- state->e = get_float_resource ("friction", "Friction");
+ state->e = get_float_resource ("elasticity", "Elacitcity");
if (state->e < 0.2 || state->e > 1.0) state->e = 0.97;
state->tc = get_float_resource ("timeScale", "TimeScale");
@@ -468,7 +468,7 @@
{
int a, b;
float d, vxa, vya, vxb, vyb, dd, cdx, cdy;
- float ma, mb, vela, velb, vela1, velb1;
+ float ma, mb, vca, vcb, dva, dvb;
float dee2;
check_window_moved (state);
@@ -492,71 +492,68 @@
}
/* For each ball, compute the influence of every other ball. */
- for (a=1; a <= state->count; a++)
- if (a != state->mouse_ball)
- for (b=1; b <= state->count; b++)
- if (a != b)
- {
- d = ((state->px[a] - state->px[b]) *
- (state->px[a] - state->px[b]) +
- (state->py[a] - state->py[b]) *
- (state->py[a] - state->py[b]));
- dee2 = (state->r[a] + state->r[b]) *
- (state->r[a] + state->r[b]);
- if (d < dee2)
- {
- state->collision_count++;
- d = sqrt(d);
- dd = state->r[a] + state->r[b] - d;
- /* A pair of balls that have already collided in this
- * current frame (and therefore touching each other)
- * should not have another collision calculated, hence
- * the fallthru if "dd ~= 0.0".
- */
- if ((dd < -0.01) || (dd > 0.01))
- {
- cdx = (state->px[b] - state->px[a]) / d;
- cdy = (state->py[b] - state->py[a]) / d;
-
- /* Move each ball apart from the other by half the
- * 'collision' distance.
- */
- state->px[a] -= 0.5 * dd * cdx;
- state->py[a] -= 0.5 * dd * cdy;
- state->px[b] += 0.5 * dd * cdx;
- state->py[b] += 0.5 * dd * cdy;
-
- ma = state->m[a];
- mb = state->m[b];
- vxa = state->vx[a];
- vya = state->vy[a];
- vxb = state->vx[b];
- vyb = state->vy[b];
-
- vela = sqrt((vxa * vxa) + (vya * vya));
- velb = sqrt((vxb * vxb) + (vyb * vyb));
-
- vela1 = vela * ((ma - mb) / (ma + mb)) +
- velb * ((2 * mb) / (ma + mb));
- velb1 = vela * ((2 * ma) / (ma + mb)) +
- velb * ((mb - ma) / (ma + mb));
-
- vela1 *= state->e; /* "air resistance" */
- velb1 *= state->e;
+ for (a=1; a <= state->count - 1; a++)
+ for (b=a + 1; b <= state->count; b++)
+ {
+ d = ((state->px[a] - state->px[b]) *
+ (state->px[a] - state->px[b]) +
+ (state->py[a] - state->py[b]) *
+ (state->py[a] - state->py[b]));
+ dee2 = (state->r[a] + state->r[b]) *
+ (state->r[a] + state->r[b]);
+ if (d < dee2)
+ {
+ state->collision_count++;
+ d = sqrt(d);
+ dd = state->r[a] + state->r[b] - d;
+
+ cdx = (state->px[b] - state->px[a]) / d;
+ cdy = (state->py[b] - state->py[a]) / d;
+
+ /* Move each ball apart from the other by half the
+ * 'collision' distance.
+ */
+ state->px[a] -= 0.5 * dd * cdx;
+ state->py[a] -= 0.5 * dd * cdy;
+ state->px[b] += 0.5 * dd * cdx;
+ state->py[b] += 0.5 * dd * cdy;
+
+ ma = state->m[a];
+ mb = state->m[b];
+
+ vxa = state->vx[a];
+ vya = state->vy[a];
+ vxb = state->vx[b];
+ vyb = state->vy[b];
+
+ vca = vxa * cdx + vya * cdy; /* the component of each velocity */
+ vcb = vxb * cdx + vyb * cdy; /* along the axis of the collision */
+
+ dva = (vca * (ma - mb) + vcb * 2 * mb) / (ma + mb) - vca; /*
elastic collison */
+ dvb = (vcb * (mb - ma) + vca * 2 * ma) / (ma + mb) - vcb;
+
+ dva *= state->e; /* some energy lost to inelasticity */
+ dvb *= state->e;
+
#if 0
- vela1 += (frand (50) - 25) / ma; /* brownian motion */
- velb1 += (frand (50) - 25) / mb;
+ dva += (frand (50) - 25) / ma; /* brownian motion */
+ dvb += (frand (50) - 25) / mb;
#endif
- state->vx[a] = -cdx * vela1;
- state->vy[a] = -cdy * vela1;
- state->vx[b] = cdx * velb1;
- state->vy[b] = cdy * velb1;
- }
- }
- }
-
- /* Force all balls to be on screen.
- */
+
+ vxa += dva * cdx;
+ vya += dva * cdy;
+ vxb += dvb * cdx;
+ vyb += dvb * cdy;
+
+ state->vx[a] = vxa;
+ state->vy[a] = vya;
+ state->vx[b] = vxb;
+ state->vy[b] = vyb;
+ }
+ }
+
+ /* Force all balls to be on screen.
+ */
for (a=1; a <= state->count; a++)
{
if (state->px[a] <= (state->xmin + state->r[a]))
@@ -655,7 +652,7 @@
"*random: True",
"*gravity: 0.01",
"*wind: 0.00",
- "*friction: 0.8",
+ "*elasticity: 0.97",
"*timeScale: 1.0",
"*doFPS: False",
"*shake: True",
@@ -670,7 +667,7 @@
{ "-count", ".count", XrmoptionSepArg, 0 },
{ "-gravity", ".gravity", XrmoptionSepArg, 0 },
{ "-wind", ".wind", XrmoptionSepArg, 0 },
- { "-friction", ".friction", XrmoptionSepArg, 0 },
+ { "-elasticity", ".elasticity", XrmoptionSepArg, 0 },
{ "-fps", ".doFPS", XrmoptionNoArg, "True" },
{ "-no-fps", ".doFPS", XrmoptionNoArg, "False" },
{ "-shake", ".shake", XrmoptionNoArg, "True" },
diff -ru xscreensaver-4.05/hacks/fluidballs.man
xscreensaver-4.05-modified/hacks/fluidballs.man
--- xscreensaver-4.05/hacks/fluidballs.man 2002-09-26 01:42:26.000000000
-0400
+++ xscreensaver-4.05-modified/hacks/fluidballs.man 2002-09-26
01:41:27.000000000 -0400
@@ -11,7 +11,7 @@
[\-size \fInumber\fP]
[\-gravity \fInumber\fP]
[\-wind \fInumber\fP]
-[\-friction \fInumber\fP]
+[\-elasticity \fInumber\fP]
[\-delay \fInumber\fP]
[\-nonrandom]
[\-no-shake]
@@ -45,8 +45,8 @@
.B \-wind \fInumber\fP
Wind. Useful values are < 0.1. Default: 0.00.
.TP 8
-.B \-friction \fInumber\fP
-Coefficient of friction (or viscosity.) Useful values are < 4. Default: 0.8.
+.B \-elasticity \fInumber\fP
+Coefficient of elasticity. Useful values are < 1.0. Default: 0.97.
.TP 8
.B \-delay \fInumber\fP
Per-frame delay, in microseconds. Default: 10000 (0.01 seconds.).
-----end patch-----
-- System Information:
Debian Release: testing/unstable
Architecture: i386
Kernel: Linux ivanhoe.blckknght.org 2.4.19-local #1 Mon Sep 9 00:10:27 EDT 2002
i686
Locale: LANG=en_US, LC_CTYPE=
Versions of packages xscreensaver depends on:
ii libc6 2.2.5-14.3 GNU C Library: Shared libraries an
ii libgdk-pixbuf2 0.19.0-2 The GdkPixBuf library.
ii libglib1.2 1.2.10-6 The GLib library of C routines
ii libgtk1.2 1.2.10-14 The GIMP Toolkit set of widgets fo
ii libjpeg62 6b-6 The Independent JPEG Group's JPEG
ii libpam0g 0.72-35 Pluggable Authentication Modules l
ii xlibs 4.1.0-17 X Window System client libraries
ii xscreensaver-gnome 4.05-9 GNOME binaries for xscreensaver
-- no debconf information
--
Steven Barker [EMAIL PROTECTED]
A few hours grace before the madness begins again.
Get my GnuPG public key at: http://www.blckknght.org/publickey.asc
Fingerprint: 272A 3EC8 52CE F22B F745 775E 5292 F743 EBD5 936B
---------------------------------------
Received: (at 162390-done) by bugs.debian.org; 12 Mar 2005 14:38:35 +0000
>From [EMAIL PROTECTED] Sat Mar 12 06:38:35 2005
Return-path: <[EMAIL PROTECTED]>
Received: from mail.charite.de [160.45.207.131]
by spohr.debian.org with esmtp (Exim 3.35 1 (Debian))
id 1DA7lC-0006Ob-00; Sat, 12 Mar 2005 06:38:35 -0800
Received: from postamt.charite.de (postamt-ext.charite.de [160.45.207.132])
(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
(Client did not present a certificate)
by mail.charite.de (Postfix) with ESMTP id 79FE12208EA
for <[EMAIL PROTECTED]>; Sat, 12 Mar 2005 15:38:37 +0100 (CET)
Received: by postamt.charite.de (Postfix, from userid 7945)
id F0938220776; Sat, 12 Mar 2005 15:38:31 +0100 (CET)
Date: Sat, 12 Mar 2005 15:38:31 +0100
From: Ralf Hildebrandt <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: This is fixed
Message-ID: <[EMAIL PROTECTED]>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.5.6+20040907i
X-Virus-Scanned: amavisd-new at charite.de
Delivered-To: [EMAIL PROTECTED]
X-Spam-Checker-Version: SpamAssassin 2.60-bugs.debian.org_2005_01_02
(1.212-2003-09-23-exp) on spohr.debian.org
X-Spam-Status: No, hits=-3.0 required=4.0 tests=BAYES_00 autolearn=no
version=2.60-bugs.debian.org_2005_01_02
X-Spam-Level:
This is fixed since 4.08:
4.08
18-Feb-2003
New hacks, atunnels and piecewise.
Physics improvement in fluidballs.
Various fixes for XDarwin systems (X11 on MacOS X.)
Added -clock option to barcode.
Minor fixes to endgame, flurry, flipscreen3d, and gflux.
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]