100% found this document useful (1 vote)
24 views

Physics for Flash Games Animation and Simulations 1st ed. 2011 Edition Ramtal - Explore the complete ebook content with the fastest download

The document provides information about various eBooks available for download at ebookname.com, including titles on physics for animation, flash games, and other subjects. It lists multiple eBooks with their respective links and brief descriptions, highlighting the availability of instant digital formats. Additionally, it includes details about the authors, copyright information, and a comprehensive table of contents for a specific title on physics programming.

Uploaded by

sinaledroogh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
24 views

Physics for Flash Games Animation and Simulations 1st ed. 2011 Edition Ramtal - Explore the complete ebook content with the fastest download

The document provides information about various eBooks available for download at ebookname.com, including titles on physics for animation, flash games, and other subjects. It lists multiple eBooks with their respective links and brief descriptions, highlighting the availability of instant digital formats. Additionally, it includes details about the authors, copyright information, and a comprehensive table of contents for a specific title on physics programming.

Uploaded by

sinaledroogh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 42

Endless Ebook, One Click Away – Start Downloading at ebookname.

com

Physics for Flash Games Animation and Simulations


1st ed. 2011 Edition Ramtal

https://ebookname.com/product/physics-for-flash-games-
animation-and-simulations-1st-ed-2011-edition-ramtal/

OR CLICK HERE

DOWLOAD EBOOK

Browse and Get More Ebook Downloads Instantly at https://ebookname.com


Click here to visit ebookname.com and download ebook now
Instant digital products (PDF, ePub, MOBI) available
Download now and explore formats that suit you...

Foundation Flash Cartoon Animation 1st Edition Tim


Jones

https://ebookname.com/product/foundation-flash-cartoon-
animation-1st-edition-tim-jones/

Comics for film games and animation using comics to


construct your transmedia storyworld 1st Edition Weaver

https://ebookname.com/product/comics-for-film-games-and-
animation-using-comics-to-construct-your-transmedia-
storyworld-1st-edition-weaver/

How to Cheat in Adobe Flash CS4 The Art of Design and


Animation Chris Georgenes

https://ebookname.com/product/how-to-cheat-in-adobe-flash-
cs4-the-art-of-design-and-animation-chris-georgenes/

Qualitative Cusp Catastrophe Risk Based Model for


Describing Noise Induced Hearing Loss 1st Edition
Salvatore Sebastiano Gambacorta

https://ebookname.com/product/qualitative-cusp-catastrophe-risk-
based-model-for-describing-noise-induced-hearing-loss-1st-
edition-salvatore-sebastiano-gambacorta/
A Terrible Beauty is Born Clones Genes and the Future
of Mankind Science Spectra 1st Edition Brendan Curran

https://ebookname.com/product/a-terrible-beauty-is-born-clones-
genes-and-the-future-of-mankind-science-spectra-1st-edition-
brendan-curran/

Oliver Twist Webster s Thesaurus Edition Charles


Dickens

https://ebookname.com/product/oliver-twist-webster-s-thesaurus-
edition-charles-dickens/

Stress Busting 1st Edition Michael Papworth

https://ebookname.com/product/stress-busting-1st-edition-michael-
papworth/

Empirical Paradox Complexity Thinking and Generating


New Kinds of Knowledge 1st Edition Paolo Grigolini
Bruce J. West

https://ebookname.com/product/empirical-paradox-complexity-
thinking-and-generating-new-kinds-of-knowledge-1st-edition-paolo-
grigolini-bruce-j-west/

Vicarious Trauma and Disaster Mental Health


Understanding Risks and Promoting Resilience 1st
Edition Gertie Quitangon (Editor)

https://ebookname.com/product/vicarious-trauma-and-disaster-
mental-health-understanding-risks-and-promoting-resilience-1st-
edition-gertie-quitangon-editor/
The Secret Wars of Judi Bari A Car Bomb the Fight for
the Redwoods and the End of Earth First Kate Coleman

https://ebookname.com/product/the-secret-wars-of-judi-bari-a-car-
bomb-the-fight-for-the-redwoods-and-the-end-of-earth-first-kate-
coleman/
The Essential Guide
to Physics for Flash
Games, Animation,
and Simulations
Dev Ramtal
Adrian Dobre
The Essential Guide to Physics for
Flash Games, Animation, and
Simulations
Copyright © 2011 by Dev Ramtal and Adrian Dobre
All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means, electronic or
mechanical, including photocopying, recording, or by any information storage or retrieval system, without the prior written
permission of the copyright owner and the publisher.
ISBN-13 (pbk): 978-1-4302-3674-0
ISBN-13 (electronic): 978-1-4302-3675-7
Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol with every
occurrence of a trademarked name, logos, or image we use the names, logos, or images only in an editorial fashion and to
the benefit of the trademark owner, with no intention of infringement of the trademark.
The use in this publication of trade names, service marks, and similar terms, even if they are not identified as such, is not to
be taken as an expression of opinion as to whether or not they are subject to proprietary rights.
Distributed to the book trade worldwide by Springer Science+Business Media LLC., 233 Spring Street, 6th Floor, New York,
NY 10013. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail orders-ny@springer-sbm.com, or visit
www.springeronline.com.
For information on translations, please e-mail rights@apress.com or visit www.apress.com.
Apress and friends of ED books may be purchased in bulk for academic, corporate, or promotional use. eBook versions
and licenses are also available for most titles. For more information, reference our Special Bulk Sales–eBook Licensing
web page at www.apress.com/bulk-sales.
The information in this book is distributed on an “as is” basis, without warranty. Although every precaution has been taken
in the preparation of this work, neither the author(s) nor Apress shall have any liability to any person or entity with respect to
any loss or damage caused or alleged to be caused directly or indirectly by the information contained in this work.
The source code for this book is freely available to readers at www.apress.com in the Downloads section.

Credits
President and Publisher: Coordinating Editor:
Paul Manning Corbin Collins
Lead Editor: Copy Editor:
Chris Nelson Nancy Sixsmith
Technical Reviewer: Compositor:
RJ Owen Apress Production (Christine Ricketts)
Editorial Board: Indexer:
Steve Anglin, Mark Beckner, SPI Global
Ewan Buckingham, Gary Cornell,
Jonathan Gennick, Jonathan Hassell, Artist:
Michelle Lowman, James Markham, SPI Global
Matthew Moodie, Jeff Olson, Jeffrey Pepper, Cover Artist:
Frank Pohlmann, Douglas Pundick, Anna Ishchenko
Ben Renow-Clarke, Dominic Shakeshaft,
Matt Wade, Tom Welsh Cover Designer:
Corné van Dooren

ii
To my mother, who made me possible; and to my wife and daughter, who
supported me in making this book possible.
–DR
To my family who have been so understanding while I have been away from
them working on this book.
–AD
Contents at a Glance

Contents at a Glance .................................................................................................. iv!

Contents ...................................................................................................................... vi!

About the Authors ................................................................................................... xvii!

About the Technical Reviewer ............................................................................... xviii!

About the Cover Image Artist .................................................................................. xix!

Acknowledgments ..................................................................................................... xx!

Preface ....................................................................................................................... xxi

Part I: The Basics

Chapter 1: Introduction to Physics Programming .................................................... 3!

Chapter 2: Selected ActionScript 3.0 Topics .......................................................... 13!

Chapter 3: Some Math Background ......................................................................... 45!

Chapter 4: Basic Physics Concepts......................................................................... 91!

Part II: Particles, Forces and Motion

Chapter 5: The Laws Governing Motion ................................................................ 135!

Chapter 6: Gravity, Orbits, and Rockets ................................................................ 157!

Chapter 7: Contact and Fluid Forces ..................................................................... 181!

Chapter 8: Restoring Forces: Springs and Oscillations ...................................... 221!

Chapter 9: Centripetal Forces: Rotational Motion ................................................ 251!

Chapter 10: Long-Range Forces ............................................................................ 281

iv
Contents at a Glance

Part III: Multi-particle and Extended Systems

Chapter 11: Collisions ............................................................................................. 321!

Chapter 12: Particle Systems ................................................................................. 359!

Chapter 13: Extended Objects ................................................................................ 395!

Part IV: Building More Complex Simulations

Chapter 14: Numerical Integration Schemes ........................................................ 443!

Chapter 15: Other Technical Issues ....................................................................... 461!

Chapter 16: Simulation Projects............................................................................. 481!

Index.......................................................................................................................... 517!

v
Contents

Contents at a Glance .................................................................................................. iv!

Contents ...................................................................................................................... vi!

About the Authors ................................................................................................... xvii!

About the Technical Reviewer ............................................................................... xviii!

About the Cover Image Artist .................................................................................. xix!

Acknowledgments ..................................................................................................... xx!

Preface ....................................................................................................................... xxi!


What this book will (and won’t) teach you .............................................................................. xxi!
Overview of this book .............................................................................................................xxii!
Source code and examples ....................................................................................................xxii!
Part I: The Basics
Chapter 1: Introduction to Physics Programming .................................................... 3!
Why model real physics? .......................................................................................................... 3!
Creating realistic animation effects ....................................................................................... 4!
Creating realistic games ........................................................................................................ 4!
Building simulations and models ........................................................................................... 4!
Generating art from code ...................................................................................................... 4!
Can’t I just use a physics engine? ......................................................................................... 5!
What is physics?........................................................................................................................ 6!
Everything behaves according to the laws of physics ........................................................... 6!
The laws can be written as math equations .......................................................................... 6!
Predicting motion ................................................................................................................... 7!
Programming physics ................................................................................................................ 7!
The difference between animation and simulation ................................................................ 8!
The laws of physics are simple ............................................................................................. 8!
Hence, they can be readily coded up! ................................................................................... 8!
The four steps for programming physics ............................................................................... 9!
A simple example ...................................................................................................................... 9!
A bouncing ball: the physics ................................................................................................ 10!
Coding up a bouncing ball in 2D ......................................................................................... 10!
Summary ................................................................................................................................. 12!
vi
Contents

Chapter 2: Selected ActionScript 3.0 Topics .......................................................... 13!


ActionScript 3.0 classes .......................................................................................................... 14!
Classes and objects ............................................................................................................ 14!
Structure of an AS3.0 class ................................................................................................. 15!
Functions, methods and constructors ................................................................................. 16!
Properties ............................................................................................................................ 16!
Static methods and properties ............................................................................................. 17!
Inheritance ........................................................................................................................... 18!
ActionScript 3.0 language basics ............................................................................................ 18!
Variables and constants ...................................................................................................... 18!
Data types ........................................................................................................................... 19!
Operators ............................................................................................................................. 22!
Math ..................................................................................................................................... 23!
Logic .................................................................................................................................... 24!
Loops ................................................................................................................................... 25!
Events in ActionScript 3.0 ....................................................................................................... 27!
Event listeners and handlers ............................................................................................... 27!
Events and user interaction ................................................................................................. 28!
Drag and drop...................................................................................................................... 28!
The Flash coordinate system .................................................................................................. 29!
2D coordinates .................................................................................................................... 29!
3D in Flash .......................................................................................................................... 30!
The Flash drawing API ............................................................................................................ 32!
Drawing lines and curves .................................................................................................... 32!
Creating fills and gradients .................................................................................................. 33!
Example: Bouncing ball in a box ......................................................................................... 34!
Producing animation using code ............................................................................................. 36!
Using the built-in frame stepping as a clock ........................................................................ 36!
Using the Timer class .......................................................................................................... 37!
Using getTimer() to compute elapsed time ......................................................................... 38!
Precalculating motion .......................................................................................................... 40!
Collision detection ................................................................................................................... 40!
Using the hitTestObject() method........................................................................................ 41!
Using the hitTestPoint() method .......................................................................................... 41!
Distance-based collision detection ...................................................................................... 41!
Advanced collision detection ............................................................................................... 43!
Summary ................................................................................................................................. 43!

Chapter 3: Some Math Background ......................................................................... 45!


Coordinates and simple graphs............................................................................................... 46!
vii
Contents

Building a plotter: the Graph class ...................................................................................... 46!


Plotting functions using the Graph class ............................................................................. 47!
Straight lines ........................................................................................................................ 48!
Polynomial curves ............................................................................................................... 49!
Things that grow and decay: exponential and log functions ............................................... 50!
Making an object move along a curve ................................................................................. 52!
Distance between two points ............................................................................................... 59!
Basic trigonometry ................................................................................................................... 60!
Degrees and radians ........................................................................................................... 60!
The sine function ................................................................................................................. 61!
The cosine function ............................................................................................................. 63!
The tangent function ............................................................................................................ 63!
The inverse trig functions .................................................................................................... 64!
Using trig functions for animation ........................................................................................ 65!
Vectors and basic vector algebra ............................................................................................ 70!
What are vectors? ............................................................................................................... 70!
Vectors and scalars ............................................................................................................. 71!
Adding and subtracting vectors ........................................................................................... 72!
Resolving vectors: vector components................................................................................ 73!
Multiplying vectors: Scalar or dot product ........................................................................... 76!
Multiplying vectors: Vector or cross product ....................................................................... 77!
Building a Vector class with vector algebra ......................................................................... 79!
Simple calculus ideas .............................................................................................................. 80!
Slope of a line: gradient ....................................................................................................... 81!
Rates of change: derivatives ............................................................................................... 82!
Doing sums: integrals .......................................................................................................... 87!
Summary ................................................................................................................................. 89!

Chapter 4: Basic Physics Concepts......................................................................... 91!


General physics concepts and notation .................................................................................. 92!
Physical quantities and units ............................................................................................... 92!
Scientific notation ................................................................................................................ 92!
Things: particles and other objects in physics ......................................................................... 93!
What is a particle? ............................................................................................................... 93!
Particle properties................................................................................................................ 94!
Building a Particle class....................................................................................................... 94!
Moving particles: the Mover class ....................................................................................... 98!
Extending the Particle class .............................................................................................. 100!
Describing motion: kinematics............................................................................................... 103!
Concepts: displacement, velocity, speed, acceleration..................................................... 104!
viii
Contents

Combining vector quantities .............................................................................................. 107!


Describing motion using graphs ........................................................................................ 108!
Equations of motion for uniform acceleration .................................................................... 108!
Applying the equations to projectile motion ....................................................................... 110!
More motion-related concepts: inertia, mass, and momentum ......................................... 114!
Predicting motion: forces and dynamics ............................................................................... 114!
The cause of motion: forces .............................................................................................. 115!
The relationship between force, mass, and acceleration .................................................. 115!
Types of forces .................................................................................................................. 116!
Combining forces: force diagrams and resultant force...................................................... 117!
Forces in equilibrium ......................................................................................................... 118!
An example: object falling under gravity and drag ............................................................ 119!
Energy concepts .................................................................................................................... 122!
The notion of work in physics ............................................................................................ 123!
The capacity to do work: energy ....................................................................................... 124!
Energy transfer, conversion, and conservation ................................................................. 125!
Potential and kinetic energy .............................................................................................. 126!
Power................................................................................................................................. 126!
Example: a rudimentary “car” simulation ........................................................................... 127!
Summary ............................................................................................................................... 131!

Part II: Particles, Forces and Motion

Chapter 5: The Laws Governing Motion ................................................................ 135!


Newton’s laws of motion........................................................................................................ 136!
Newton’s first law of motion (N1)....................................................................................... 136!
Newton’s second law of motion (N2) ................................................................................. 137!
Newton’s third law of motion (N3) ..................................................................................... 138!
Applying Newton’s laws......................................................................................................... 139!
General method for applying F = ma ................................................................................. 139!
The Forcer class ................................................................................................................ 139!
The Forces class ............................................................................................................... 141!
A simple example: projectile with drag .............................................................................. 142!
A more complicated example: floating ball ........................................................................ 144!
Newton’s second law as a differential equation .................................................................... 146!
Taking a deeper look at F = ma......................................................................................... 146!
An example: Fall under gravity and drag revisited ............................................................ 147!
The principle of energy conservation .................................................................................... 148!
Conservation of mechanical energy .................................................................................. 149!
An example: Energy changes in a projectile ..................................................................... 149!
ix
Contents

The principle of momentum conservation ............................................................................. 152!


Example: 1D elastic collision between two particles ......................................................... 154!
Laws governing rotational motion.......................................................................................... 156!
Summary ............................................................................................................................... 156!

Chapter 6: Gravity, Orbits, and Rockets ................................................................ 157!


Gravity ................................................................................................................................... 157!
Gravity, weight, and mass ................................................................................................. 158!
Newton’s universal law of gravitation ................................................................................ 158!
Creating the gravity function .............................................................................................. 159!
Orbits ..................................................................................................................................... 161!
Orbiter class ...................................................................................................................... 162!
Escape velocity.................................................................................................................. 165!
Two-body motion ............................................................................................................... 166!
Local gravity .......................................................................................................................... 169!
The force of gravity near the Earth’s surface .................................................................... 169!
Variation of gravity with height .......................................................................................... 170!
Gravity on other celestial bodies ....................................................................................... 172!
Rockets.................................................................................................................................. 173!
It is rocket science! ............................................................................................................ 173!
Modeling the thrust of a rocket .......................................................................................... 173!
Building a rocket simulation ............................................................................................... 174!
Summary ............................................................................................................................... 180!

Chapter 7: Contact and Fluid Forces ..................................................................... 181!


Contact forces ....................................................................................................................... 182!
Normal contact forces........................................................................................................ 182!
Tension and compression ................................................................................................. 183!
Friction ............................................................................................................................... 183!
Example: Sliding down a slope ......................................................................................... 185!
Pressure ................................................................................................................................ 191!
The meaning of pressure .................................................................................................. 191!
Density ............................................................................................................................... 192!
Variation of pressure with depth in a fluid ......................................................................... 193!
Static and dynamic pressure ............................................................................................. 194!
Upthrust (buoyancy) .............................................................................................................. 194!
Archimedes’s Principle ...................................................................................................... 195!
Apparent weight................................................................................................................. 196!
Submerged objects............................................................................................................ 196!
Floating objects ................................................................................................................. 197!
x
Contents

Example: Balloon............................................................................................................... 197!


Drag ....................................................................................................................................... 199!
Drag law for low velocities ................................................................................................. 200!
Drag law for high velocities ............................................................................................... 201!
Which drag law should I use? ........................................................................................... 202!
Adding drag to the balloon simulation ............................................................................... 203!
Example: Floating ball ....................................................................................................... 203!
Terminal velocity................................................................................................................ 207!
Example: Parachute .......................................................................................................... 209!
Lift .......................................................................................................................................... 212!
Lift coefficients ................................................................................................................... 213!
Example: An airplane ........................................................................................................ 213!
Wind and turbulence ............................................................................................................. 216!
Force due to the wind ........................................................................................................ 216!
Wind and drag ................................................................................................................... 217!
Steady and turbulent flow .................................................................................................. 217!
Example: Air bubbles in a steady wind.............................................................................. 217!
Modeling turbulence .......................................................................................................... 219!
Summary ............................................................................................................................... 220!

Chapter 8: Restoring Forces: Springs and Oscillations ...................................... 221!


Springs and oscillations: Basic concepts .............................................................................. 221!
Spring-like motion .............................................................................................................. 222!
Restoring force, damping, and forcing .............................................................................. 222!
Hooke’s law ....................................................................................................................... 223!
Free oscillations..................................................................................................................... 224!
The spring force function ................................................................................................... 224!
Creating a basic oscillator ................................................................................................. 224!
Simple harmonic motion .................................................................................................... 226!
Oscillations and numerical accuracy ................................................................................. 229!
Damped oscillations .............................................................................................................. 233!
Damping force ................................................................................................................... 233!
The effect of damping on oscillations ................................................................................ 234!
Analytical solutions for oscillations with damping .............................................................. 236!
Forced oscillations ................................................................................................................. 237!
Driving forces..................................................................................................................... 238!
Example: A periodic driving force ...................................................................................... 238!
Example: A random driving force ...................................................................................... 239!
Gravity as a driving force: bungee jumping ....................................................................... 240!
Example: Driving force by user interaction ........................................................................ 243!
xi
Contents

Coupled oscillators: Multiple springs and objects ................................................................. 245!


Example: A chain of objects connected by springs ........................................................... 246!
Summary ............................................................................................................................... 250!

Chapter 9: Centripetal Forces: Rotational Motion ................................................ 251!


Kinematics of uniform circular motion ................................................................................... 251!
Angular displacement ........................................................................................................ 252!
Angular velocity ................................................................................................................. 253!
Angular acceleration .......................................................................................................... 253!
Period, frequency, and angular velocity ............................................................................ 254!
Relation between angular velocity and linear velocity....................................................... 255!
Example: A rolling wheel ................................................................................................... 256!
Particles with spin .............................................................................................................. 258!
Example: Satellite around a rotating Earth ........................................................................ 259!
Centripetal acceleration and centripetal force ....................................................................... 263!
Centripetal acceleration ..................................................................................................... 263!
Centripetal acceleration, velocity and angular velocity ..................................................... 264!
Centripetal force ................................................................................................................ 264!
Common misconceptions about centripetal force ............................................................. 265!
Example: Revisiting the satellite animation ....................................................................... 266!
Example: Circular orbits with gravitational force ............................................................... 267!
Example: Car moving around a bend ................................................................................ 270!
Non-uniform circular motion .................................................................................................. 274!
Tangential force and acceleration ..................................................................................... 274!
Example: A simple pendulum ............................................................................................ 275!
Summary ............................................................................................................................... 279!

Chapter 10: Long-Range Forces ............................................................................ 281!


Particle interactions and force fields ..................................................................................... 281!
Interaction at a distance .................................................................................................... 282!
From particle interactions to force fields............................................................................ 282!
Newtonian gravitation ............................................................................................................ 283!
Gravitational field due to a particle .................................................................................... 283!
Gravity with multiple orbiters ............................................................................................. 284!
Gravity with multiple attractors .......................................................................................... 286!
Particle trajectories in a gravity field .................................................................................. 289!
Building a simple black hole game .................................................................................... 292!
Electrostatic force .................................................................................................................. 299!
Electric charge ................................................................................................................... 299!
Coulomb’s law of electrostatics ......................................................................................... 300!
xii
Contents

Charged particle attraction and repulsion.......................................................................... 301!


Electric fields ..................................................................................................................... 303!
Electromagnetic force ............................................................................................................ 306!
Magnetic fields and forces ................................................................................................. 306!
The Lorentz force law ........................................................................................................ 308!
Other force laws .................................................................................................................... 310!
Central forces .................................................................................................................... 310!
Gravity with a spring force law? ........................................................................................ 314!
Multiple attractors with different laws of gravity ................................................................. 316!
Summary ............................................................................................................................... 318!

Part III: Multi-particle and Extended Systems

Chapter 11: Collisions ............................................................................................. 321!


Collisions and their modeling ................................................................................................ 322!
Bouncing off horizontal or vertical walls ................................................................................ 323!
Elastic bouncing ................................................................................................................ 323!
Implementing energy loss due to bouncing ....................................................................... 326!
Bouncing off inclined walls .................................................................................................... 327!
Collision detection ............................................................................................................. 327!
Repositioning the particle .................................................................................................. 329!
Calculating the new velocity .............................................................................................. 330!
Velocity correction just before collision ............................................................................. 332!
An example of a ball bouncing off an inclined wall ............................................................ 334!
Example of ball bouncing off multiple inclined walls ......................................................... 339!
Collisions between particles in 1D......................................................................................... 340!
Repositioning the particles ................................................................................................ 340!
Elastic collisions ................................................................................................................ 343!
Inelastic collisions .............................................................................................................. 347!
Collisions between particles in 2D......................................................................................... 349!
An example: 2D collisions between two particles ............................................................. 350!
Example: multiple particle collisions .................................................................................. 353!
Example: multiple particle collisions with bouncing........................................................... 354!
Summary ............................................................................................................................... 358!

Chapter 12: Particle Systems ................................................................................. 359!


Introduction to particle system modeling ............................................................................... 360!
Creating animated effects using particles ............................................................................. 361!
A simple example: splash effect with particles .................................................................. 361!
Creating a particle emitter ................................................................................................. 364!

xiii
Contents

Creating a smoke effect..................................................................................................... 367!


Creating a fire effect .......................................................................................................... 371!
Creating fireworks.............................................................................................................. 373!
Particle animations with long-range forces ........................................................................... 379!
Particle paths in a force field ............................................................................................. 379!
Building a wormhole .......................................................................................................... 382!
Interacting particle systems ................................................................................................... 385!
Multiple particles under mutual gravity .............................................................................. 385!
A simple galaxy simulation ................................................................................................ 389!
Summary ............................................................................................................................... 394!

Chapter 13: Extended Objects ................................................................................ 395!


Rigid bodies ........................................................................................................................... 395!
Basic concepts of rigid body modeling .............................................................................. 396!
Modeling rigid bodies......................................................................................................... 402!
Rotational dynamics of rigid bodies................................................................................... 405!
Simulating rigid body dynamics ......................................................................................... 409!
Example: a simple wind turbine simulation ....................................................................... 412!
Example: Rolling down an inclined plane .......................................................................... 415!
Rigid body collisions and bouncing ................................................................................... 422!
Example: Simulating a single bouncing block ................................................................... 426!
Example: Colliding blocks ................................................................................................. 430!
Deformable bodies ................................................................................................................ 432!
Mass-spring systems ......................................................................................................... 432!
Rope simulation ................................................................................................................. 434!
Cloth simulation ................................................................................................................. 438!
Summary ............................................................................................................................... 440!

Part IV: Building More Complex Simulations

Chapter 14: Numerical Integration Schemes ........................................................ 443!


General principles ................................................................................................................. 444!
Statement of the problem .................................................................................................. 444!
Characteristics of numerical schemes............................................................................... 446!
Types of integration schemes ........................................................................................... 447!
Modifying Forcer to allow for different integration schemes .............................................. 448!
Euler integration .................................................................................................................... 449!
Explicit Euler ...................................................................................................................... 449!
Implicit Euler ...................................................................................................................... 450!
Semi-implicit Euler ............................................................................................................. 450!

xiv
Discovering Diverse Content Through
Random Scribd Documents
The Project Gutenberg eBook of The
Adventures of a Pincushion, Designed Chiefly
for the Use of Young Ladies
This ebook is for the use of anyone anywhere in the United
States and most other parts of the world at no cost and with
almost no restrictions whatsoever. You may copy it, give it away
or re-use it under the terms of the Project Gutenberg License
included with this ebook or online at www.gutenberg.org. If you
are not located in the United States, you will have to check the
laws of the country where you are located before using this
eBook.

Title: The Adventures of a Pincushion, Designed Chiefly for the


Use of Young Ladies

Author: Mary Ann Kilner

Release date: October 24, 2020 [eBook #63541]


Most recently updated: October 18, 2024

Language: English

Credits: Produced by Charlene Taylor, Barry Abrahamsen, and


the
Online Distributed Proofreading Team at
https://www.pgdp.net
(This file was produced from images generously made
available by The University of Florida, The Internet
Archive/Children's Library)

*** START OF THE PROJECT GUTENBERG EBOOK THE


ADVENTURES OF A PINCUSHION, DESIGNED CHIEFLY FOR THE USE
OF YOUNG LADIES ***
The cover image was created by the transcriber and is placed in the public
domain.
THE

ADVENTURES
OF A

P I N C U S H I O N.
DESIGNED CHIEFLY

For the use of Young Ladies.

Imagination here supplies


What Nature’s sparing Hand denies;
And, by her magic powers dispense,
To meanest objects, thought and sense.

LONDON.
Printed and Sold by J o h n M a r s h a l l, No. 17,
Queen Street, Cheapside; and No. 4, Aldermary
Church Yard, in Bow-Lane.

[Price Six-Pence, Bound.]


PREFACE.

The Author of the following sheets is well aware of the objections


which may be made to the performance but hopes the candour of
the public will excuse those defects, which the nature of the
undertaking rendered it almost impossible to avoid. The pointed
satire of ridicule, which would perhaps have given a zest to those
scenes in which the subject of these pages was engaged, was not, in
the opinion of the writer, at all proper for those readers for whom it
was solely designed: to exhibit their superiors in a ridiculous view, is
not the proper method to engage the youthful mind to respect: to
represent their equals as the objects of contemptuous mirth, is by
no means favourable to the interest of good-nature: and to treat the
characters of their inferiors with levity, the Author thought was
inconsistent with the sacred rights of humanity. Circumscribed
therefore to the narrow boundaries of simple narrative, it has been
the design of the following pages, carefully to avoid exciting any
wrong impression, and, by sometimes blending instruction and
amusement, to make it the more easily retained.
To multiply incidents in these circumstances, was a very difficult
task, especially, as it was wished to make them arise naturally from
the subject; and not obtrude unnecessarily without any seeming
cause to produce them. The avidity with which children peruse
books of entertainment, is a proof how much publications proper for
their attention are required. Though the sentiments should be suited
to their simplicity, they ought to be expressed with propriety; since a
taste for elegance may be insensibly acquired; and we should always
endeavour to present them with proper models of imitation.
Conscious of the difficulty of the undertaking, the Author of these
adventures will gladly have declined the task, in the expectation of
such a work’s engaging the attention of those, whose genius were
more equal to its accomplishment. With the hope, therefore, of
inspiring others to excel the example, it is now submitted to the
world “with all its imperfections on its head,” trusting for a candid
reception to the motive which first suggested the idea: That of
presenting the juvenile reader with a a few pages which should be
innocent of corrupting, if they did not amuse.
THE

ADVENTURES
OF A

P I N C U S H I O N.

It happened one very fine afternoon in the latter end of May, that
Mrs. Airy had been collecting together a great number of different
pieces of silk, in order to made a work-bag; which she intended as a
present to one of her nieces. Miss Martha Airy, her eldest daughter,
was about ten years old, and had been for some time indolently
lolling with both her elbows on the table, looking at her Mamma
while she was chusing the prettiest pattern for the purpose I just
mentioned. Her chin rested on her two hands, which were crossed
over each other, and she was seated on the back of her brother’s
chair, which he had turned down in that manner for the purpose of
serving him as a horse. At last, however, her weight proving too
great for the seat she had chosen, as she did not keep still, the
upper part of the chair-back came to the ground, while the other
end mounted up like a piece of board for a sea-saw; and in her fall
tumbling down backwards, proved the occasion of a great deal of
mischief, by oversetting a curious set of tea-china, which her sister
Charlotte was playing with; and which she had received as a present
the day before from her grandpapa. Charlotte was so enraged at the
loss of her play-things, that without offering to help her sister, she
gave her a slap on the face, and told her, she was very naughty to
spoil things in such a manner by her carelessness; and that she
would break her plates whenever they came in her way. She was
proceeding in this manner when Mrs. Airy thought it time to
interfere, and was extremely angry with Charlotte for her warmth.
“Martha was not to blame,” added she, “as she had no intention of
doing the least mischief to your cups and saucers. I think, as I told
her once before, she was not sitting in a graceful attitude, and had
she moved at the time I spoke to her, it would have prevented her
fall; but that is no justification of your behaviour to your sister. She
has not deserved your reproaches, and I did not think you could
have behaved so improperly, as well as unkindly, as to strike anyone,
especially your elder sister. Indeed I am much displeased with you,
and the threat you made of breaking her plates in return, is so very
naughty and wicked, that I think you deserve to be punished; and I
desire you will ask Martha’s pardon for the blow you have given her.”
Charlotte coloured with indignation and anger, at the thoughts of
submitting in such a manner to humble herself. She had heard some
silly girls declare, they would never own their being in the wrong,
and was withheld from acting in the noblest manner, by the false
shame of confessing an error. At length however, upon her Mamma
coming towards her with an avowed intention of inflicting some
further punishment, she mumbled out, in a low voice, which was
very difficult to be understood, That she was sorry that she had
struck her sister. Martha, who was extremely generous, and
uncommonly good-natured, very affectionately kissed her sister; and
told her, she was much concerned at the mischief she had
occasioned; though she could not have helped it; as she fell down
before she was aware of it, and did not see that her tea-things were
near her. Charlotte grew reconciled by degrees; but it was a long
time before she regained her usual cheerfulness. After some time,
however, the sisters seated themselves in a window by the table,
and solicited their Mamma for a bit of silk to make a Pincushion. Mrs.
Airy gave them several pieces to chuse which they liked best; and
after they had taken them up a dozen times, or perhaps as many
more, had they been reckoned, Martha made a choice of a square
piece of pink sattin, which she neatly sewed and stuffed with bran,
and which, gentle reader, when it was finished, was the identical
Pincushion whose adventures form the subject of this little volume.
Assuming, therefore, the title of an Historian, or Biographer, which is
generally understood to mean a person who is writing an account of
his own, or another’s actions, I shall take the liberty to speak for
myself, and tell you what I saw and heard in the character of a
Pincushion. Perhaps you never thought that such things as are
inanimate, could be sensible of any thing which happens, as they
can neither hear, see, nor understand; and as I would not willingly
mislead your judgment: I would previous to your reading this work,
inform you, that it is to be understood as an imaginary tale; in the
same manner as when you are at play, you sometimes call
yourselves gentlemen, and ladies, though you know you are only
little boys or girls. So, when you read of birds and beads speaking
and thinking, you know it is not so in reality, any more than your
amusements, which you frequently call making believe. To use your
own style, and adopt your own manner of speaking, therefore, you
must imagine, that a Pincushion is now making believe to address
you, and to recite a number of little events, some of which really
have happened, and others might do so with great probability: and if
any of the characters here represented should appear to be
disagreeable, the Author hopes you will endeavour to avoid their
failings, and to practice those virtues or accomplishments, which
render the contrary examples more worthy of imitation. And now, if
you please, we will return to the account of what further befell me in
the family of Mrs. Airy.
After the young ladies had amused themselves a great while with
the pieces of silk I have so often had occasion to mention, and Miss
Martha had completed me to her entire satisfaction; she took all the
pins out of an old green one, which was originally in the shape of a
heart, but had, by looping a great part of its inside, through various
little holes, quite lost its form; and which, that she might find those
pins which had gone through the silk, she cut open on an old news-
paper, and then stuck all she could find upon my sides in the shape
of letters, which she afterwards changed to flowers, and a third time
altered to stars and circles; which afforded her full amusement till
bed time. Miss Charlotte, though her mamma had given her as much
silk as her sister, had only cut it into waste; while Martha, after she
had furnished me, had saved the rest towards making a housewife
for her doll. I could not help reflecting when I saw all Charlotte’s
little shreds and slips littering the room; what a simple method many
little girls are apt to get into, of wasting every thing which their
friends are so kind as to give them, and which, properly employed,
might, make them many useful ornaments for their dolls; and
sometimes pretty trifles for themselves. Charlotte Airy as such
children usually are, was desirous of having every thing she saw, so
that her drawers were always filled with bits of ribbon, pieces of silk,
cuttings of gauze, catgut, and muslin: and if she wanted to find her
gloves, tippet, tuckers, or any part of her dress, she was obliged to
search for them in twenty different places, and frequently to go
without what she was looking for. Martha on the contrary, by taking
care of what might be of use, and laying it by in a proper place,
always knew where to find what she had occasion for directly. So
that it frequently happened that she went out with her Mamma,
when her sister was forced to stay at home; because she had lost
something which had delayed her so long to lock for, that she could
not get ready in time. This very circumstance happened the day
after I became acquainted with her, to her no small mortification.
Mrs. Airy was going to see the exhibition of pictures, at the Royal
Academy, and told her daughters if they behaved well they should
accompany her; as Mrs. Gardner and her niece Miss Lounge would
call at one o’clock. After breakfast, Charlotte, who had found the
mould of an old button in one of her papa’s waistcoat pockets which
she had been rummaging, had cut to pieces an axle-tree of a little
cart, which belonged to her brother, to make a spindle, in order to
convert it into a tea-totum; with which she was so much
entertained, that she was very unwilling to leave it to go to work,
though her mamma repeatedly told her, she would not be ready
against Mr. Gardner’s coach came. “Yes, I shall, Madam!” said she,
and played on. “Do pray go to work, Charlotte!”
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebookname.com

You might also like