2D ANIMATION & INTERACTION COURSE WEEK 5 QUICK REFERENCE

Size: px
Start display at page:

Download "2D ANIMATION & INTERACTION COURSE WEEK 5 QUICK REFERENCE"

Transcription

1 The Imaginary Institute institute.com institute.com 2D ANIMATION & INTERACTION COURSE WEEK 5 QUICK REFERENCE RANDOM NUMBERS By using random numbers, you can generate lots of different objects that all appear to belong to the same family. ou can also add unpredictability to your program. Crea%ng random numbers ou can create a random number within any range by handing the low and high values to random(): // get a value of 5 or more but never quite 10 v = random(5, 10); ou ll get back a value that could be as small as the first number, but never quite as large as the second one. The first number must always be smaller (that is, to the left on the number line) than the second number. If you want to generate the same sequence of random numbers each time you run your program, call randomseed() at the very beginning, giving it any integer you like. // always produce the same random numbers randomseed(10); ARRAS An array can hold a list of any one type of object. To create an array, you first declare it to be a list of that type by naming the type followed by square brackets: float[] berryweights; // declare an array of floats Then you have to actually create the memory for the array by assigning it the result of the keyword new followed by the type, and the desired length of the array in square brackets: berryweights = new float[3]; // the array has 3 entries Then fill in the values of the array one by one by assigning to each entry. To reference a particular element of an array, name the array, followed by an open square bracket, the index, and a closing square bracket, all without spaces. The Imaginary Institute, All rights reserved.

2 Important note: Array index values start at 0. Thus an array of 10 elements will have indices 0 through 9. Asking for an index that is negative, or beyond the length of the array, will cause your program to crash. berryweights[0] = 3.3; berryweights[1] = 2.78; berryweights[2] = 1.5; The length of every array can be found by naming the array followed by a period and the word length. ou can use this to write a loop to fill up an array: for (int i=0; i<berryweights.length; i++) { } berryweights[i] = 3*(i+1); // berries get heavier A shortcut that works only when you re declaring an array is to provide its starting values in curly braces. Processing will count them up for you and automatically allocate the appropriate amount of memory. float berryweights = { 3.3, 2.78, 1.5 }; Array Opera)ons ou can modify an array with built- in operations. In the following, the variable a is the name of the array being manipulated, and b is some other array of the same type. The variables m and n are integers. These all create and return a new array. In all operations that use two arrays, they must both be of the same type (e.g., int or float). append(a, v) arraycopy(a, b) concat(a, b) expand(a, m); reverse(a) shorten(a) sort(a) splice(a,b,n) subset(a,m,n) extend the array by one element and put v in it copy one array to another append one copy to another extend the array by m entries reverse the entries in the array make the array shorter by deleting the last entry sort the entry elements paste array b into array a starting at n extract n entries from a starting at index m Page 2

3 MODULO The modulo operator, written with %, takes two values a and b. When both values are positive, the result of a%b is what s left over when b is subtracted from a as many times as possible without a becoming negative. 8%3 has the value 2, because we remove 3 twice, leaving 2 7%7 has the value 0, as does 14%7, 21%7, etc. Modulo is very useful when working with arrays to make sure we don t go beyond the bounds of the array. For example, if we want to print 100 numbers but our array is less than 100 entries long, we can use modulo to re- use the array entries as many times as needed: for (int i=0; i<100; i++) { int j = i % myarray.length; // j is now between 0 and myarray.length-1 println( entry number +i+ is +myarray[j]); } TRANSFORMS Every reference to a point on the screen has an x and y value. These are always interpreted with respect to the current coordinate system. If we change the coordinate system, then everything we draw after that change will be with respect to the new system. Transformations accumulate. So to make a complex drawing, we often make some transformations, draw some graphics, transform some more, draw more graphics, and so on. Just as when we change drawing specifications like the fill or stroke color, objects already drawn are not affected in any way; only the objects that come after the change depend on the new values. Each time draw() begins, the coordinate system is reset to the default: (0,0) is in the upper left of the graphics window, the X axis points right, the axis points down, and both axes are 1 pixel long. Page 3

4 Translate We can move the origin of the coordinate system with translate(). It tells us how to move along X and to locate the point where the origin ought to go. Note that as always, these x and y values are interpreted with respect to the current coordinate system. translate(tx, ty); // move the origin to (tx,ty) before after Rotate We can re- direct the axes of the coordinate system with rotate(). It takes an angle (in radians), and rotates the coordinate system clockwise by that amount. rotate(angle); // rotate the axes by angle (0,0) X before after Page 4

5 Scale We can change the size of the axes. To multiply the length of both axes by the same amount, hand that value to scale(). A value greater than 1 causes the axes to enlarge, which has the effect of making everything that is then drawn appear larger. A value between 0 and 1 makes the axes shrink, making following objects appear smaller. scale(s); // make everything bigger or smaller by s (0,0) X before after ou can scale each axis by a different amount by using two arguments. This is particularly useful when you want to flip something around one of the axes. For example, to flip an object left to right, but leave it unchanged vertically, scale the X axis by - 1 and the axis by 1. scale(-1, 1); // flip the X axis Important note: If you use the two- argument form of scale and then later rotate the system, you may find that your objects seem to lean, or skew, in some unexpected way. This is a natural result of the mathematics. If you don t want to see skew, then always scale both axes by the same amount by using the one- argument form of scale(). Page 5

6 THE TRANSFORM STACK The system maintains a stack of transformations. Each transformation is represented internally by a mathematical object called a matrix, so this stack is often called the transformation matrix stack, or the matrix stack, or the transform stack. The stack offers a specialized kind of save- and- undo mechanism. To save the current transformation so that you can return to it later, you push it onto the top of the stack. This creates a copy of the current transformation matrix and saves that copy on the top of the stack. ou can continue to make more transformations and push them onto the stack. When you want to undo the most recent set of transformations, you pop the stack. The matrix that s on top is thrown away, and the transformation you saved most recently becomes the active one. pushmatrix(); popmatrix(); // save the current transformation // undo all transforms back to the last push Every push must be followed, eventually, by exactly one pop. Avoid popping more times than you ve pushed. If you ever do try to pop the stack when there s nothing remaining to be popped, your program will crash. Page 6

Transform 1: Translate, Matrices

Transform 1: Translate, Matrices Transform 1: Translate, Matrices This unit introduces coordinate system transformations and explains how to control their scope. Syntax introduced: translate(), pushmatrix(), popmatrix() The coordinate

More information

Grade 6 Math Circles November 6 & Relations, Functions, and Morphisms

Grade 6 Math Circles November 6 & Relations, Functions, and Morphisms Faculty of Mathematics Waterloo, Ontario N2L 3G1 Centre for Education in Mathematics and Computing Relations Let s talk about relations! Grade 6 Math Circles November 6 & 7 2018 Relations, Functions, and

More information

Basics of Computational Geometry

Basics of Computational Geometry Basics of Computational Geometry Nadeem Mohsin October 12, 2013 1 Contents This handout covers the basic concepts of computational geometry. Rather than exhaustively covering all the algorithms, it deals

More information

Review Cellular Automata The Game of Life. 2D arrays, 3D arrays. Review Array Problems Challenge

Review Cellular Automata The Game of Life. 2D arrays, 3D arrays. Review Array Problems Challenge Review Cellular Automata The Game of Life 2D arrays, 3D arrays Review Array Problems Challenge example1.pde Up until now All movement and sizing of graphical objects have been accomplished by modifying

More information

Junior Circle Meeting 9 Commutativity and Inverses. May 30, We are going to examine different ways to transform the square below:

Junior Circle Meeting 9 Commutativity and Inverses. May 30, We are going to examine different ways to transform the square below: Junior Circle Meeting 9 Commutativity and Inverses May 0, 2010 We are going to examine different ways to transform the square below: Just as with the triangle from last week, we are going to examine flips

More information

Exceptions and Design

Exceptions and Design Exceptions and Exceptions and Table of contents 1 Error Handling Overview Exceptions RuntimeExceptions 2 Exceptions and Overview Exceptions RuntimeExceptions Exceptions Exceptions and Overview Exceptions

More information

Connexions module: m The Smith Chart. Version 2.8: 2003/07/02 15:31: GMT-5. Bill Wilson

Connexions module: m The Smith Chart. Version 2.8: 2003/07/02 15:31: GMT-5. Bill Wilson Connexions module: m1058 1 The Smith Chart Version 2.8: 2003/07/02 15:31:59.081 GMT-5 Bill Wilson This work is produced by The Connexions Project and licensed under the Creative Commons Attribution License

More information

1 Getting started with Processing

1 Getting started with Processing cis3.5, spring 2009, lab II.1 / prof sklar. 1 Getting started with Processing Processing is a sketch programming tool designed for use by non-technical people (e.g., artists, designers, musicians). For

More information

Introduction to Scientific Computing

Introduction to Scientific Computing Introduction to Scientific Computing Dr Hanno Rein Last updated: October 12, 2018 1 Computers A computer is a machine which can perform a set of calculations. The purpose of this course is to give you

More information

y= sin( x) y= cos( x)

y= sin( x) y= cos( x) . The graphs of sin(x) and cos(x). Now I am going to define the two basic trig functions: sin(x) and cos(x). Study the diagram at the right. The circle has radius. The arm OP starts at the positive horizontal

More information

How do the shapes grow or shrink? What parts can we compare? How can we write the comparison? CPM Materials modified by Mr. Deyo

How do the shapes grow or shrink? What parts can we compare? How can we write the comparison? CPM Materials modified by Mr. Deyo Common Core Standard: 8.G.1a, 8.G.1b, 8.G.1c, 8.G.2, 8.G.4 How do the shapes grow or shrink? What parts can we compare? How can we write the comparison? CPM Materials modified by Mr. Deyo Title: IM8 Ch.

More information

Lecture 12 Integers. Computer and Network Security 19th of December Computer Science and Engineering Department

Lecture 12 Integers. Computer and Network Security 19th of December Computer Science and Engineering Department Lecture 12 Integers Computer and Network Security 19th of December 2016 Computer Science and Engineering Department CSE Dep, ACS, UPB Lecture 12, Integers 1/40 Outline Data Types Representation Conversions

More information

Transforms 1 Christian Miller CS Fall 2011

Transforms 1 Christian Miller CS Fall 2011 Transforms 1 Christian Miller CS 354 - Fall 2011 Transformations What happens if you multiply a square matrix and a vector together? You get a different vector with the same number of coordinates These

More information

Units 0 to 4 Groovy: Introduction upto Arrays Revision Guide

Units 0 to 4 Groovy: Introduction upto Arrays Revision Guide Units 0 to 4 Groovy: Introduction upto Arrays Revision Guide Second Year Edition Name: Tutorial Group: Groovy can be obtained freely by going to http://groovy-lang.org/download Page 1 of 8 Variables Variables

More information

Section 0.3 The Order of Operations

Section 0.3 The Order of Operations Section 0.3 The Contents: Evaluating an Expression Grouping Symbols OPERATIONS The Distributive Property Answers Focus Exercises Let s be reminded of those operations seen thus far in the course: Operation

More information

Describe the Orthographic and Perspective projections. How do we combine together transform matrices?

Describe the Orthographic and Perspective projections. How do we combine together transform matrices? Aims and objectives By the end of the lecture you will be able to Work with multiple transform matrices Describe the viewing process in OpenGL Design and build a camera control APIs Describe the Orthographic

More information

3.7. Vertex and tangent

3.7. Vertex and tangent 3.7. Vertex and tangent Example 1. At the right we have drawn the graph of the cubic polynomial f(x) = x 2 (3 x). Notice how the structure of the graph matches the form of the algebraic expression. The

More information

Use Parametric notation. Interpret the effect that T has on the graph as motion.

Use Parametric notation. Interpret the effect that T has on the graph as motion. Learning Objectives Parametric Functions Lesson 3: Go Speed Racer! Level: Algebra 2 Time required: 90 minutes One of the main ideas of the previous lesson is that the control variable t does not appear

More information

CS251 Spring 2014 Lecture 7

CS251 Spring 2014 Lecture 7 CS251 Spring 2014 Lecture 7 Stephanie R Taylor Feb 19, 2014 1 Moving on to 3D Today, we move on to 3D coordinates. But first, let s recap of what we did in 2D: 1. We represented a data point in 2D data

More information

: Intro Programming for Scientists and Engineers Assignment 1: Turtle Graphics

: Intro Programming for Scientists and Engineers Assignment 1: Turtle Graphics Assignment 1: Turtle Graphics Page 1 600.112: Intro Programming for Scientists and Engineers Assignment 1: Turtle Graphics Peter H. Fröhlich phf@cs.jhu.edu Joanne Selinski joanne@cs.jhu.edu Due Date: Wednesdays

More information

1

1 Zeros&asymptotes Example 1 In an early version of this activity I began with a sequence of simple examples (parabolas and cubics) working gradually up to the main idea. But now I think the best strategy

More information

Drawing a Circle. 78 Chapter 5. geometry.pyde. def setup(): size(600,600) def draw(): ellipse(200,100,20,20) Listing 5-1: Drawing a circle

Drawing a Circle. 78 Chapter 5. geometry.pyde. def setup(): size(600,600) def draw(): ellipse(200,100,20,20) Listing 5-1: Drawing a circle 5 Transforming Shapes with Geometry In the teahouse one day Nasrudin announced he was selling his house. When the other patrons asked him to describe it, he brought out a brick. It s just a collection

More information

Technical Questions. Q 1) What are the key features in C programming language?

Technical Questions. Q 1) What are the key features in C programming language? Technical Questions Q 1) What are the key features in C programming language? Portability Platform independent language. Modularity Possibility to break down large programs into small modules. Flexibility

More information

Transforming Objects in Inkscape Transform Menu. Move

Transforming Objects in Inkscape Transform Menu. Move Transforming Objects in Inkscape Transform Menu Many of the tools for transforming objects are located in the Transform menu. (You can open the menu in Object > Transform, or by clicking SHIFT+CTRL+M.)

More information

GRAPHICS PROGRAMMING. LAB #3 Starting a Simple Vector Animation

GRAPHICS PROGRAMMING. LAB #3 Starting a Simple Vector Animation GRAPHICS PROGRAMMING LAB #3 Starting a Simple Vector Animation Introduction: In previous classes we have talked about the difference between vector and bitmap images and vector and bitmap animations. In

More information

PieNum Language Reference Manual

PieNum Language Reference Manual PieNum Language Reference Manual October 2017 Hadiah Venner (hkv2001) Hana Fusman (hbf2113) Ogochukwu Nwodoh( ocn2000) Index Introduction 1. Lexical Convention 1.1. Comments 1.2. Identifiers 1.3. Keywords

More information

Animations involving numbers

Animations involving numbers 136 Chapter 8 Animations involving numbers 8.1 Model and view The examples of Chapter 6 all compute the next picture in the animation from the previous picture. This turns out to be a rather restrictive

More information

Processing Transformations. Affine Transformations

Processing Transformations. Affine Transformations Processing Transformations Affine Transformations 1 A house size(200, 200); rect(50, 75, 100, 75); // (left, top, w, h) rect(100, 110, 20, 40); // door rect(70, 110, 15, 15); //window triangle(50, 75,

More information

Chapter 1. Linear Equations and Straight Lines. 2 of 71. Copyright 2014, 2010, 2007 Pearson Education, Inc.

Chapter 1. Linear Equations and Straight Lines. 2 of 71. Copyright 2014, 2010, 2007 Pearson Education, Inc. Chapter 1 Linear Equations and Straight Lines 2 of 71 Outline 1.1 Coordinate Systems and Graphs 1.4 The Slope of a Straight Line 1.3 The Intersection Point of a Pair of Lines 1.2 Linear Inequalities 1.5

More information

Name Date Class. When the bases are the same and you multiply, you add exponents. When the bases are the same and you divide, you subtract exponents.

Name Date Class. When the bases are the same and you multiply, you add exponents. When the bases are the same and you divide, you subtract exponents. 2-1 Integer Exponents A positive exponent tells you how many times to multiply the base as a factor. A negative exponent tells you how many times to divide by the base. Any number to the 0 power is equal

More information

Modeling with Transformations

Modeling with Transformations Modeling with Transformations Prerequisites This module requires some understanding of 3D geometry, particularly a sense of how objects can be moved around in 3-space. The student should also have some

More information

2D and 3D Transformations AUI Course Denbigh Starkey

2D and 3D Transformations AUI Course Denbigh Starkey 2D and 3D Transformations AUI Course Denbigh Starkey. Introduction 2 2. 2D transformations using Cartesian coordinates 3 2. Translation 3 2.2 Rotation 4 2.3 Scaling 6 3. Introduction to homogeneous coordinates

More information

C++ Arrays and Vectors

C++ Arrays and Vectors C++ Arrays and Vectors Contents 1 Overview of Arrays and Vectors 2 2 Arrays 3 2.1 Declaring Arrays................................................. 3 2.2 Initializing Arrays................................................

More information

OUTLINES. Variable names in MATLAB. Matrices, Vectors and Scalar. Entering a vector Colon operator ( : ) Mathematical operations on vectors.

OUTLINES. Variable names in MATLAB. Matrices, Vectors and Scalar. Entering a vector Colon operator ( : ) Mathematical operations on vectors. 1 LECTURE 3 OUTLINES Variable names in MATLAB Examples Matrices, Vectors and Scalar Scalar Vectors Entering a vector Colon operator ( : ) Mathematical operations on vectors examples 2 VARIABLE NAMES IN

More information

Sets. Sets. Examples. 5 2 {2, 3, 5} 2, 3 2 {2, 3, 5} 1 /2 {2, 3, 5}

Sets. Sets. Examples. 5 2 {2, 3, 5} 2, 3 2 {2, 3, 5} 1 /2 {2, 3, 5} Sets We won t spend much time on the material from this and the next two chapters, Functions and Inverse Functions. That s because these three chapters are mostly a review of some of the math that s a

More information

2.1 Transforming Linear Functions

2.1 Transforming Linear Functions 2.1 Transforming Linear Functions Before we begin looking at transforming linear functions, let s take a moment to review how to graph linear equations using slope intercept form. This will help us because

More information

Honors Computer Science Python Mr. Clausen Program 7A, 7B

Honors Computer Science Python Mr. Clausen Program 7A, 7B Honors Computer Science Python Mr. Clausen Program 7A, 7B PROGRAM 7A Turtle Graphics Animation (100 points) Here is the overview of the program. Use functions to draw a minimum of two background scenes.

More information

CS 106 Winter 2016 Craig S. Kaplan. Module 07 Recursion and fractals Topics. Recursion as an extension of hierarchical modelling Simple fractals

CS 106 Winter 2016 Craig S. Kaplan. Module 07 Recursion and fractals Topics. Recursion as an extension of hierarchical modelling Simple fractals CS 106 Winter 2016 Craig S. Kaplan Module 07 Recursion and fractals Topics Recursion as an extension of hierarchical modelling Simple fractals Readings Learning Processing, Section 13.11 Nature of Code,

More information

Choose the file menu, and select Open. Input to be typed at the Maple prompt. Output from Maple. An important tip.

Choose the file menu, and select Open. Input to be typed at the Maple prompt. Output from Maple. An important tip. MAPLE Maple is a powerful and widely used mathematical software system designed by the Computer Science Department of the University of Waterloo. It can be used for a variety of tasks, such as solving

More information

We will start our journey into Processing with creating static images using commands available in Processing:

We will start our journey into Processing with creating static images using commands available in Processing: Processing Notes Chapter 1: Starting Out We will start our journey into Processing with creating static images using commands available in Processing: rect( ) line ( ) ellipse() triangle() NOTE: to find

More information

1 Strings (Review) CS151: Problem Solving and Programming

1 Strings (Review) CS151: Problem Solving and Programming 1 Strings (Review) Strings are a collection of characters. quotes. this is a string "this is also a string" In python, strings can be delineated by either single or double If you use one type of quote

More information

COMP3421. Week 2 - Transformations in 2D and Vector Geometry Revision

COMP3421. Week 2 - Transformations in 2D and Vector Geometry Revision COMP3421 Week 2 - Transformations in 2D and Vector Geometry Revision Exercise 1. Write code to draw (an approximation) of the surface of a circle at centre 0,0 with radius 1 using triangle fans. Transformation

More information

9/20/2017 High School Geometry Common Core G.SRT.A.1 - Dilation Properties - Teacher Notes - Patterson

9/20/2017 High School Geometry Common Core G.SRT.A.1 - Dilation Properties - Teacher Notes - Patterson HOME Organize UNIT #1 UNIT #2 UNIT #3 UNIT #4 UNIT #5 UNIT #6 Resources Assessment Notes Teaching Items Teacher Notes CONCEPT 1 The properties and characteristics of dilations. Dilation is the term that

More information

2SKILL. Variables Lesson 6. Remembering numbers (and other stuff)...

2SKILL. Variables Lesson 6. Remembering numbers (and other stuff)... Remembering numbers (and other stuff)... Let s talk about one of the most important things in any programming language. It s called a variable. Don t let the name scare you. What it does is really simple.

More information

Chapter One Modifying Your Fonts

Chapter One Modifying Your Fonts Chapter One Modifying Your Fonts Steps to Modifying Fonts Opening Fonts Changing Character Weight About Font Piracy Creating Oblique Fonts Creating Fractions Creating Ligatures Creating Condensed Characters

More information

1 Getting started with Processing

1 Getting started with Processing cisc3665, fall 2011, lab I.1 / prof sklar. 1 Getting started with Processing Processing is a sketch programming tool designed for use by non-technical people (e.g., artists, designers, musicians). For

More information

Transformation of Functions You should know the graph of the following basic functions: f(x) = x 2. f(x) = x 3

Transformation of Functions You should know the graph of the following basic functions: f(x) = x 2. f(x) = x 3 Transformation of Functions You should know the graph of the following basic functions: f(x) = x 2 f(x) = x 3 f(x) = 1 x f(x) = x f(x) = x If we know the graph of a basic function f(x), we can draw the

More information

SIMPLE INPUT and OUTPUT:

SIMPLE INPUT and OUTPUT: SIMPLE INPUT and OUTPUT: (A) Printing to the screen. The disp( ) command. If you want to print out the values of a variable to the screen, you simply can type the variable at the command line. > x = 5

More information

SFU CMPT 361 Computer Graphics Fall 2017 Assignment 2. Assignment due Thursday, October 19, 11:59pm

SFU CMPT 361 Computer Graphics Fall 2017 Assignment 2. Assignment due Thursday, October 19, 11:59pm SFU CMPT 361 Computer Graphics Fall 2017 Assignment 2 Assignment due Thursday, October 19, 11:59pm For this assignment, you are to interpret a 3D graphics specification language, along with doing some

More information

Text Input and Conditionals

Text Input and Conditionals Text Input and Conditionals Text Input Many programs allow the user to enter information, like a username and password. Python makes taking input from the user seamless with a single line of code: input()

More information

Computer Graphics Hands-on

Computer Graphics Hands-on Computer Graphics Hands-on Two-Dimensional OpenGL Transformations Objectives To get hands-on experience manipulating the OpenGL current transformation (MODELVIEW) matrix to achieve desired effects To gain

More information

Designed by Jason Wagner, Course Web Programmer, Office of e-learning NOTE ABOUT CELL REFERENCES IN THIS DOCUMENT... 1

Designed by Jason Wagner, Course Web Programmer, Office of e-learning NOTE ABOUT CELL REFERENCES IN THIS DOCUMENT... 1 Excel Essentials Designed by Jason Wagner, Course Web Programmer, Office of e-learning NOTE ABOUT CELL REFERENCES IN THIS DOCUMENT... 1 FREQUENTLY USED KEYBOARD SHORTCUTS... 1 FORMATTING CELLS WITH PRESET

More information

OUTLINE. Hierarchical Models Z-Fighting Primitives Besides Triangles Back Face Culling

OUTLINE. Hierarchical Models Z-Fighting Primitives Besides Triangles Back Face Culling MATRIX STACKS OUTLINE Hierarchical Models Z-Fighting Primitives Besides Triangles Back Face Culling HIERARCHICAL MODELS Building scenes where objects move in relation to each other rather than independently

More information

Computer Graphics Prof. Sukhendu Das Dept. of Computer Science and Engineering Indian Institute of Technology, Madras Lecture - 14

Computer Graphics Prof. Sukhendu Das Dept. of Computer Science and Engineering Indian Institute of Technology, Madras Lecture - 14 Computer Graphics Prof. Sukhendu Das Dept. of Computer Science and Engineering Indian Institute of Technology, Madras Lecture - 14 Scan Converting Lines, Circles and Ellipses Hello everybody, welcome again

More information

Set the current projection to perspective with the given field of view angle (degrees)

Set the current projection to perspective with the given field of view angle (degrees) glman glman is a Windows program to allow a better view into OpenGL shaders. glman is started with: Start All Programs Shaders glman.exe The resulting user interface window looks like this. At the same

More information

Expressions and Casting. Data Manipulation. Simple Program 11/5/2013

Expressions and Casting. Data Manipulation. Simple Program 11/5/2013 Expressions and Casting C# Programming Rob Miles Data Manipulation We know that programs use data storage (variables) to hold values and statements to process the data The statements are obeyed in sequence

More information

Operator overloading

Operator overloading 1 Introduction 2 The copy constructor 3 Operator Overloading 4 Eg 1: Adding two vectors 5 The -> operator 6 The this pointer 7 Overloading = 8 Unary operators 9 Overloading for the matrix class 10 The

More information

Intro to Programming. Unit 7. What is Programming? What is Programming? Intro to Programming

Intro to Programming. Unit 7. What is Programming? What is Programming? Intro to Programming Intro to Programming Unit 7 Intro to Programming 1 What is Programming? 1. Programming Languages 2. Markup vs. Programming 1. Introduction 2. Print Statement 3. Strings 4. Types and Values 5. Math Externals

More information

This blog addresses the question: how do we determine the intersection of two circles in the Cartesian plane?

This blog addresses the question: how do we determine the intersection of two circles in the Cartesian plane? Intersecting Circles This blog addresses the question: how do we determine the intersection of two circles in the Cartesian plane? This is a problem that a programmer might have to solve, for example,

More information

HIERARCHICAL TRANSFORMATIONS A Practical Introduction

HIERARCHICAL TRANSFORMATIONS A Practical Introduction HIERARCHICAL TRANSFORMATIONS A Practical Introduction Christopher Peters HPCViz, KTH Royal Institute of Technology, Sweden chpeters@kth.se https://www.kth.se/profile/chpeters/ Transformations Many objects

More information

Lesson 6: Manipulating Equations

Lesson 6: Manipulating Equations Lesson 6: Manipulating Equations Manipulating equations is probably one of the most important skills to master in a high school physics course. Although it is based on familiar (and fairly simple) math

More information

Learning Task: Exploring Reflections and Rotations

Learning Task: Exploring Reflections and Rotations Learning Task: Exploring Reflections and Rotations Name Date Mathematical Goals Develop and demonstrate an understanding of reflections and rotations of figures in general and on a coordinate plane. Essential

More information

Expressions and Casting

Expressions and Casting Expressions and Casting C# Programming Rob Miles Data Manipulation We know that programs use data storage (variables) to hold values and statements to process the data The statements are obeyed in sequence

More information

Introduction IN THIS ARTICLE ACKNOWLEDGEMENTS. PICAXE Calculator. Author: Jeremy Leach June 2006

Introduction IN THIS ARTICLE ACKNOWLEDGEMENTS. PICAXE Calculator. Author: Jeremy Leach   June 2006 Author: Jeremy Leach Email: ukc802139700@btconnect.com June 2006 Introduction The PICAXE Calculator is an experimental floating-point calculator implemented in code. It is only suitable for PICAXE 18x

More information

COMP3421. Week 2 - Transformations in 2D and Vector Geometry Revision

COMP3421. Week 2 - Transformations in 2D and Vector Geometry Revision COMP3421 Week 2 - Transformations in 2D and Vector Geometry Revision Exercise 1. Write code to draw (an approximation) of the surface of a circle at centre 0,0 with radius 1 using triangle fans. 2. At

More information

The Very Basics of the R Interpreter

The Very Basics of the R Interpreter Chapter 2 The Very Basics of the R Interpreter OK, the computer is fired up. We have R installed. It is time to get started. 1. Start R by double-clicking on the R desktop icon. 2. Alternatively, open

More information

Programming and Data Structures in C Instruction for students

Programming and Data Structures in C Instruction for students Programming and Data Structures in C Instruction for students Adam Piotrowski Dariusz Makowski Wojciech Sankowski 11 kwietnia 2016 General rules When writing programs please note that: Program must be

More information

CS1150 Principles of Computer Science Methods

CS1150 Principles of Computer Science Methods CS1150 Principles of Computer Science Methods Yanyan Zhuang Department of Computer Science http://www.cs.uccs.edu/~yzhuang CS1150 UC. Colorado Springs Opening Problem Find the sum of integers from 1 to

More information

CS559 Computer Graphics Fall 2015

CS559 Computer Graphics Fall 2015 CS559 Computer Graphics Fall 2015 Midterm Exam Thursday October 27th 2015 Time: 2 hrs Name University ID Part #1 Part #2 Part #3 Part #4 Part #5 Part #6 TOTAL 1 1. [5 4% = 20%] MULTIPLE CHOICE SECTION.

More information

Introduction to Transformations. In Geometry

Introduction to Transformations. In Geometry + Introduction to Transformations In Geometry + What is a transformation? A transformation is a copy of a geometric figure, where the copy holds certain properties. Example: copy/paste a picture on your

More information

DRAWING VECTOR VS PIXEL SHAPES IN PHOTOSHOP CS6

DRAWING VECTOR VS PIXEL SHAPES IN PHOTOSHOP CS6 DRAWING VECTOR VS PIXEL SHAPES IN PHOTOSHOP CS6 In this first tutorial in our series on drawing and working with shapes in Photoshop CS6, we ll take a quick look at the important difference between the

More information

CSC148H Week 3. Sadia Sharmin. May 24, /20

CSC148H Week 3. Sadia Sharmin. May 24, /20 CSC148H Week 3 Sadia Sharmin May 24, 2017 1/20 Client vs. Developer I For the first couple of weeks, we have played the role of class designer I However, you are also often in the opposite role: when a

More information

CS 559 Computer Graphics Midterm Exam March 22, :30-3:45 pm

CS 559 Computer Graphics Midterm Exam March 22, :30-3:45 pm CS 559 Computer Graphics Midterm Exam March 22, 2010 2:30-3:45 pm This exam is closed book and closed notes. Please write your name and CS login on every page! (we may unstaple the exams for grading) Please

More information

Name: Tutor s

Name: Tutor s Name: Tutor s Email: Bring a couple, just in case! Necessary Equipment: Black Pen Pencil Rubber Pencil Sharpener Scientific Calculator Ruler Protractor (Pair of) Compasses 018 AQA Exam Dates Paper 1 4

More information

4. Java Project Design, Input Methods

4. Java Project Design, Input Methods 4-1 4. Java Project Design, Input Methods Review and Preview You should now be fairly comfortable with creating, compiling and running simple Java projects. In this class, we continue learning new Java

More information

Matrices. Chapter Matrix A Mathematical Definition Matrix Dimensions and Notation

Matrices. Chapter Matrix A Mathematical Definition Matrix Dimensions and Notation Chapter 7 Introduction to Matrices This chapter introduces the theory and application of matrices. It is divided into two main sections. Section 7.1 discusses some of the basic properties and operations

More information

Lab 1 Introduction to MATLAB and Scripts

Lab 1 Introduction to MATLAB and Scripts Lab 1 Introduction to MATLAB and Scripts EE 235: Continuous-Time Linear Systems Department of Electrical Engineering University of Washington The development of these labs was originally supported by the

More information

Mathematics 308 Geometry. Chapter 9. Drawing three dimensional objects

Mathematics 308 Geometry. Chapter 9. Drawing three dimensional objects Mathematics 308 Geometry Chapter 9. Drawing three dimensional objects In this chapter we will see how to draw three dimensional objects with PostScript. The task will be made easier by a package of routines

More information

In this translation, CDE is being translated to the right by the same length as segment AB. What do you think is true about CDE and C'D'E'?

In this translation, CDE is being translated to the right by the same length as segment AB. What do you think is true about CDE and C'D'E'? A translation is nothing more than a geometric transformation that slides each point in a figure the same distance in the same direction In this translation, CDE is being translated to the right by the

More information

Dynamics and Vibrations Mupad tutorial

Dynamics and Vibrations Mupad tutorial Dynamics and Vibrations Mupad tutorial School of Engineering Brown University ENGN40 will be using Matlab Live Scripts instead of Mupad. You can find information about Live Scripts in the ENGN40 MATLAB

More information

DCS/100 Procedural Programming

DCS/100 Procedural Programming DCS/100 Procedural Programming Week 9: References, the Heap and the Stack Last Week: Learning Outcomes From last week you should be able to: write programs that are split into methods write programs that

More information

Lesson #3. Variables, Operators, and Expressions. 3. Variables, Operators and Expressions - Copyright Denis Hamelin - Ryerson University

Lesson #3. Variables, Operators, and Expressions. 3. Variables, Operators and Expressions - Copyright Denis Hamelin - Ryerson University Lesson #3 Variables, Operators, and Expressions Variables We already know the three main types of variables in C: int, char, and double. There is also the float type which is similar to double with only

More information

Computer Vision. Matlab

Computer Vision. Matlab Computer Vision Matlab A good choice for vision program development because Easy to do very rapid prototyping Quick to learn, and good documentation A good library of image processing functions Excellent

More information

Review Sheet for Midterm #1 COMPSCI 119 Professor William T. Verts

Review Sheet for Midterm #1 COMPSCI 119 Professor William T. Verts Review Sheet for Midterm #1 COMPSCI 119 Professor William T. Verts Simple Data Types There are a number of data types that are considered primitive in that they contain only a single value. These data

More information

Memory and Pointers written by Cathy Saxton

Memory and Pointers written by Cathy Saxton Memory and Pointers written by Cathy Saxton Basic Memory Layout When a program is running, there are three main chunks of memory that it is using: A program code area where the program itself is loaded.

More information

Administration. Objects and Arrays. Objects. Agenda. What is an Object? What is a Class?

Administration. Objects and Arrays. Objects. Agenda. What is an Object? What is a Class? Administration Objects and Arrays CS 99 Summer 2000 Michael Clarkson Lecture 6 Read clarified grading policies Lab 6 due tomorrow Submit.java files in a folder named Lab6 Lab 7 Posted today Upson Lab closed

More information

CS/ENGRD 2110 FALL Lecture 7: Interfaces and Abstract Classes

CS/ENGRD 2110 FALL Lecture 7: Interfaces and Abstract Classes CS/ENGRD 2110 FALL 2017 Lecture 7: Interfaces and Abstract Classes http://courses.cs.cornell.edu/cs2110 1 Announcements 2 A2 is due tomorrow night (17 February) Get started on A3 a method every other day.

More information

Mirage. Language Reference Manual. Image drawn using Mirage 1.1. Columbia University COMS W4115 Programming Languages and Translators Fall 2006

Mirage. Language Reference Manual. Image drawn using Mirage 1.1. Columbia University COMS W4115 Programming Languages and Translators Fall 2006 Mirage Language Reference Manual Image drawn using Mirage 1.1 Columbia University COMS W4115 Programming Languages and Translators Fall 2006 Prof. Stephen Edwards Team Members: Abhilash I ai2160@columbia.edu

More information

Quadrilaterals & Transformations Study Guide

Quadrilaterals & Transformations Study Guide s & Transformations Study Guide What do I need to know for the upcoming Summative Assessment? s Classifications and Properties of: o o Trapezoid o Kite o Parallelogram o Rhombus o Rectangle o Square The

More information

Lecture Numbers. Richard E Sarkis CSC 161: The Art of Programming

Lecture Numbers. Richard E Sarkis CSC 161: The Art of Programming Lecture Numbers Richard E Sarkis CSC 161: The Art of Programming Class Administrivia Agenda To understand the concept of data types To be familiar with the basic numeric data types in Python To be able

More information

Grade 6 Math Circles. Spatial and Visual Thinking

Grade 6 Math Circles. Spatial and Visual Thinking Faculty of Mathematics Waterloo, Ontario N2L 3G1 Introduction Grade 6 Math Circles October 31/November 1, 2017 Spatial and Visual Thinking Centre for Education in Mathematics and Computing One very important

More information

Maciej Sobieraj. Lecture 1

Maciej Sobieraj. Lecture 1 Maciej Sobieraj Lecture 1 Outline 1. Introduction to computer programming 2. Advanced flow control and data aggregates Your first program First we need to define our expectations for the program. They

More information

UNIT 2 2D TRANSFORMATIONS

UNIT 2 2D TRANSFORMATIONS UNIT 2 2D TRANSFORMATIONS Introduction With the procedures for displaying output primitives and their attributes, we can create variety of pictures and graphs. In many applications, there is also a need

More information

CSE 142 Su 04 Computer Programming 1 - Java. Objects

CSE 142 Su 04 Computer Programming 1 - Java. Objects Objects Objects have state and behavior. State is maintained in instance variables which live as long as the object does. Behavior is implemented in methods, which can be called by other objects to request

More information

Logical operators: R provides an extensive list of logical operators. These include

Logical operators: R provides an extensive list of logical operators. These include meat.r: Explanation of code Goals of code: Analyzing a subset of data Creating data frames with specified X values Calculating confidence and prediction intervals Lists and matrices Only printing a few

More information

Slither.io-bot Documentation

Slither.io-bot Documentation Slither.io-bot Documentation Release 0.9.0 FliiFe Nov 19, 2017 Contents 1 1. Game variables 3 1.1 1.1 Scale variables............................................ 3 1.2 1.2 State variables............................................

More information

Pace University. Fundamental Concepts of CS121 1

Pace University. Fundamental Concepts of CS121 1 Pace University Fundamental Concepts of CS121 1 Dr. Lixin Tao http://csis.pace.edu/~lixin Computer Science Department Pace University October 12, 2005 This document complements my tutorial Introduction

More information

Computer Graphics - Treasure Hunter

Computer Graphics - Treasure Hunter Computer Graphics - Treasure Hunter CS 4830 Dr. Mihail September 16, 2015 1 Introduction In this assignment you will implement an old technique to simulate 3D scenes called billboarding, sometimes referred

More information

General Syntax. Operators. Variables. Arithmetic. Comparison. Assignment. Boolean. Types. Syntax int i; float j = 1.35; int k = (int) j;

General Syntax. Operators. Variables. Arithmetic. Comparison. Assignment. Boolean. Types. Syntax int i; float j = 1.35; int k = (int) j; General Syntax Statements are the basic building block of any C program. They can assign a value to a variable, or make a comparison, or make a function call. They must be terminated by a semicolon. Every

More information

Using Methods. Writing your own methods. Dr. Siobhán Drohan Mairead Meagher. Produced by: Department of Computing and Mathematics

Using Methods. Writing your own methods. Dr. Siobhán Drohan Mairead Meagher. Produced by: Department of Computing and Mathematics Using Methods Writing your own methods Produced by: Dr. Siobhán Drohan Mairead Meagher Department of Computing and Mathematics http://www.wit.ie/ Topics list Recap of method terminology: Return type Method

More information