(Ebook) Mac game programming by Mark Szymczyk ISBN 1931841187 - The complete ebook is available for download with one click
(Ebook) Mac game programming by Mark Szymczyk ISBN 1931841187 - The complete ebook is available for download with one click
https://ebooknice.com/product/game-programming-gems-2-game-
programming-gems-series-vol-2-1469990
https://ebooknice.com/product/game-programming-with-code-
angel-50195610
https://ebooknice.com/product/linux-game-programming-w-cd-prima-tech-
s-game-development-1469930
https://ebooknice.com/product/game-programming-gems-3-game-
programming-gems-series-v-3-1469934
(Ebook) Learn Game Programming with Ruby: Bring Your Ideas to Life
with Gosu by Mark Sobkowicz ISBN 9781680500738, 1680500732
https://ebooknice.com/product/learn-game-programming-with-ruby-bring-
your-ideas-to-life-with-gosu-11238022
https://ebooknice.com/product/journal-29-revelation-interactive-book-
game-36505882
https://ebooknice.com/product/mac-os-x-programming-983170
https://ebooknice.com/product/c-game-programming-for-serious-game-
creation-2269740
https://ebooknice.com/product/game-programming-golden-rules-game-
development-series-1684980
00 Macgame_FM.qxd 2/21/03 5:02 PM Page i
Mac Game
Programming
00 Macgame_FM.qxd 2/21/03 5:02 PM Page ii
Mac Game
Programming
Mark Szymczyk
00 Macgame_FM.qxd 2/21/03 5:02 PM Page iv
© 2002 by Premier Press, Inc. All rights reserved. No part of this book may be reproduced or trans-
mitted in any form or by any means, electronic or mechanical, including photocopying, recording, or
by any information storage or retrieval system without written permission from Premier Press, except
for the inclusion of brief quotations in a review.
The Premier Press logo, top edge printing, and related trade dress are trademarks of Premier
Press, Inc. and may not be used without written permission. All other trademarks are the
property of their respective owners.
Foreword
S o you want to be a Mac game programmer? This book is a great place to start.
Whether you are interested in how games work, want to learn to write share-
ware games, or want to become the next great commercial game developer, this
book will show you some of the key technologies and techniques required to make
your dream game.
Through the years, I’ve worked on many Mac games, from Duke Nukem 3D to Tomb
Raider and Unreal Tournament. When I began writing Mac games in 1985, I would
have loved to have access to a reference like this one. In those early years, Mac
game developers learned tricks from anywhere they could find them—late nights
pouring over Apple documentation, swapping ideas with other developers, and a
lot of trial and error.
As president of Westlake Interactive, I’m often asked by people how to break into
the Mac game business. My first answer is to get experience any way you can.
Anything from writing simple 2D games to working on flashy demos will show
potential employers that you have the drive and knowledge to make it in the game
business. Mac game programmers are incredibly difficult to find these days, so the
market for people with the interest and talent to work in the industry is very
strong.
Writing Macintosh games can be some of the most exciting, challenging, and
rewarding work a programmer can tackle. You have in your hands the perfect start-
ing point to enter the world of game programming; with hard work and determina-
tion, you’ll be well on your way to writing that next great Mac game!
Glenda Adams
President, Westlake Interactive
May 2002
00 Macgame_FM.qxd 2/21/03 5:02 PM Page vii
Acknowledgments
I t pains me to admit it, but I did not single-handedly create this book. Many people
helped make this book a reality, and I’d like to thank them here.
First, I’d like to thank my editors at Premier Press—and I worked with many editors
on this book. I would like to thank my original acquisitions editor, Jody Kennen, for
discovering me and for putting the book deal together. I would also like to thank my
original project editor, Brian Thomasson, for his help as I wrote the first chapters of
this book. He helped me get up to speed quickly on writing the chapters.
While I was writing this book, both Jody and Brian left to take other positions. Emi
Smith became my new acquisitions editor. I need to thank Emi for gathering all the
permissions necessary to include all the programs on the CD-ROM and for putting
up with delays in the project. Thanks to my copy editor, Alice Martina Smith, for
cleaning up some of my grammar and for bringing up questions that made the text
of this book easier for you to understand. I would also like to thank my Tech Editor,
Darrell Walisser, for reviewing all the source code in this book and making sure it all
runs well.
Next, I owe a huge Thank You to Carlos Camacho, the editor of the Mac game pro-
gramming site iDevGames, for two reasons. First, he let me write some articles for his
site, which is how Premier Press found me. Without his Web site, I wouldn’t be writ-
ing this book. Second, he donated artwork, music, and sound effects for the CD-
ROM that accompanies this book. His donation will make it easier for you to make
your own games, improving the book in the process.
I had many programming questions as I wrote the code for the book. I would like to
thank everyone who answered my questions on various mailing lists and message
boards. I don’t have a list of individuals who helped, but you know who you are.
00 Macgame_FM.qxd 2/21/03 5:02 PM Page viii
The CD-ROM that is with this book comes packed with development tools, games,
source code, and game assets. I would like to thank everyone who graciously let me
include their programs on the CD-ROM. You have helped make this book as good as
it can possibly be.
Finally, I want to thank my family for helping keep me sane while I wrote the book.
To my parents Stan and Mary, my brothers Dave and Steve, my sister Kathy, her hus-
band John, and my nephews Zachary and Christian, thank you.
00 Macgame_FM.qxd 2/21/03 5:02 PM Page ix
Contents at a Glance
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . xxviii
Chapter 1
Introduction to the Mac and to
Game Programming . . . . . . . . . . . . . . . . . . . . . . . 1
Chapter 2
Project Builder . . . . . . . . . . . . . . . . . . . . . . . . 27
Chapter 3
C++ for C Programmers. . . . . . . . . . . . . . . . . . . 59
Chapter 4
Introduction to
Macintosh Graphics . . . . . . . . . . . . . . . . . . . . . . 77
Chapter 5
Tiles and Scrolling. . . . . . . . . . . . . . . . . . . . . . 113
Chapter 6
Animation. . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
Chapter 7
InputSprocket. . . . . . . . . . . . . . . . . . . . . . . . . 197
Chapter 8
HID Manager . . . . . . . . . . . . . . . . . . . . . . . . . 233
Chapter 9
Reading the Keyboard and Mouse
Plus Event Handling . . . . . . . . . . . . . . . . . . . . 297
00 Macgame_FM.qxd 2/21/03 5:02 PM Page xi
Contents at a Glance xi
Chapter 10
Sound . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345
Chapter 11
Physics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 391
Chapter 12
Beginning Artificial Intelligence . . . . . . . . . . . . 455
Chapter 13
Pathfinding . . . . . . . . . . . . . . . . . . . . . . . . . . 491
Chapter 14
DrawSprocket . . . . . . . . . . . . . . . . . . . . . . . . 545
Chapter 15
Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 585
Chapter 16
Putting It All Together . . . . . . . . . . . . . . . . . . 639
Chapter 17
Understanding the Game’s Source Code . . . . . . . 675
Chapter 18
Optimization . . . . . . . . . . . . . . . . . . . . . . . 717
Chapter 19
Game Development Tips . . . . . . . . . . . . . . . . . . 763
Appendix A
Installing Programs from the CD-ROM . . . . . . . . 797
Appendix B
Game Development Resources . . . . . . . . . . . . . . 801
Appendix C
CD-ROM Contents . . . . . . . . . . . . . . . . . . . . . . 813
00 Macgame_FM.qxd 2/21/03 5:02 PM Page xii
xii
Contents
Foreword . . . . . . . . . . . . . . . . . . . . . . . vi
Letter from the Series Editor. . . . . . . . xxxi
Introduction . . . . . . . . . . . . . . . . . . . xxxiii
Chapter 1
Introduction to the Mac and to
Game Programming . . . . . . . . . . . . 1
A Brief History of the Mac OS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Mac Programming Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Mac Toolbox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Carbon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Cocoa . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Programming with Carbon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
What to Place in Your System Folder. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
What to Place in Your Compiler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
A Description of the Game We Will Develop . . . . . . . . . . . . . . . . . . . 12
Elements of a Computer Game . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Player Input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Challenges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Graphics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Sound . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Physics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Game Event Loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
00 Macgame_FM.qxd 2/21/03 5:02 PM Page xiii
Contents xiii
Chapter 2
Project Builder . . . . . . . . . . . . . 27
Creating Your First Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Your First Real Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Creating Source Code Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Adding Files to a Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Adding Frameworks to a Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Contents List Tabs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
Files Tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
Classes Tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
Bookmarks Tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Targets Tab. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Breakpoints Tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
Action Panel Tabs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
Find Tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
Build Tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
Run Tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
Debug Tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
00 Macgame_FM.qxd 2/21/03 5:02 PM Page xiv
xiv Contents
Compiling a Project. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
Debugging a Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
Setting Breakpoints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
A Debugging Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
Chapter 3
C++ for C Programmers . . . . . . . 59
Structured vs. Object-Oriented Programming . . . . . . . . . . . . . . . . . . 61
Structured Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
Object-Oriented Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
Data Members . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
Member Functions: Constructors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
Member Functions: Destructors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
Member Functions: Accessors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
Member Functions: General . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
Inheritance. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
Virtual Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
Private, Protected, and Public Keywords . . . . . . . . . . . . . . . . . . . . . . 71
Dynamic Memory Allocation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
Converting the Book Code to C from C++ . . . . . . . . . . . . . . . . . . . . 75
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
Chapter 4
Introduction to
Macintosh Graphics. . . . . . . . . . . 77
Macintosh Color . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
8-Bit Color Pixels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
00 Macgame_FM.qxd 2/21/03 5:02 PM Page xv
Contents xv
Chapter 5
Tiles and Scrolling. . . . . . . . . . . 113
Introduction to Tiles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
Storing Tiles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
Storing Levels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
Finding a Tile’s Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
Drawing Tiles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
00 Macgame_FM.qxd 2/21/03 5:02 PM Page xvi
xvi Contents
Chapter 6
Animation . . . . . . . . . . . . . . . . 155
Introduction to Sprites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
Generating Animation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
Storing Sprites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
Creating Transparency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
Drawing Sprites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
Sprite Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
Creating the AnimationController Class . . . . . . . . . . . . . . . . . . . . . . . . . . 170
Updating the Animation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
Handling Movement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
Handling Attacks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
Handling Standing. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
Maneuvering the Sprite through the Game World. . . . . . . . . . . . . . 176
Moving Up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
Moving Down . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
00 Macgame_FM.qxd 2/21/03 5:02 PM Page xvii
Contents xvii
Chapter 7
InputSprocket. . . . . . . . . . . . . . 197
Introduction to InputSprocket . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198
Setting Up Your Game to Use InputSprocket. . . . . . . . . . . . . . . . . . 200
What to Place in Your System Extensions Folder . . . . . . . . . . . . . . . . . . . . 200
What to Place in Your Compiler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
InputSprocket Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
InputSprocket Programming. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
InputSprocket Terminology. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
The InputController Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
Starting InputSprocket . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
Determining the Version of InputSprocket the Player Has . . . . . . . . . . . . . 210
Initializing InputSprocket . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
Letting the User Configure the Controls . . . . . . . . . . . . . . . . . . . . . . . . . . 220
Reading Button Presses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222
Reading Player Movement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224
Pausing and Resuming InputSprocket . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
Quitting InputSprocket . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
00 Macgame_FM.qxd 2/21/03 5:02 PM Page xviii
xviii Contents
Chapter 8
HID Manager . . . . . . . . . . . . . . 233
Introduction to the HID Manager . . . . . . . . . . . . . . . . . . . . . . . . . . . 234
Setting Up Your Game to Use the HID Manager . . . . . . . . . . . . . . . 236
Programming with the HID Manager . . . . . . . . . . . . . . . . . . . . . . . . 236
HID Manager Terminology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236
HID Manager Version of the InputController Class . . . . . . . . . . . . . . . . . . 245
Finding the Player’s HID-Capable Devices . . . . . . . . . . . . . . . . . . . . . . . . . 247
Creating Device Interfaces. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249
Opening a Connection to the Input Device . . . . . . . . . . . . . . . . . . . . . . . . 252
Reading Button Presses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252
Reading Digital Movement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259
Reading Analog Movement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262
Configuring Controllers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263
Setting Default Controls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289
Pausing and Resuming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293
Cleaning Up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296
Chapter 9
Reading the Keyboard and Mouse
Plus Event Handling . . . . . . . . . 297
Reading the Keyboard Directly . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298
Reading the Mouse Directly . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300
Reading the Mouse Location . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300
Reading the Mouse Button. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302
Using the Classic Event Manager . . . . . . . . . . . . . . . . . . . . . . . . . . . 303
Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303
00 Macgame_FM.qxd 2/21/03 5:02 PM Page xix
Contents xix
Chapter 10
Sound. . . . . . . . . . . . . . . . . . . 345
A Sound Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346
Sound Formats. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346
Sampled Sounds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349
Programming Sound with the Sound Manager. . . . . . . . . . . . . . . . . 355
The GameSound Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355
Playing a Sound . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 356
Sound Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358
Callback Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 362
Looping a Sound . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365
Setting a Sound’s Volume . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 366
Pausing a Sound . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367
Resuming a Sound . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 368
Stopping a Sound . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 368
Cleaning Up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369
Low-Level Sound Playing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369
Random documents with unrelated
content Scribd suggests to you:
Note 12, p. 4. Mean quantities are such as are intermediate
between others that are greater and less. The mean of any number
of unequal quantities is equal to their sum divided by their number.
For instance, the mean between two unequal quantities is equal to
half their sum.
Note 15, p. 4. Mean radius of the earth. The distance from the
centre to the surface of the earth, regarded as a sphere. It is
intermediate between the distances of the centre of the earth from
the pole and from the equator.
Fig. 4
Note 18, p. 5. Centrifugal force. The force with which a revolving
body tends to fly from the centre of motion: a sling tends to fly from
the hand in consequence of the centrifugal force. A tangent is a
straight line touching a curved line in one point without cutting it, as
m T, fig. 4. The direction of the centrifugal force is in the tangent to
the curved line or path in which the body revolves, and its intensity
increases with the angular swing of the body, and with its distance
from the centre of motion. As the orbit of the moon does not differ
much from a circle, let it be represented by m d g h, fig. 4, the earth
being in C. The centrifugal force arising from the velocity of the
moon in her orbit balances the attraction of the earth. By their joint
action, the moon moves through the arc m n during the time that
she would fly off in the tangent m T by the action of the centrifugal
force alone, or fall through m p by the earth’s attraction alone. T n,
the deflection from the tangent, is parallel and equal to m p, the
versed sine of the arc m n, supposed to be moved over by the moon
in a second, and therefore so very small that it may be regarded as
a straight line. T n, or m p, is the space the moon would fall through
in the first second of her descent to the earth, were she not retained
in her orbit by her centrifugal force.
Fig. 5.
Fig. 6.
Note 22, pp. 5, 11. Conic sections. Lines formed by any plane
cutting a cone. A cone is a solid figure, like a sugar-loaf, fig. 5, of
which A is the apex, A D the axis, and the plane B E C F the base.
The axis may or may not be perpendicular to the base, and the base
may be a circle, or any other curved line. When the axis is
perpendicular to the base, the solid is a right cone. If a right cone
with a circular base be cut at right angles to the base by a plane
passing through the apex, the section will be a triangle. If the cone
be cut through both sides by a plane parallel to the base, the section
will be a circle. If the cone be cut slanting quite through both sides,
the section will be an ellipse, fig. 6. If the cone be cut parallel to one
of the sloping sides as A B, the section will be a parabola, fig. 7. And
if the plane cut only one side of the cone, and be not parallel to the
other, the section will be a hyperbola, fig. 8. Thus there are five
conic sections.
Fig. 7.
Fig. 8.
Fig. 9.
Note 41, p. 8. Equal areas in equal times. See Kepler’s 1st law, in
note 26, p. 5.
Note 44, p. 8. True motion. The motion of a body in its real orbit P
D A Q, fig. 10.
Fig. 10.
Fig. 11.
Note 48, pp. 9, 58. Equation of the centre. The difference between
♈ C m and ♈ S p, fig. 10; that is, the difference between the true
and mean longitudes of a planet or satellite. The true and mean
places only coincide in the points P and A; in every other point of the
orbit, the true place is either before or behind the mean place. In
moving from A through the arc A Q P, the true place p is behind the
mean place m; and through the arc P D A the true place is before
the mean place. At its maximum, the equation of the centre
measures C S, the excentricity of the orbit, since it is the difference
between the motion of a body in an ellipse and in a circle whose
diameter A P is the major axis of the ellipse.
Note 55, p. 9. Nodes. The two points N and n, fig. 12, in which the
orbit N A n P of a planet or comet intersects the plane of the ecliptic
e N E n. The part N A n of the orbit lies above the plane of the
ecliptic, and the part n P N below it. The ascending node N is the
point through which the body passes in rising above the plane of the
ecliptic, and the descending node n is the point in which the body
sinks below it. The nodes of a satellite’s orbit are the points in which
it intersects the plane of the orbit of the planet.
Note 56, p. 10. Distance from the sun. S p in fig. 12. If ♈ be the
vernal equinox, then ♈ S p is the longitude of the planet p, m S p
is its latitude, and S p its distance from the sun. When these three
quantities are known, the place of the planet p is determined in
space.
Note 57, pp. 10, 59. Elements of an orbit. Of these there are
seven. Let P N A n, fig. 12, be the elliptical orbit of a planet, C its
centre, S the sun in one of the foci, ♈ the point of Aries, and E N e
n the plane of the ecliptic. The elements are—the major axis A P;
the excentricity C S; the periodic time, that is, the time of a
complete revolution of the body in its orbit; and the fourth is the
longitude of the body at any given instant—for example, that at
which it passes through the perihelion P, the point of its orbit nearest
to the sun. That instant is assumed as the origin of time, whence all
preceding and succeeding periods are estimated. These four
quantities are sufficient to determine the form of the orbit, and the
motion of the body in it. Three other elements are requisite for
determining the position of the orbit in space. These are, the angle
♈ S P, the longitude of the perihelion; the angle A N e, which is the
inclination of the orbit to the plane of the ecliptic; and, lastly, the
angle ♈ S N, the longitude of N the ascending node.
Note 58, p. 10. Whose planes, &c. The planes of the orbits, as P N
A n, fig. 12, in which the planets move, are inclined or make small
angles e N A with the plane of the ecliptic E N e n, and cut it in
straight lines, N S n passing through S, the centre of the sun.
Fig. 13.
Fig. 14.
Note 63, pp. 14, 16. The whole force, &c. Let S, fig. 13, be the
sun, N m n the plane of the ecliptic, p the disturbed planet moving in
its orbit n p N, and d the disturbing planet. Now, d attracts the sun
and the planet p with different intensities in the directions d S, d p:
the difference only of these forces disturbs the motion of p; it is
therefore called the disturbing force. But this whole disturbing force
may be regarded as equivalent to three forces, acting in the
directions p S, p T, and p m. The force acting in the radius vector p
S, joining the centres of the sun and planet, is called the radial force.
It sometimes draws the disturbed planet p from the sun, and
sometimes brings it nearer to him. The force which acts in the
direction of the tangent p T is called the tangential force. It disturbs
the motion of p in longitude, that is, it accelerates its motion in some
parts of its orbit and retards it in others, so that the radius vector S
p does not move over equal areas in equal times. (See note 26.) For
example, in the position of the bodies in fig. 14, it is evident that, in
consequence of the attraction of d, the planet p will have its motion
accelerated from Q to C, retarded from C to D, again accelerated
from D to O, and lastly retarded from O to Q. The disturbing body is
here supposed to be at rest, and the orbit circular; but, as both
bodies are perpetually moving with different velocities in ellipses, the
perturbations or changes in the motions of p are very numerous.
Lastly, that part of the disturbing force which acts in the direction of
a line p m, fig. 13, at right angles to the plane of the orbit N p n,
may be called the perpendicular force. It sometimes causes the body
to approach nearer, and sometimes to recede farther from, the plane
of the ecliptic N m n, than it would otherwise do. The action of the
disturbing forces is admirably explained in a work on gravitation, by
Mr. Airy, the Astronomer Royal.
Note 64, pp. 16, 74. Perihelion. Fig. 10, P, the point of an orbit
nearest the sun.
Note 65, p. 16. Aphelion. Fig. 10, A, the point of an orbit farthest
from the sun.
Note 66, pp. 16, 17. In fig. 15 the central force is greater than the
exact law of gravity; therefore the curvature P p a is greater than P
p A the real ellipse; hence the planet p comes to the point a, called
the aphelion, sooner than if it moved in the orbit P p A, which makes
the line P S A advance to a. In fig. 16, on the contrary, the curvature
P p a is less than in the true ellipse, so that the planet p must move
through more than the arc P p A, or 180°, before it comes to the
aphelion a, which causes the greater axis P S A to recede to a.
Fig. 15.
Fig. 16.
Note 67, pp. 16, 17. Motion of apsides. Let P S A, fig. 17, be the
position of the elliptical orbit of a planet, at any time; then, by the
action of the disturbing forces, it successively takes the position Pʹ S
Aʹ, Pʺ S Aʺ, &c., till by this direct motion it has accomplished a
revolution, and then it begins again; so that the motion is perpetual.
Fig. 17.
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.
ebooknice.com