Python Graphics. Apress

- A Reference for Creating 2D and 3D Images -

B.J. Korites


e-books shop
e-books shop
Purchase Now !
Just with Paypal



Book Details
 Price
 4.00
 Pages
 365 p
 File Size 
 10,569 KB
 File Type
 PDF format
 ISBN-13
 978-1-4842-3377-1 (pbk)
 978-1-4842-3378-8  (electronic) 
 Copyright©   
 2018 by B.J. Korites

About the Author
B.J. Korites has been involved in engineering and scientific
applications of computers for his entire career. He has
been an educator, consultant, and author of more than
ten books on geometric modelling, computer graphics,
artificial intelligence, simulation of physical processes,
structural analysis, and the application of computers
in science and engineering. He has been employed by
Northrop Corporation, the Woods Hole Oceanographic
Institute, Arthur D. Little, Itek, and Worcester Polytech.
He has consulted for Stone and Webster Engineering, Gould Inc, Wyman Gordon, CTI
Cryogenics, the US Navy, Aberdeen Proving Grounds, and others. Early in his career he
developed mathematics and software that would find physical interferences between
three-dimensional solid objects. This found wide application in the design of nuclear
power plants, submarines, and other systems with densely packed spaces. He enjoys
sailing and painting maritime landscapes in oils. He holds degrees from Tufts and Yale.

About the Technical Reviewer
Andrea Gavana has been programming in Python for
almost 15 years and dabbling with other languages since the
late nineties. He graduated from university with a Master’s
degree in Chemical Engineering, and he is now a Senior
Reservoir Engineer working for Maersk Oil in Copenhagen, Denmark.
Andrea enjoys programming at work and for fun, and
he has been involved in multiple open source projects, all
Python-based. One of his favorite hobbies is Python coding,
but he is also fond of cycling, swimming, and cozy dinners
with family and friends.

Table of Contents
About the Author .............
About the Technical Reviewer ..............
Acknowledgments ....
Chapter 1: Essential Python Commands and Functions
1.1 Programming Style   2
1.2 The Plotting Area   3
1.3 Establishing the Size of the Plotting Area   4
1.4 Importing Plotting Commands   6
1.5 Displaying the Plotting Area  8
1.6 T he Plotting Grid  8
1.7 Saving a Plot  8
1.8 G rid Color   9
1.9 T ick Marks  9
1.10 Custom Grid Lines   11
1.11 L abelling the Axes  13
1.12 T he Plot Title  14
1.13 C olors  15
1.13.1 C olor Mixing  16
1.13.2 C olor Intensity  19
1.14 O verplotting  20
1.15 B ackground Color  23
1.16 T he Plotting Area Shape  23
1.17 How to Correct Shape Distortions  26
1.17.1 Applying a Scale Factor When Plotting   27
1.17.2 The Best Way: Scaling the Axes in plt.axis( )  27
1.18 Coordinate Axes   29
1.19 Commonly Used Plotting Commands and Functions   30
1.19.1 Points and Dots Using scatter( )  31
1.19.2 Lines Using plot( )  32
1.19.3 Arrows   33
1.19.4 Text   34
1.19.5 Lists, Tuples, and Arrays   36
1.19.6 Arrays   41
1.19.7 arange( )  42
1.19.8 range( )   43
1.20 S ummary   43
Chapter 2: Graphics in Two Dimensions   
2.1 Lines from Dots  45
2.2 Dot Art  50
2.3 Circular Arcs from Dots  52
2.4 Circular Arcs from Line Segments  59
2.5 C ircles   60
2.6 D ot Discs   64
2.7 E llipses  68
2.8 2D Translation   75
2.9 2 D Rotation  78
2.10 Summary  100
Chapter 3: Graphics in Three Dimensions
3.1 The Three-Dimensional Coordinate System  101
3.2 Projections onto the Coordinate Planes   104
3.3 Rotation Around the y Direction   106
3.4 Rotation Around the x Direction   109
3.5 Rotation Around the z Direction  111
3.6 Separate Rotations Around the Coordinate Directions  113
3.7 Sequential Rotations Around the Coordinate Directions   121
3.8 Matrix Concatenation   129
3.9 Keyboard Data Entry with Functional Program Structure   133
3.10 Summary  141
Chapter 4: Perspective
4.1 Summary  152
Chapter 5: Intersections
5.1 Line Intersecting a Rectangular Plane  153
5.2 Line Intersecting a Triangular Plane  166
5.3 Line Intersecting a Circle   181
5.4 Line Intersecting a Circular Sector   181
5.5 Line Intersecting a Sphere   187
5.6 Plane Intersecting a Sphere   196
5.7 S ummary  201
Chapter 6: Hidden Line Removal
6.1 Box   203
6.2 Pyramid  212
6.3 Planes   218
6.4 Sphere   225
6.5 S ummary  233
Chapter 7: Shading
7.1 Shading a Box  236
7.2 Shading a Sphere  246
7.3 Summary   253
Chapter 8: 2D Data Plotting
8.1 Linear Regression   265
8.2 Function Fitting   269
8.3 Splines   275
8.4 Summary   283
Chapter 9: 3D Data Plotting
9.1 3D Surfaces   297
9.2 3D Surface Shading   305
9.3 Summary   319
Chapter 10: Demonstrations
10.1 Saturn  321
10.2 Solar Radiation  331
10.2.1 Photons and the Sun   331
10.2.2 Max Planck’s Black Body Radiation   333
10.2.3 The Sun’s Total Power Output  334
10.3 Earth’s Irradiance  344
10.3.1 The Earth Sun Model  346
10.4 Summary  351
Appendix A: Where to Get Python ....... .......... 353
Appendix B: Planck’s Radiation Law and the Stefan-Boltzmann Equation ........... 355
Index . ........................ 359


Bookscreen
e-books shop

Acknowledgments
I would like to thank my wife, Pam, for her patience during the many long days and
nights that I spent writing this book and for her understanding of the distant stare I
sometimes had while off in another world thinking of math and Python, two of life’s great
joys. I would also like to thank everyone at Apress, especially editors Todd Green and Jill
Balzano, who made the production of this book a fast and seamless process.
Previous Post Next Post