Top Banner
ElastoLab A Physics Playground for Kids David Buck Simberon Inc. www.simberon.com
25

ElastoLab A Physics Playground for Kids David Buck Simberon Inc. .

Dec 18, 2015

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: ElastoLab A Physics Playground for Kids David Buck Simberon Inc. .

ElastoLabA Physics Playground for Kids

David BuckSimberon Inc.

www.simberon.com

Page 2: ElastoLab A Physics Playground for Kids David Buck Simberon Inc. .

History

• Started as a Master’s thesis – 1990 Smalltalk

• Re-wrote in C++ (1993)• Close to release (1996)• Rewrote in Smalltalk (1998)• Released for sale (2001)• Physics re-written in Smalltalk

(2002)

Page 3: ElastoLab A Physics Playground for Kids David Buck Simberon Inc. .

Demo

Page 4: ElastoLab A Physics Playground for Kids David Buck Simberon Inc. .

Physics

• How do you simulate physics?• Easy:

– Calculate the forces on each particle.– a = F/m– Add a bit of the acceleration to the

velocity– Add a bit of the velocity to the

position– Repeat– Euler’s method

Page 5: ElastoLab A Physics Playground for Kids David Buck Simberon Inc. .

Problem

• Falling particles work great• Springs explode when the

strength gets too high

Page 6: ElastoLab A Physics Playground for Kids David Buck Simberon Inc. .

Solution: Runge Kutta

• Calculate forces 4 times, combine results.

Page 7: ElastoLab A Physics Playground for Kids David Buck Simberon Inc. .

Better

• But really strong springs still explode.• Solution: Adaptive Runge Kutta• Adapt step size according to error

between single and double steps.

Page 8: ElastoLab A Physics Playground for Kids David Buck Simberon Inc. .

Barriers

• Easy – you just reflect the particle’s position and velocity by the barrier

Page 9: ElastoLab A Physics Playground for Kids David Buck Simberon Inc. .

Umm… Problem

• Springs explode and rigid bodies don’t spin.

• Solution: Step forward to the time of collision then apply an impulse to the particle

Page 10: ElastoLab A Physics Playground for Kids David Buck Simberon Inc. .

What time is the collision?

• How do we know what time the particle hit?

• What if many particles hit around the same time – which hit first?

Page 11: ElastoLab A Physics Playground for Kids David Buck Simberon Inc. .

Solution

• Use Bisection Method to narrow down time of first collision.

Page 12: ElastoLab A Physics Playground for Kids David Buck Simberon Inc. .

Resting Contact?

• What happens if the particle is sitting on the barrier? Collision time is almost zero.

Page 13: ElastoLab A Physics Playground for Kids David Buck Simberon Inc. .

Dynamic Constraints

• Detect resting contacts and add a dynamic constraint force.

• The constraint force is a force just strong enough to prevent the particle from penetrating the barrier.

Net Force

Constraint Force

Page 14: ElastoLab A Physics Playground for Kids David Buck Simberon Inc. .

Multiple resting contacts

• What happens if a particle is in resting contact with two or more barriers?

Page 15: ElastoLab A Physics Playground for Kids David Buck Simberon Inc. .

Solution

• Use Quadratic Programming or Baraff [94]

• <uncle>• Ok, just stop the particle and

hope nobody notices.

Page 16: ElastoLab A Physics Playground for Kids David Buck Simberon Inc. .

User Interface

• Every physics object has a corresponding “Display” object.

• A “Camera” defines the transformation from world to display and back.

• Clipping implemented for lines and polygons.

Page 17: ElastoLab A Physics Playground for Kids David Buck Simberon Inc. .

Custom Widgets

• Custom widgets enhance the appearance of ElastoLab.

Page 18: ElastoLab A Physics Playground for Kids David Buck Simberon Inc. .

Interfacing to Sound

• Smalltalk calls a C DLL I wrote• The C DLL calls the COM

interface to access the DirectX 8 sound facilities.

Page 19: ElastoLab A Physics Playground for Kids David Buck Simberon Inc. .

Help Facilities

• Three kinds of help– Fly by help– Help mode – Windows help files– Guided tour

Page 20: ElastoLab A Physics Playground for Kids David Buck Simberon Inc. .

Guided Tour

Page 21: ElastoLab A Physics Playground for Kids David Buck Simberon Inc. .

Source Code Management

• For C++, I just made copies of the source files.

• Smalltalk: StORE using a Postgres database.

• ElastoLab consists of 2 bundles, 15 packages, 300 classes.

Page 22: ElastoLab A Physics Playground for Kids David Buck Simberon Inc. .

Making it Fast

• Displaying bitmaps works much faster if you use convertForGraphicsDevice: and cache the result.

• High level optimizations better than low level optimizations

Page 23: ElastoLab A Physics Playground for Kids David Buck Simberon Inc. .

Packaging

• Runtime Packager used for stripping image.

• ResHacker used to create one executable.

• InstallShield Express used to install.

Page 24: ElastoLab A Physics Playground for Kids David Buck Simberon Inc. .

Message Board

• Online message board runs on Web Toolkit.

• SSL pages link to Smalltalk servlets

• Small app (4 classes)

Page 25: ElastoLab A Physics Playground for Kids David Buck Simberon Inc. .

Wrap Up

• Smalltalk is quite fast enough to handle ElastoLab.

• Flexibility of Smalltalk is a big advantage.

• Packaging can create a single executable that fits into the Windows environment.

• SSP pages and Smalltalk servlets can be used to build community with a message board.