Week 2
Course Arch 2042
Date 2012/03/02
Learning Objectives We continue developing algorithms for geometric constructions using a simple toolkit of compass and straightedge. The structure of code topics covered will include control flow statements, code organization structures, and lists. We will then return to the compass straightedge constructions and understand how to translate that into code.
Agenda
• Workshop 2
• Control Flow: Conditionals, Iteration, Interruption
• Code Org and Mod: Functions, Parameter passing and return values
• Object Rep and Man.: lists and operations
• Geometric Constructions in 2D
Uses Tool(s)

## Workshop 2

### Control Flow

How do computers execute instructions? The control-flow statements specify the order in which computations are performed.

Conditionals
statements used to express decisions.
Iteration
loops statements control iterations.

### Object Representation and Manipulation

Collections
sometimes storing just one object at a time isn't enough.

### Code Organization and Modularization

Functions
provides a way to encapsulate some computation, which can be used without worrying about its implementation

### Geometric Constructions in 2D

So far we have worked with the basic object types of int, float, string, list. With the help of the rhinoscript package, we will start using objects familiar to you in Rhino, and learning how the manipulation of these objects can be done using the same structures that we've been using to manipulate more basic object types.

Points in 2D
representing and generating points and collections of points in 2D, drawn to the Rhino canvas
Compass-Straightedge constructions
geometric constructions using compass straighedge, translated into code

## Assignment

In Rhino you are familiar with the commands "Move", "Mirror", "Rotate", "Scale". These are all examples of transformations, which are rules that assign to every point P another point P'. In this exercise, you will be considering these transformations, restricting your attention to how they act on points in the plane (in this case, these are called plane transformations ).

Choose two of these plane transformations and do the following for each:

1. Develop an algorithm for the transformation assuming that you only have a compass and straightedge. Where possible, take the input parameters that Rhino uses for each transformation and adapt these to a 2D setting (eg. for "Move", you will need a start point and an end point; for "Mirror", you will need a reflection axis; for "Rotate", a center point and an angle or reference point; for "Scale", a start point and a scale factor or reference point). Doing this by precise illustration and description will help you in the next part of this assignment.
2. Translate your algorithm into code and encapsulate it into a function. Make sure to test your function on a selection of input points and parameters.
3. Using the full toolset of the rhinoscript package, develop a more concise function for this transformation.

For the two transformations that you did not choose, complete part 3. above.

Consolidate your code into a single file, take a photo or scan of your algorithm in 1. and place these into your Dropbox folder before class.