Programming 101: Learn to Code Using the Processing Programming Language, 2nd Edition Jeanine Meyer download
Programming 101: Learn to Code Using the Processing Programming Language, 2nd Edition Jeanine Meyer download
https://ebookmeta.com/product/programming-101-learn-to-code-
using-the-processing-programming-language-2nd-edition-jeanine-
meyer/
https://ebookmeta.com/product/the-essential-guide-to-html5-using-
games-to-learn-html5-and-javascript-3rd-edition-jeanine-meyer/
https://ebookmeta.com/product/c-programming-learn-to-code-1st-
edition-sisir-kumar-jena/
https://ebookmeta.com/product/programming-for-absolute-beginners-
using-the-javascript-programming-language-1st-edition-jonathan-
bartlett/
https://ebookmeta.com/product/remember-me-ravenswood-book-2-1st-
edition-mary-balogh/
Plant MicroRNAs and Stress Response 1st Edition Deepu
Pandita Anu Pandita
https://ebookmeta.com/product/plant-micrornas-and-stress-
response-1st-edition-deepu-pandita-anu-pandita/
https://ebookmeta.com/product/pathfinder-rpg-advanced-player-s-
guide-p2-2nd-edition-paizo-inc/
https://ebookmeta.com/product/sharpening-mathematical-analysis-
skills-problem-books-in-mathematics-sintamarian/
https://ebookmeta.com/product/team-roles-at-work-3rd-edition-r-
meredith-belbin/
https://ebookmeta.com/product/english-folk-poetry-structure-and-
meaning-roger-dev-renwick/
Good Good Father Chris Tomlin
https://ebookmeta.com/product/good-good-father-chris-tomlin/
Programming 101
Learn to Code with the Processing
Language Using a Visual Approach
Second Edition
Jeanine Meyer
Programming 101: Learn to Code with the Processing Language Using a Visual
Approach
Jeanine Meyer
Mt Kisco, NY, USA
Introduction������������������������������������������������������������������������������������������������������������xxi
Chapter 1: Basics����������������������������������������������������������������������������������������������������� 1
Abstract����������������������������������������������������������������������������������������������������������������������������������������� 1
Programming Concepts���������������������������������������������������������������������������������������������������������������� 3
Programming Languages and Natural Languages������������������������������������������������������������������ 3
Values and Variables��������������������������������������������������������������������������������������������������������������� 3
Functions��������������������������������������������������������������������������������������������������������������������������������� 5
Specifying Positions and Angles���������������������������������������������������������������������������������������������� 6
Colors�������������������������������������������������������������������������������������������������������������������������������������� 7
Development Environment������������������������������������������������������������������������������������������������������ 7
Role of Planning���������������������������������������������������������������������������������������������������������������������� 8
Under the Covers�������������������������������������������������������������������������������������������������������������������������� 8
Processing Programming Features����������������������������������������������������������������������������������������������� 9
Processing Development Environment������������������������������������������������������������������������������������ 9
Functions������������������������������������������������������������������������������������������������������������������������������� 11
Angles������������������������������������������������������������������������������������������������������������������������������������ 12
Implementing Hello, World���������������������������������������������������������������������������������������������������������� 14
Implementing the Daddy Logo���������������������������������������������������������������������������������������������������� 22
Planning��������������������������������������������������������������������������������������������������������������������������������� 22
Daddy Logo Program������������������������������������������������������������������������������������������������������������� 25
v
Table of Contents
Chapter 2: Interactions������������������������������������������������������������������������������������������� 33
Abstract��������������������������������������������������������������������������������������������������������������������������������������� 33
Note��������������������������������������������������������������������������������������������������������������������������������������� 33
Programming Concepts�������������������������������������������������������������������������������������������������������������� 35
Events������������������������������������������������������������������������������������������������������������������������������������ 35
Randomness�������������������������������������������������������������������������������������������������������������������������� 36
Displaying Images from Files������������������������������������������������������������������������������������������������ 36
Calculations, Including Built-in Functions����������������������������������������������������������������������������� 36
Looping���������������������������������������������������������������������������������������������������������������������������������� 37
Processing Programming Features��������������������������������������������������������������������������������������������� 37
Note��������������������������������������������������������������������������������������������������������������������������������������� 38
Under the Covers������������������������������������������������������������������������������������������������������������������������ 41
Polygon Sketch Operation Overview������������������������������������������������������������������������������������������� 42
Implementing the Polygon Sketch���������������������������������������������������������������������������������������������� 44
Planning��������������������������������������������������������������������������������������������������������������������������������� 44
Polygon Sketch Program������������������������������������������������������������������������������������������������������� 47
Coin-Toss Sketch Operation Overview���������������������������������������������������������������������������������������� 49
Implementing the Coin-Toss Sketch������������������������������������������������������������������������������������������� 52
Planning��������������������������������������������������������������������������������������������������������������������������������� 52
Things to Look Up����������������������������������������������������������������������������������������������������������������������� 56
How to Make This Your Own������������������������������������������������������������������������������������������������������� 56
What You Learned����������������������������������������������������������������������������������������������������������������������� 57
What’s Next��������������������������������������������������������������������������������������������������������������������������������� 58
vi
Table of Contents
vii
Table of Contents
Chapter 4: Classes�������������������������������������������������������������������������������������������������� 85
Abstract��������������������������������������������������������������������������������������������������������������������������������������� 85
Programming Concepts�������������������������������������������������������������������������������������������������������������� 86
Classes���������������������������������������������������������������������������������������������������������������������������������������� 86
Phases of Operations������������������������������������������������������������������������������������������������������������� 87
Tolerance or Margin��������������������������������������������������������������������������������������������������������������� 88
Processing Programming Features��������������������������������������������������������������������������������������������� 88
Classes���������������������������������������������������������������������������������������������������������������������������������� 88
Definition of Images, Rectangles, and Ellipses���������������������������������������������������������������������� 90
Dynamic Arrays��������������������������������������������������������������������������������������������������������������������� 90
Tolerance and OK-So-Far Coding������������������������������������������������������������������������������������������ 92
Bouncing Objects Overview�������������������������������������������������������������������������������������������������������� 92
Implementing the Bouncing Objects������������������������������������������������������������������������������������������� 94
Planning��������������������������������������������������������������������������������������������������������������������������������� 94
Program��������������������������������������������������������������������������������������������������������������������������������� 96
Make Path and Travel Path Overview���������������������������������������������������������������������������������������� 100
Implementing the Make Path and Travel Path�������������������������������������������������������������������������� 103
Planning������������������������������������������������������������������������������������������������������������������������������� 104
Program������������������������������������������������������������������������������������������������������������������������������� 105
Jigsaw Overview����������������������������������������������������������������������������������������������������������������������� 109
Implementing the Jigsaw��������������������������������������������������������������������������������������������������������� 111
Planning������������������������������������������������������������������������������������������������������������������������������� 111
Program������������������������������������������������������������������������������������������������������������������������������� 114
Under the Covers���������������������������������������������������������������������������������������������������������������������� 125
Things to Look Up��������������������������������������������������������������������������������������������������������������������� 126
How to Make This Your Own����������������������������������������������������������������������������������������������������� 126
What You Learned��������������������������������������������������������������������������������������������������������������������� 127
What’s Next������������������������������������������������������������������������������������������������������������������������������� 127
viii
Table of Contents
ix
Table of Contents
x
Table of Contents
xi
Table of Contents
xii
Table of Contents
Index��������������������������������������������������������������������������������������������������������������������� 343
xiii
About the Author
Jeanine Meyer is Professor Emerita at Purchase College/
SUNY. Before Purchase, she taught at Pace University and
prior to that was a manager and research staff member
at IBM Research in robotics and manufacturing. She also
worked as a research consultant at IBM for educational grant
programs.
She was moved to create this book because of a general
wish to make programming less mysterious and more
appealing while featuring the challenges. She enjoys
spending time with favorite pictures and video clips as well as producing programs. The
chance for a new edition provided a reason to explore p5.js, tools for using JavaScript
with features from Processing.
She is the author of five books and coauthor of five more on topics ranging from
educational uses of multimedia, programming, databases, number theory, and origami.
She earned a PhD in computer science at the Courant Institute at New York University,
an MA in mathematics at Columbia, and an SB (the college used the Latin form) in
mathematics from the University of Chicago. Recently, she has given lectures, in-person
and remotely, connecting origami, mathematics, and computer science as well as the
use and misuse of math in the news. She is a member of Phi Beta Kappa, Sigma Xi, the
Association for Women in Science, and the Association for Computing Machinery.
Jeanine is trying but remains a beginner at Spanish and piano.
xv
About the Technical Reviewer
Joseph McKay is an associate professor of new media. He primarily teaches new
directions in virtual space, programming for visual artists, intro to physical computing,
hacking the everyday, senior seminar, and web development.
Joe’s work is focused on interactive art games. He makes games that have their roots
in fine art but are also fun and easy to play. He is currently working on a VR art game
with innovative locomotion.
xvii
Another Random Scribd Document
with Unrelated Content
in nature. Together we searched the woods, the fields and the banks
of the Loire, procuring every bird we could, and I made drawings of
every one of them—very bad, to be sure, but still they were of
assistance to me."[107]
As early as the autumn of 1805, if not before, plans were laid for
getting young Audubon again safely out of France, for fear, no
doubt, that the remorseless conscription officers of Napoleon would
send him to the war if he remained. At that time Lieutenant
Audubon and his wife issued jointly to their son and to Ferdinand
Rozier a power of attorney for the conduct of their business affairs in
America. Parts only of this punctilious document, which was written
in French, have been preserved,[111] and these through the
translation of a "notary public and sworn interpreter of foreign
languages for the Commonwealth of Pennsylvania, resident in
Philadelphia." The names of the grantors, who signed this letter on
October 21, 1805, were attested under the signature and seal of the
mayor of Couëron; this official upon the same day declared that, in
conformity with the rigorous requirements of the laws of the State of
Pennsylvania, since "no other act, not even a notarial instrument,
can in any manner supply the same," he had examined Anne Moynet
Audubon apart, when she admitted that she perfectly understood
the nature of the act, which she had "signed, sealed, and delivered
of her own free will and accord, without being compelled thereto by
her husband, either by threats, or by any other means of compulsion
whatsoever." The mayor's signature was authenticated three days
later by the subprefect of Savenay, and the formality was finally
closed by the attestation of his signature by the prefect, on the 27th
of November.
It was during this last visit to his home in France that Audubon's
sister, Rosa,[112] was married to Gabriel Loyen du Puigaudeau, who
was not, however, as the naturalist has stated, either "the son of a
fallen nobleman" or his father's "secretary." Du Puigaudeau came
from a family of merchants in easy circumstances, and for a long
time lived the life of a country gentleman of leisure—for a period at
Port Launay, below Couëron, and later, after Lieutenant Audubon's
death, at his own villa, "Les Tourterelles," in that commune, not far
from "La Gerbetière." His father, though of a rich family, was not a
"gentleman," that is, a member of the aristocracy, as the term was
then used in France. Du Puigaudeau was without any settled
business, but his revenues, upon which he depended, failed not long
after the death of his father-in-law. He and young Audubon appear
to have been good friends for many years, and after the latter's
return to America they corresponded to as late as 1820, when for
some reason their relations were broken.
Upon reaching a point thirty miles off Sandy Hook, they learned
from a fishing smack that two British frigates lay off the harbor and
were impressing American seamen, that, in short, they were even
more unwelcome than pirates who sailed under letters of marque.
The captain, thus forewarned of one danger, had the misfortune to
run into another, for upon taking his vessel into Long Island Sound,
she encountered a storm and was stranded in a gale; no great harm
was experienced, however, for the vessel was finally floated off and
reached New York on the following day. The passage money paid by
Audubon and Rozier to Captain Sammis amounting to 525 livres, or
$125,[115] was entered, according to their articles of agreement, as
the first item of their "social expenses." After a brief visit with
Benjamin Bakewell they hurried to "Mill Grove," and Audubon to the
home of his sweetheart, Lucy.
CHAPTER X
"LA GERBETIÈRE" OF YESTERDAY AND TODAY
Home of Audubon's youth at Couëron—Its situation on the Loire—History of the
villa and commune—Changes of a century.
Upon Audubon's first return from the United States in the spring
of 1805, he said that his vessel entered the mouth of the Loire and
anchored off Paimbœuf, the lower harbor of Nantes. "On sending my
name to the principal officer of the customs," the narrative
continues, "he came on board, and afterwards sent me to my
father's villa, La Gerbetière, in his barge and with his own men." It is
to be noticed, incidentally, that as the distance to be covered
between the lower and upper harbors was twenty-five miles, or
sixteen miles to Couëron, such journeys no doubt were made upon
the arrival of incoming vessels for the regular business of the
service.
Duplicate.
My very dear and venerable father:
"1. Mr. Dacosta shall have the lot of 113 and a half acres, situated
on the N.E. side of Perkioming creek, with all the buildings, mines, et
cet., and in general all that it contains.
"2. Mr. Audubon shall have the lot of 171 acres, situated on the
other side of the creek.
"3. Mr. Dacosta shall pay to Mr. Audubon for the difference [in value]
of the lot of 113½ acres, and of that which it contains:
"2. The sum of four thousand dollars, upon the first products of
the lead mine.
"4. The contract made with Mr. Thomas shall remain to the charge of
the two parties.
"By our letter of the 4th July we have sent the account
current of Mr. Dacosta, by which Mr. Audubon is charged with
315 dollars and 5 cents; we have begged you to send the
documentary evidence which may put us in a position to prove
that Mr. Audubon ought not to pay Mr. Dacosta's private
expenses, as the matter is to be decided here by arbitrators. We
beg Mr. Audubon to use the utmost speed in sending his
documents. It is our ardent [hope] also that you have received
our first [letter] of May 31, with that of Mr. Bakewell, the
merchant in New York, with a remittance of 3,000 and a few
francs for the purchase of divers objects. I assure you that we
are in the greatest anxiety [as to] what is the state of your
health,[128] as well as that of the family, and to learn if you have
received our letters. The nephew of Mr. Bakewell writes us that
his uncle in New York has despatched several vessels consigned
to you, for which I congratulate you sincerely. We have also
received your letter of the 30th of June, but I cannot reply to it,
since the boat is leaving this evening for Amsterdam, but you
can count upon my conforming to its contents. Your personal
letter grieved me particularly by your last expressions, and I
should wish that you would have done me more justice; I can
have made mistakes, but for ... the idea alone has made me
shudder. I am delighted that all the family is enjoying perfect
health. Embrace dear Mama for me; my kind regards to my
brother and sisters; do not forget to remember me to all the
family, and to our friend, Mr. Audubon, the father, and his family.
Finally, my dear Papa, be assured that I shall forget nothing to
increase our intimacy. You give me the means of supporting it
with labor. Believe in my sincere and enduring attachment.