Geometric Computation: Foundations for Design
eBook - ePub

Geometric Computation: Foundations for Design

Joy Ko, Kyle Steinfeld

Share book
  1. 448 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Geometric Computation: Foundations for Design

Joy Ko, Kyle Steinfeld

Book details
Book preview
Table of contents
Citations

About This Book

Geometric Computation: Foundations for Design describes the mathematical and computational concepts that are central to the practical application of design computation in a manner tailored to the visual designer. Uniquely pairing key topics in code and geometry, this book develops the two key faculties required by designers that seek to integrate computation into their creative practice: an understanding of the structure of code in object-oriented programming, and a proficiency in the fundamental geometric constructs that underlie much of the computational media in visual design.

Frequently asked questions

How do I cancel my subscription?
Simply head over to the account section in settings and click on ā€œCancel Subscriptionā€ - itā€™s as simple as that. After you cancel, your membership will stay active for the remainder of the time youā€™ve paid for. Learn more here.
Can/how do I download books?
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
What is the difference between the pricing plans?
Both plans give you full access to the library and all of Perlegoā€™s features. The only differences are the price and subscription period: With the annual plan youā€™ll save around 30% compared to 12 months on the monthly plan.
What is Perlego?
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, weā€™ve got you covered! Learn more here.
Do you support text-to-speech?
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Is Geometric Computation: Foundations for Design an online PDF/ePUB?
Yes, you can access Geometric Computation: Foundations for Design by Joy Ko, Kyle Steinfeld in PDF and/or ePUB format, as well as other popular books in Arquitectura & Arquitectura general. We have over one million books available in our catalogue for you to explore.

Information

Publisher
Routledge
Year
2018
ISBN
9781317659075

1.01 ELEMENTS OF A COMPUTATION

A script is, at its essence, simply a way to explain to a computer what you would like it to do. It is a sequence of statements, usually stored in a text file, written in a highly-structured way so that it may be interpreted by a computer. We may understand a computation as the act of interpreting these statements, executing the instructions contained within, and thereby successively changing the state of things. Notice the three distinct elements at work in this definition. First, there are the statements themselves, which include the syntax and structure of the scripts we author. Next, there is the interpretation and execution of these statements, an act carried out by a computer, hopefully in a manner that we expect. Finally, there is the ā€œstate of thingsā€, which implies both the context in which the computation occurs as well as the nature of the intended result. Naturally, the things with which we compute are described as some sort of data, which may include the geometric data that constitutes the primary focus of this text. An understanding of these basic elements - syntax, execution, and context - are the bedrock of computational literacy**, and embody the ideas we must grasp in order to write scripts proficiently. In the pages to follow, we offer a general account of each of these elements, and introduce a visual metaphor and diagrammatic language that will assist us in apprehending their nature more fully. First, a note on the character of our partner in computation: the computer.
The first two elements in our definition of a computation, syntax and execution, evoke language. They suggest that a communication is taking place, an idea that is reflected in our initial description of a script as a means to explain to a computer what we want it to do. At times in this process, the computer might even speak back by informing us of the result of our requests, or, more often, criticizing the manner in which we asked. Although we might think of the whole computer (or the physical parts of it that we can see) as our conversation partner, it may be more useful when scripting in Python to imagine speaking to a slightly different entity. In Python, the evaluation and execution of statements is handled not by the operating system directly, but by an intermediary called the Python interpreter, in an environment termed the shell. The shell interprets the intended meaning of what we say in our script, complains when we misspeak, and generally keeps track of the state of things. A new shell, and thus a new conversation, is typically created at the start of the execution of a script, and is often associated with the presence of a graphic window on our screens. When scripting, it is useful to imagine ourselves in conversation with the Python shell, and to regard the larger environment of the computer, including the operating system, the data in memory and those contained in our hard-drives, as context.
fig1_002.tif
fig 1.002 THE PYTHON SHELL

SYNTAX, EXECUTION, AND CONTEXT

A good way to begin to understand how the elements of a computation interact is to examine simple prototypical examples. Here weā€™ll present two such cases that, surprisingly, encompass the range of all possible statements. It may be comforting to learn that the only two categories of statement that are possible in scripts are definitions and commands.

A Definition

A definition is a request to remember some piece of information. In response to such a request, the shell associates a name with a piece of data, providing a convenient mechanism by which to refer to it later. For example, the following statement associates the name problem_count with an Integer number:
ā€¢ problem_count = 99
While the meaning of this statement is intuitive, its syntax is worth a bit of commentary. The equality sign (=) is a special symbol used in many programming languages to construct definitions. Special symbols such as this are called operators, which we will discuss in the next chapter. From a technical perspective, we would term the statement above an assignment statement, which associates a variable name with an object stored in memory**. The format above may be generalized to capture all statements of assignment:
some_name = some_thing
Even in this simple statement, some of the basic elements of a computation are manifest. First, the authoring of this tiny script implies a cursory understanding of the syntax of statements, the first of our three elements. To write it, we must understand that the equality sign is used for assignment, and may be used to compose a request to relate a name on the left to an Integer number on the right. Further, implicit in such a request is an understanding of the context in which the subsequent computation takes place, the third of the three elements. In relating the name problem_count to the Integer number 99, we assume that the shell already has a model for what a number is, or more specifically, what an Integer is. Such a model is called a data type, while the number 99 itself is referred to as an object, both concepts that weā€™ll present in the next chapter of this text. It is by these mechanisms that the above statement is interpreted as a request for a change in the state of the data stored in computer memory, specifically, a request that an Integer number be stored and associated with a name so that it may be later accessed. Accessed, perhaps, by a command.

A Command

In contrast with a definition, which simply stores information, a command is a statement that instructs the computer to actively do something, often utilizing information that has been previously defined. For example, the following statement refers to a previously defined object by name, and requests that the computer take an action based upon it:
ā€¢ print ā€œIā€™ve gotā€ , problem_count , ā€œprobLems.ā€
Nothing new is stored in memory here, and the state of things has not been altered. Rather, this statement causes the interpreter to display some textual output.
Ā» Iā€™ve got 99 problems.
There are several things worth noticing here. First, building upon our discussion above, we see two operators at work: quotation marks (ā€œ) and commas (,). This syntax governs the order in which the other expressions in our statement are executed by the shell, as per the second of our three elements of a computation. We might infer from the resulting output that the quotation marks serve to set apart characters that we want the computer to interpret as literal text, and that the commas somehow combine words and numbers together. Next, we may again note the overall syntax. Understanding the function of the commas as joining things together, we might simplify this statement:
print something
Or, to be more general:
verb noun
While this is not the only syntactical structure that weā€™ll encounter as we code (in fact, this one is fairly unique), itā€™s important to understand that all statements must adhere to a limited set of syntactical constructs that constitute valid expressions. We cannot write for computers as we would for a human audience, as computers are very particular about the format and clarity of their instructions. Expressions and syntax in Python will be discussed in detail in the next chapter.
The last thing we should noti...

Table of contents