Download ebooks file Python Playground, 2nd Edition Mahesh Venkitachalam all chapters
Download ebooks file Python Playground, 2nd Edition Mahesh Venkitachalam all chapters
com
https://ebookmeta.com/product/python-playground-2nd-edition-
mahesh-venkitachalam/
OR CLICK BUTTON
DOWNLOAD NOW
https://ebookmeta.com/product/python-playground-geeky-projects-for-
the-curious-programmer-2nd-edition-mahesh-venkitachalam/
ebookmeta.com
https://ebookmeta.com/product/quantum-mechanics-mahesh-c-jain/
ebookmeta.com
Neither Good Nor Bad Why Human Beings Behave How They Do
1st Edition Gerhard Besier
https://ebookmeta.com/product/neither-good-nor-bad-why-human-beings-
behave-how-they-do-1st-edition-gerhard-besier/
ebookmeta.com
Childhood Today 1st Edition Alex Owen
https://ebookmeta.com/product/childhood-today-1st-edition-alex-owen/
ebookmeta.com
https://ebookmeta.com/product/lonely-planet-pacific-northwest-s-best-
trips-5-road-trips-guide-5th-edition-becky-ohlsen/
ebookmeta.com
https://ebookmeta.com/product/bureaucratic-politics-and-
administration-in-chile-peter-s-cleaves/
ebookmeta.com
https://ebookmeta.com/product/optimization-on-solution-sets-of-common-
fixed-point-problems-1st-edition-alexander-j-zaslavski/
ebookmeta.com
https://ebookmeta.com/product/savannah-mafia-1-cruel-prince-1st-
edition-m-a-lee/
ebookmeta.com
Problems in Physical Chemistry by Narendra Awasthi for JEE
15th Edition Narendra Avasthi
https://ebookmeta.com/product/problems-in-physical-chemistry-by-
narendra-awasthi-for-jee-15th-edition-narendra-avasthi/
ebookmeta.com
PY THON
PUT THE FUN
BACK IN
PROGRAMMING
P L AYG R OU N D
P Y T H O N P L AY G R O U N D
Python is a powerful programming language that’s • Make realistic animations with OpenGL shaders G E E K Y P R O J E C T S F O R T H E
easy to learn and fun to play with. But once you’ve by exploring particle systems, transparency, and
C U R I O U S P R O G R A M M E R
gotten a handle on the basics, what do you do next? billboarding techniques
Python Playground is a collection of imaginative • Construct 3D visualizations using data from CT and
programming projects that will inspire you to use MRI scans
Python to make art and music, build simulations of
MAHESH VENKITACHAL AM
• Build a laser show that responds to music by hooking
real-world phenomena, and interact with hardware
up your computer to an Arduino
like the Arduino and Raspberry Pi. You’ll learn to
use common Python tools and libraries like numpy, Programming shouldn’t be a chore. Have some solid,
matplotlib, and pygame to do things like: geeky fun with Python Playground.
VENKITACHALAM
T H E F I N E ST I N G E E K E N T E RTA I N M E N T ™
w w w.nostarch.com
b y Ma h e s h Ve n ki t a c h a la m
San Francisco
Python Playground. Copyright © 2016 by Mahesh Venkitachalam.
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.
First printing
19 18 17 16 15 1 2 3 4 5 6 7 8 9
ISBN-10: 1-59327-604-4
ISBN-13: 978-1-59327-604-1
Figure 8-4 was created by Fred Hsu (March 2005) and has been reproduced under the Creative Commons
Attribution-Share Alike 3.0 Unported license.
For information on distribution, translations, or bulk sales, please contact No Starch Press, Inc. directly:
Venkitachalam, Mahesh.
Python playground : geeky projects for the curious programmer / by Mahesh Venkitachalam.
pages cm
Includes index.
ISBN 978-1-59327-604-1 -- ISBN 1-59327-604-4
1. Python (Computer program language) 2. Electronic apparatus and appliances--Automatic control.
3. Arduino (Programmable controller)--Programming. 4. Raspberry Pi (Computer)--Programming. I.
Title.
QA76.73.P98.V46 2015
005.13'3--dc23
2014046103
No Starch Press and the No Starch Press logo are registered trademarks of No Starch Press, Inc. Other
product and company names mentioned herein may be the trademarks of their respective owners. Rather
than use a trademark symbol with every occurrence of a trademarked name, we are using the names only
in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the
trademark.
The information in this book is distributed on an “As Is” basis, without warranty. While every precaution
has been taken in the preparation of this work, neither the author nor No Starch Press, Inc. 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 it.
For my parents,
A.V. Venkitachalam and N. Saraswathy,
for giving me the greatest gift of all—
an education
&
For Hema
H = M 2A
Brief Contents
Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xix
Part I: Warming Up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Chapter 1: Parsing iTunes Playlists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Chapter 2: Spirographs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319
Conte nt s in De ta il
Acknowledgments xvii
Introduction xix
Who Is This Book For? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xix
What’s in This Book? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xx
Part I: Warming Up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xx
Part II: Simulating Life . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xx
Part III: Fun with Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xx
Part IV: Enter 3D . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xx
Part V: Hardware Hacking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxi
Why Python? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxi
Python Versions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxii
The Code in This Book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxii
part I: Warming Up 1
1
Parsing iTunes Playlists 3
Anatomy of the iTunes Playlist File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
The Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Finding Duplicates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Extracting Duplicates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Finding Tracks Common Across Multiple Playlists . . . . . . . . . . . . . . . . . . . . . . . 7
Collecting Statistics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Plotting Your Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Command Line Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
The Complete Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Running the Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Experiments! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2
Spirographs 17
Parametric Equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Spirograph Equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Turtle Graphics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
The Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
The Spiro Constructor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
The Setup Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
The restart() Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
The draw() Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Creating the Animation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
The SpiroAnimator Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
The genRandomParams() Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Restarting the Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
The update() Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Showing or Hiding the Cursor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Saving the Curves . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Parsing Command Line Arguments and Initialization . . . . . . . . . . . . . . . . . . . . 30
The Complete Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Running the Spirograph Animation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Experiments! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
3
Conway’s Game of Life 41
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
The Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Representing the Grid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Initial Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Boundary Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
Implementing the Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
Sending Command Line Arguments to the Program . . . . . . . . . . . . . . . . . . . . 47
Initializing the Simulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
The Complete Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
Running the Game of Life Simulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
Experiments! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
4
Generating Musical Overtones with the
Karplus-Strong Algorithm 55
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
The Simulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
Creating WAV Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
The Minor Pentatonic Scale . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
The Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
Implementing the Ring Buffer with deque . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
Implementing the Karplus-Strong Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . 62
Writing a WAV File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
Playing WAV Files with pygame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
The main() Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
x Contents in Detail
The Complete Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
Running the Plucked String Simulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
Experiments! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
5
Boids: Simulating a Flock 71
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
The Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
Computing the Position and Velocities of the Boids . . . . . . . . . . . . . . . . . . . . . 73
Setting Boundary Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
Drawing a Boid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
Applying the Rules of the Boids . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
Adding a Boid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
Scattering the Boids . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
Command Line Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
The Boids Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
The Complete Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
Running the Boids Simulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
Experiments! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
6
ASCII Art 89
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
The Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
Defining the Grayscale Levels and Grid . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
Computing the Average Brightness . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
Generating the ASCII Content from the Image . . . . . . . . . . . . . . . . . . . . . . . . 93
Command Line Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
Writing the ASCII Art Strings to a Text File . . . . . . . . . . . . . . . . . . . . . . . . . . 95
The Complete Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
Running the ASCII Art Generator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
Experiments! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
7
Photomosaics 101
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
Splitting the Target Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
Averaging Color Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
Matching Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
Contents in Detail xi
Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
The Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
Reading in the Tile Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
Calculating the Average Color Value of the Input Images . . . . . . . . . . . . . . . 105
Splitting the Target Image into a Grid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
Finding the Best Match for a Tile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
Creating an Image Grid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
Creating the Photomosaic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
Adding the Command Line Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
Controlling the Size of the Photomosaic . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
The Complete Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
Running the Photomosaic Generator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
Experiments! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
8
Autostereograms 117
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
Perceiving Depth in an Autostereogram . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
Depth Maps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
The Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
Repeating a Given Tile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
Creating a Tile from Random Circles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
Creating Autostereograms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
Command Line Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
The Complete Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
Running the Autostereogram Generator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
Experiments! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
9
Understanding OpenGL 133
Old-School OpenGL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
Modern OpenGL: The 3D Graphics Pipeline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
Geometric Primitives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
3D Transformations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
Shaders . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
Vertex Buffers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
Texture Mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
Displaying OpenGL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
xii Contents in Detail
The Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
Creating an OpenGL Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
Setting Callbacks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
The Scene Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
The Complete Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
Running the OpenGL Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
Experiments! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
10
Particle Systems 159
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
Modeling the Motion of a Particle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
Setting a Maximum Spread . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
Rendering the Particles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
Using OpenGL Blending to Create More Realistic Sparks . . . . . . . . . . . . . . . 164
Using Billboarding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
Animating the Sparks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
The Code for the Particle System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
Defining the Particle Geometry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
Defining the Time-Lag Array for the Particles . . . . . . . . . . . . . . . . . . . . . . . . 168
Setting the Initial Particle Velocities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
Creating the Vertex Shader . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
Creating the Fragment Shader . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
Rendering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172
The Camera Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
The Complete Particle System Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174
The Box Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
The Code for the Main Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183
Updating the Particles at Each Step . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
The Keyboard Handler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
Managing the Main Program Loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
The Complete Main Program Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
Running the Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
Experiments! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
11
Volume Rendering 191
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192
Data Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
Generating Rays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
Displaying the OpenGL Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
An Overview of the Project Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
Generating a 3D Texture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197
Contents in Detail xiii
The Complete 3D Texture Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
Generating Rays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
Defining the Color Cube Geometry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
Creating the Frame Buffer Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
Rendering the Back-Faces of the Cube . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
Rendering the Front-Faces of the Cube . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
Rendering the Whole Cube . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
The Resize Handler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
The Complete Ray Generation Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
Volume Ray Casting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
The Vertex Shader . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
The Fragment Shader . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
The Complete Volume Ray Casting Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
2D Slicing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
The Vertex Shader . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222
The Fragment Shader . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
A User Interface for 2D Slicing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
The Complete 2D Slicing Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224
Putting the Code Together . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
The Complete Main File Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228
Running the Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
Experiments! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
12
Introduction to the Arduino 235
The Arduino . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236
The Arduino Ecosystem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
Language . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238
IDE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238
Community . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238
Peripherals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
Building the Light-Sensing Circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
How the Circuit Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
The Arduino Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
Creating the Real-Time Graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
The Python Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242
The Complete Python Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
Running the Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247
Experiments! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247
xiv Contents in Detail
Discovering Diverse Content Through
Random Scribd Documents
be the 1st, and 2nd terms of the question; the 3rd number is always of
the same name, or kind as the 4th, or answer sought; and in stating the
question it is always to be made the 3rd term. If the answer will be
greater than the 3rd term, place the least of the other two given
quantities for the 1st term; but if the answer will be less than the 3rd
term, put the greater of the two numbers, or quantities, for the 1st term.
Rule.—State the question according to the above directions, and
multiply the 2nd and 3rd terms together, and divide this product by the
1st, for the 4th term, or answer sought.
If the 1st and 2nd terms are not of the same denomination, they must
be reduced to it; and if the third term is a compound number, it must be
reduced to its lowest denomination before the multiplication, or division of
the term takes place.
Note 1.—The operation may frequently be considerably abridged, by
dividing the 1st and 2nd, or the 1st and 3rd terms, by any number which
will exactly divide them, afterwards using the quotients, instead of the
numbers themselves.*
Example.—If 2 tons of iron for ordnance cost £40, how many tons may
be bought for £360?
As £40 : £360 :: 2 tons : 18 tons.
(Thus 360 × 2) ÷ 40 = 18. The answer.
* Or thus, 9 × 2 = 18. The answer.
Note 2.—A concise method of ascertaining the annual amount of a daily
sum of money.
Rule.—Bring the daily sum into pence, and then add together as many
pounds, half pounds, groats, and pence, as there are pence in the daily
sum, for the amount required. For leap year, add the rate for one day.
Example.—Required the annual amount of 2s. 6d. per diem.
2s. 6d. = 30d. 30 pounds.
15 = 30 half pounds.
10s. = 30 groats.
2s. 6d. = 30 pence.
Annual amount (365 days) ... £45 12s. 6d.
Note 3.—To find the amount of any number of days’ pay, the daily rate
(under twenty shillings) being given.
The price of any article being given, the value of any number may be
ascertained in a similar manner.
Rule 1. When the rate (or price) is an even number, multiply the given
number by half of the rate, doubling the first figure to the right hand for
the shillings, the remainder of the product will be pounds.
Example. Required the amount of 243 days’ pay, at 4s. per diem.
4/2 = 2 243
2
£48 12s. Ans.
Rule 2. When the price is an odd number, find for the greatest number
as before, to which add one-twentieth of the given number for the odd
shilling.
Example. What is the price of 566 pairs of shoes, at 7s. per pair.
566 2/0 ) 56/6
3 28 6
169 16s.
28 6
£198 2s. Ans.
FRACTIONS.
REDUCTION OF FRACTIONS.
12 ) 114
6
9 12 Answer.
ADDITION OF FRACTIONS.
SUBTRACTION OF FRACTIONS.
MULTIPLICATION OF FRACTIONS.
DIVISION OF FRACTIONS.
DECIMALS.
A decimal fraction is that which has for its denominator an unit (1), with
as many ciphers annexed as the numerator has places; and it is usually
expressed by setting down the numerator only, with a point before it, on
the left hand. Thus, 5 is ·5; 25 is ·25; 25 is ·025; ciphers being
10 100 1000
prefixed, to make up as many places as are required by the ciphers in the
denominator.
A mixed number is made up of a whole number with some decimal
fraction, the one being separated from the other by a point, thus 3·25 is
the same as 3 25 or 325.
100 100
ADDITION OF DECIMALS.
Rule.—Set the numbers under each other, according to the value of
their places, in which state the decimal separating points will all stand
exactly under each other. Then beginning at the right hand, add up all the
columns of numbers as in integers, and point off as many places for
decimals as are in the greatest number of decimal places in any of the
lines that are added; or place the point directly below all the other points.
Example.—Required the sum of 29·0146, 3146·5, 14·16, and 165.
29·0146
3146·5
14·16
165·
Answer 3354·6746
SUBTRACTION OF DECIMALS.
MULTIPLICATION OF DECIMALS.
Rule.—Place the factors, and multiply them together, the same as if they
were whole numbers. Then point off in the product just as many places of
decimals as there are decimals in both the factors. But, if there be not so
many figures in the product, prefix ciphers to supply the deficiency.[44]
Example.—Multiply 32·108 by 2·5.
32·108
2·5
160540
64216
80·2700 Answer.
DIVISION OF DECIMALS.
REDUCTION OF DECIMALS.
Example.—Reduce 7 to a decimal.
24
24 = 4 × 6. Then 4 ) 7·
6 ) 1·75
·291666, &c.
To find the value of a decimal, in terms of the inferior denominations.
Rule.—Multiply the decimal by the number of parts in the next lower
denomination, and cut off as many places to the right hand for a
remainder, as there are places in the given decimal. Multiply that
remainder by the parts in the next lower denomination, again cutting off
for another remainder as before. Proceed in the same manner through all
the parts of the integer; then the several denominations, separated on the
left hand, will make up the answer.
Example.—What is the value of ·775 pounds sterling.
·775
20
Shillings 15·500
12
Pence 6·000 Answer 15s. 6d.
yd. yd. £. s. d.
⅜ = ·375 As ·375 : ·3125 :: 4 : ·333 &c. or 6 8
4
⅖ = ·4 ·375) ·12500 (·3333 &c.
1125 20
5/16 = ·3215 1250s. 6·666 &c.
1125 12
Answer, 6s. 8d. 125d. 7·999 &c. nearly 8d.
DUODECIMALS.
TROY WEIGHT.
24 grains 1 pennyweight.
480 20 1 ounce.
5760 240 12 1 pound.
AVOIRDUPOIS WEIGHT.
16 drams 1 ounce.
256 16 1 pound.
7168 448 28 1 quarter.
hundred
28672 1792 112 4 1 weigh
t.
573440 35840 2240 80 20 1 ton.
Note.— 1 lb. Avoirdupois weight equals 14 oz. 11 dwts. 15½ grs. Troy.
1 oz. ditto 18 dwts. 5½ do.
1 dr. ditto 27·34375 do.
APOTHECARIES’ WEIGHT.
20 grains 1 scruple.
60 3 1 dram.
480 24 8 1 ounce.
5760 288 96 12 1 pound.
WEIGHTS.
12 inches 1 foot.
36 3 1 yard.
198 16½ 5½ 1 pole, perch, or rod.
7920 660 220 40 1 furlong.
63360 5280 1760 320 8 1 mile.
SQUARE MEASURE.
144 s. inches 1 s. foot
1296 9 1 s. yard.
39204 272¼ 30¼ 1 s. pole.
1568160 10890 1210 40 1 rood.
6272640 43560 4840 160 4 1 acre.
CUBIC MEASURE (Measure of solidity).
Timber.
40 feet of round, and 50 feet of hewn timber make 1 Ton; 16 cubic feet
make 1 Foot of wood; 8 feet of wood make 1 Cord.
Water.
Maximum density 42 deg. Fahrenheit.
1 cubic foot of water 6¼ imperial gallons.
1 cylindric foot do. about 5 do.
1 cubic foot weighs 62·5 lb. avoirdupois.
1 cylindric do. do. 49·1
1 lineal do. (1 in. square) do. ·434
12·2 imperial gallons weigh 1 cwt.
224 do. do. 1 ton.
1·8 cubic feet do. 1 cwt.
35·84 do. do. 1 ton.
MEASURES OF CAPACITY.
69⅓ cubic in 2 pints 1 quart.
277¼ 8 4 1 gallon.
554½ 16 8 2 1 peck.
2218⅕ 64 32 8 4 1 bushel.
10¼ cubic ft. 512 256 64 32 8 1 quarter.
FRENCH MEASURES.
English English
cubic inches. feet.
Metre 3·281
Millilitre ·06103 ” French feet, 3·07844
Centilitre ·61028 Millimetre. ·03937
Decilitre 6·10279 Centimetre ·39371
Litre, or cubic decimetre 61·02791 Decimetre 3·93708
Decalitre 610·27900 Metre 39·37079
Hectolitre 6102·79000 Decametre 393·70790
Kylolitre 61027·90000 Hectometre 3937·07900
Myrialitre 610279·00000 Kilometre 39370·79000
1 litre is nearly 2⅛ wine pints. Myriametre 393707·90000
1 kilolitre 1 tun 12¾ wine gallons. 8 kilometres are nearly 5 miles.
1 stere, or cubic metre 35·3171 1 inch is ·0254 metre.
100 feet are nearly 30·5 metres.
INVOLUTION.
EVOLUTION.
Rule 1.—By trials, or by the table of roots (vide page 280), take the
nearest rational cube to the given number, whether it be greater, or less,
and call it the assumed cube.
2.—Then (by the Rule of Three),
As the sum of the given number, and double the assumed cube, is to
the sum of the assumed cube, and double the given number, so is the root
of the assumed cube, to the root required, nearly.
3.—Or as the first sum,
is to the difference of the given, and assumed cube,
so is the assumed root,
to the difference of the roots, nearly.
4.—Again, by using, in like manner, the cube of the root last found as a
new assumed cube, another root will be obtained still nearer. Repeat this
operation as often as necessary, using always the cube of the last-found
root, for the assumed root.
Example.—To find the cube root of 21035·8.
By trials it will be found first, that the root lies between 20, and 30;
and, secondly, between 27, and 28. Taking, therefore, 27, its cube is
19683, which will be the assumed cube. Then by No. 2 of the Rule
19683 21035·8
2 2
39366 42071·6
21035·8 19683·
As 60401·8 : 61754·6 :: 27 : 27·6047 the Root, nearly.
Again for a second operation, the cube of this root is
21035·318645155832, and the process by No. 3 of the
Rule will be
21035·318645, &c.
2
42070·637290 21035·8
21035·8 21035·318645, &c.
As 63106·43729 : diff. ·481355 :: 27·6047 :
: the diff. ·000210560
consequently the root required is 27·604910560
TABLE OF SQUARES, CUBES, AND ROOTS.
Cube Cube
No. Sqr. Cube. Sqr. root. No. Sqr. Cube. Sqr. root.
root. root.
Shot, and shells, are usually piled in horizontal courses, the base
being either an equilateral triangle, a square, or a rectangle. The
triangular, and square piles terminate each in a single ball, but the
rectangular pile finishes in a row of balls.
Parallel { 12
edges. { 1 12 ÷ 2 = 6
{ 1 12 + 1 = 13
Triangular face 78
3) 14 4⅔
4⅔ 312
52
Answer 364
12
1 12 ÷ 2 = 6
1 12 + 1 = 13
78
3) 25 8⅓
8⅓ 624
26
Answer 650
Example.—To find the shot in an oblong pile, whose base consists
of 18 shot in length, and 12 in breadth.
18 18 - 12 = 6
18 1
7 7
3) 43
14⅓ 12 ÷ 2 = 6
12 + 1 = 13
78
14⅓
312
78
26
Answer 1118
Triangular pile.
Rule.—Multiply the base by the base plus 1, this product by the
base plus 2, and divide by 6.
Square pile.
Rule.—Multiply the bottom row by the bottom row plus 1, and this
product by twice the bottom row plus 1, and divide by 6.
Triangular pile L × (L + 1) × (L + 2)
6
Square pile L × (L + 1) × (2L + 1)
6
Oblong pile B × (B + 1) × (3L + 1 - B)
6
1 2 4
2 5 3 10
3 8 14 4 20
4 11 20 30 5 35
5 14 26 40 55 6 56
6 17 32 50 70 91 7 84
7 20 38 60 85 112 140 8 120
8 23 44 70 100 133 168 204 9 165
9 26 50 80 115 154 196 240 285 10 220
10 29 56 90 130 175 224 276 330 385 11 286
11 32 62 100 145 196 252 312 375 440 506 12 364
12 35 68 110 160 217 280 348 420 495 572 650 13 455
13 38 74 120 175 238 308 384 465 550 638 728 819 14 560
14 41 80 130 190 259 336 420 510 605 704 806 910 1015 15 680
15 44 86 140 205 280 364 456 555 660 770 884 1001 1120 1240 16 816
16 47 92 150 220 301 392 492 600 715 836 962 1092 1225 1360 1496 17 969
17 50 98 160 235 322 420 528 645 770 902 1040 1183 1330 1480 1632 1785 18 1140
18 53 104 170 250 343 448 564 690 825 968 1118 1274 1435 1600 1768 1938 2109 19 1330
19 56 110 180 265 364 476 600 735 880 1034 1196 1365 1540 1720 1904 2091 2280 2470 20 1540
20 59 116 190 280 385 504 636 780 935 1100 1274 1456 1645 1840 2040 2244 2451 2660 2870 21 1771
21 62 122 200 295 406 532 672 825 990 1166 1352 1547 1750 1960 2176 2397 2622 2850 3080 3311 22 2024
CORDAGE.
Ropes, cables, and all other descriptions of cordage are distinguished by their
circumference, thus a two-inch rope means a rope two inches in circumference.
CHAINS.
Or, the weight per foot of the chain, multiplied by 24, will give the weight per
fathom of the chain, nearly. A chain cable with a stay across the links will weigh
about one-twelfth more than the foregoing examples.
¾-inch = 6 62 = 36 36
= 4½ tons. Weight required.
8 8
The safe strain is equal to about 8 tons, per square inch, of the iron of which the
chain is made.
The stay across the link of a chain increases its strength about one-sixth.
When the chain is of great length, a deduction, from the above rules, must be
allowed for the weight of it.
IRON RODS.
To find the weight that may be sustained, or lifted by round iron rods.
Find the weight in pounds, per yard; two-thirds of which will give the safe load,
in tons.
A round iron rod of average quality of iron, one inch in diameter, will be torn
asunder by 16 tons; it will be perceptibly damaged by half this strain, or 8 tons; its
safe load will be one-third, or 5·33 tons.
TIMBER.
{ 12
5 33 22 0 10
pounder
{ 9 ” 5 1 20 2 14
*For Brass { 6 ” 4 21 17 3 5
Ordnance. { { 32 pr. 5 29 23 3 13
{ Howitzer { 24 ” 5 6 21 0 17
{ { 12 ” 4 21 18 3 14
For all
*Ammunition waggon 5 36 20 0 3
natures.
*Forge 5 38 19 1 0
*Store-waggon (without spare
5 11 18 1 10
wheel)
*Small arm ammunition waggon 4 36 14 2 16
{ 12
7 33 20 2 8
*Rocket pounder
{6” 5 17 20 1 20
{ Large 3 30 42 2 13
*Pontoon
{ Small 22 2 5
Garrison, wood, common standing for
1 8 8 0 7
32 pounder of 25 cwt.
* Travelling complete.
{ Flanders 5 0 16 1 25
Waggons { Platform 3 16 21 3 18
{ Sling 8 11 31 3 26
Waggons, hospital, Mr. Holmes’ {Large 9 10 21 0 0
pattern {Small. 6 30 18 0 4