Code Elements and Processing Coordinate System. Code elements: pages 17-21 Comments: are documentation notes that are ignored by the computer but are.

Slides:



Advertisements
Similar presentations
C Functions. What are they? In general, functions are blocks of code that perform a number of pre-defined commands to accomplish something productive.
Advertisements

Lesson One: The Beginning
 Functions breakdown: Functions purpose Modularity Declaring and defining a function Calling a function Parameter passing Returning a value Reusability.
VARIABLES AND DEBUGGING Beginning Programming. Assignment Statements  Used to hold values in a variable  Calculates a result and stores it in a variable.
Introduction to Programming
Game with US Beginner Tutorial. Welcome!! Who I am What is Processing? Basic Coding Input Methods Images Classes Arrays.
Variables and Operators
Emerging Platform#5: Processing 2 B. Ramamurthy 6/13/2014B. Ramamurthy, CS6511.
Chapter 2 Programming by Example. A Holistic Perspective Three sections separated by blank lines. Program comment File: FileName.java
Chapter 3 Syntax, Errors, and Debugging
Translate, Rotate, Matrix Pages Function Function Definition Calling a function Parameters Return type and return statement.
Image Maps and Graphics Internet Basics and Far Beyond! Mrs. Wilson.
IAT 800 Foundations of Computational Art and Design Lecture 2.
IAT 800 Lab 1: Loops, Animation, and Simple User Interaction.
Chapter 2 storing numbers and creating objects Pages in Horstmann.
School of Computing Science CMT1000 Ed Currie © Middlesex University Lecture 4: 1 CMT1000: Introduction to Programming Ed Currie Lecture 5a: Input and.
1 Data types, operations, and expressions Overview l Format of a Java Application l Primitive Data Types l Variable Declaration l Arithmetic Operations.
Lesson Three: Organization
Computing Theory: BBC Basic Coding Year 11. Lesson Objective You will: Be able to define what BBC basic is Be able to annotate BBC basic code Be able.
PROCESSING. * Java SDK * downloads/jdk7-downloads html
Java Programming, 2E Introductory Concepts and Techniques Chapter 2 Creating a Java Application and Applet.
Java: Chapter 1 Computer Systems Computer Programming II.
Coding: Games, Apps and the Arts Unit 0: Processing Basics 1.
1 k Jarek Rossignac,  2008 Processing  Install Processing  Learn how to edit, run, save, export, post programs  Understand.
Continuous February 16, Test Review What expression represents the zip car eligibility rules of at least 18 years old and no incidents?
Keyboard and Events. What about the keyboard? Keyboard inputs can be used in many ways---not just for text The boolean variable keyPressed is true if.
Chapter 3 Syntax, Errors, and Debugging Fundamentals of Java.
Variables and Arithmetic. From last class More drawing functions: strokeWeight(n); // higher the n value broader the stroke fill(k) ; // single parameter.
Abstraction IS 101Y/CMSC 101 Computational Thinking and Design Tuesday, September 9, 2014 Carolyn Seaman Susan Martin University of Maryland, Baltimore.
Programming for Artists ART 315 Dr. J. R. Parker Art/Digital Media Lab Lec 10 Fall 2010.
Functions. Functions are named blocks of code. Functions allow complex programs to be broken down into smaller, simpler tasks. Functions allow commonly.
Loops & Graphics IP 10 Mr. Mellesmoen Recall Earlier we wrote a program listing numbers from 1 – 24 i=1 start: TextWindow.WriteLine(i) i=i+1 If.
1 Georgia Tech, IIC, GVU, 2006 MAGIC Lab Rossignac Lecture 02b: Tutorial for Programming in Processing Jarek Rossignac.
B. RAMAMURTHY Simulating Motion and Implementing Animation.
2-D Shapes, Color, and simple animation. 7 Basic Shapes Ellipse :: ellipse() Arc :: arc() Line :: line() Point :: point() Rectangle :: rect() Triangle.
Chapter 3 Syntax, Errors, and Debugging Fundamentals of Java.
Arrays. An array is a collection “The Dinner offers an array of choices.” In computer programming, an array is a collection of variables of the same data.
Surface Area of Pyramids and Cones Pyramid Cones Has a square base and comes to a point Has a circle base and comes to a point.
CSC 1010 Programming for All Lecture 7 Input, Output & Graphics.
Often being different. Control flow By default Java (and therefore Processing) executes lines of a program one after the other –Doesn’t matter what happened.
LCC 6310 Computation as an Expressive Medium Lecture 2.
Words. Characters and Strings Character –A single character inside of single quotes char letter = 'A' ; char digit = '0' ; – Strings Zero or more character.
Creating a Java Application and Applet
Computer Science I 3D Classwork / Homework: plan and implement your own 3D example.
Continuous. Flow of Control Programs can broadly be classified as being –Procedural Programs are executed once in the order specified by the code varied.
Graphics Primitives in Processing 1/14/2010. size(x, y) ; Sets the initial size of the screen Units are in pixels –Pixel == picture element –Small dots.
B. RAMAMURTHY Processing and Programming cse
Review Expressions and operators Iteration – while-loop – for-loop.
Test Review. General Info. All tests will be comprehensive. You will be tested more on your understanding of code as opposed to your ability to write.
1 SIC / CoC / Georgia Tech MAGIC Lab Rossignac Processing  Install Processing  Learn how to edit, run, save, export,
Element of Design Form Shape Line Color Value Texture Space.
PROCESSING A computer screen is a grid of small light elements called pixels.
Functions. 2 Modularity What is a function? A named block of code Sometimes called a ‘module’, ‘method’ or a ‘procedure’ Some examples that you know are:
Chapter 02 Data and Expressions.
Some of Chap 17.
Chapter 3 Syntax, Errors, and Debugging
Example: Card Game Create a class called “Card”
Computation as an Expressive Medium
Java Programming with BlueJ
Code Elements and Processing Coordinate System
Exam1 Review CSE113 B.Ramamurthy 11/29/2018 B.Ramamurthy.
Pixels.
Chapter 5, Conditionals Brief Notes
Variables and Arithmetic
Code Elements and Processing Coordinate System
Exam1 Review CSE113 B.Ramamurthy 4/17/2019 B.Ramamurthy.
IAT 800 Foundations of Computational Art and Design
LCC 6310 Computation as an Expressive Medium
Using Modules.
Presentation transcript:

Code Elements and Processing Coordinate System

Code elements: pages Comments: are documentation notes that are ignored by the computer but are important for people (to understand the code). // single line comment /* multi line comment */ Semi-colon (“;” ) is a terminator Example: size (600, 600);

Functions Functions are pre-defined operations You can define the functions or use the functions already defined and available in libraries/packages Functions promote modular design Example: size(500,500); background(102); Function call parameters

Expressions Expression are means for expressing a computation or logic Example: value is > 90 value is false

Variables and types Variables represent items in the problem to be solved Variables have (i) type (ii) name by which they are referenced in the code Example: int age; float wage; char initial; We will discuss variables in more detail later.

Console and Printing Messages Processing has two instructions for printing out on console: print(…) and println(..) These can be used to display data when a Processing code is running Good instructions for understanding your code and trace what is happening with the code. Good “debugging” tool. Example: (see p.21) int x = 20; println(x); int x2 = 20; int y2 = 30; println(x2 + “ “ + y2); println(“I am learning Problem solving using Processing”);

Coordinates and Primitives Before you “draw” you need to think about dimensions and qualities of the surface on which you’ll be drawing. Computer monitor have surfaces that are defined by “pixels” or a “picture element” When the definition of the screen of your laptop is 1280 X 1024 that means you have 1,310,720 little pixels to display your content on the screen In processing when you say “size (200, 100)” we have width of 200 pixels and height of 100 pixels

Processing Coordinate System (10X10) X  0,0 Y  10,10

Primitive Shapes point(x,y) Example: point(2, 67); line(x1,y1, x2, y2) Example: line(23,45, 56,90); triangle(x1,y1,x2,y2,x3,y3); Example: triangle(60,10,25,60,75,65);

More Primitive Shapes quad(20,20,20,70,60,90,60,40); quad(20,20,70,-20,110,0,60,40); Quad is specified using points Rect function uses starting point and lengths rect(x, y, width, height); ellispe(x,y,width,height); // is used for drawing circle

Complete example Lets draw a desktop computer. rect(0, 0, 90, 50); rect(5, 50, 75,4); rect(24, 54, 6,6); rect(64,54, 6, 6); rect(20, 60, 75, 10); rect(10, 70, 80, 2);

Drawing attributes fill(r,g,b); Before you draw will fill the object you draw with the fill color. smooth(); noSmooth(); strokeWidth(6); noStroke(); Lets try these commands on Processing