Some Cool Tricks.  We can consider the screen as high school graph paper.  Each sprite or object is located somewhere in the coordinate system.

Slides:



Advertisements
Similar presentations
Our Friend the Dot Product
Advertisements

Affine Transformations
Announcements. Structure-from-Motion Determining the 3-D structure of the world, and/or the motion of a camera using a sequence of images taken by a moving.
This terms course Last term we both worked on learning 2 things –Processing –The concepts of graphics etc. This term will focus more on the basic concepts.
Transformations We want to be able to make changes to the image larger/smaller rotate move This can be efficiently achieved through mathematical operations.
INNER WORKINGS OF UNITY 3D. WHAT WE ARE GOING TO COVER Intro to Unity Physics & Game Objects Cameras & Lighting Textures & Materials Quaternions and Rotation.
Maths for Computer Graphics
Chapter 4.1 Mathematical Concepts
Chapter 4.1 Mathematical Concepts. 2 Applied Trigonometry Trigonometric functions Defined using right triangle  x y h.
Now Playing: My Mathematical Mind Spoon From Gimme Fiction Released May 10, 2005.
Outline for Today More math… Finish linear algebra: Matrix composition
CSCE 590E Spring 2007 Basic Math By Jijun Tang. Applied Trigonometry Trigonometric functions  Defined using right triangle  x y h.
Course Website: Computer Graphics 3: 2D Transformations.
Review of basic mathematics: Vectors & Matrices Differential equations Rende Steerenberg (BE/OP) 16 January 2012 Rende Steerenberg (BE/OP) 16 January 2012.
CAP4730: Computational Structures in Computer Graphics
3D Graphics Goal: To produce 2D images of a mathematically described 3D environment Issues: –Describing the environment: Modeling (mostly later) –Computing.
2D Transformations. World Coordinates Translate Rotate Scale Viewport Transforms Hierarchical Model Transforms Putting it all together.
Montwood High School Physics R. Casao
Geometric Intuition Randy Gaul. Vectors, Points and Basis Matrices Rotation Matrices Dot product and how it’s useful Cross product and how it’s useful.
Mathematical Fundamentals
Lecture VII Rigid Body Dynamics CS274: Computer Animation and Simulation.
CS 325 Introduction to Computer Graphics 03 / 03 / 2010 Instructor: Michael Eckmann.
Game Physics – Part IV Moving to 3D
Chapter 4.1 Mathematical Concepts
COMP 175: Computer Graphics March 24, 2015
February 14,  Relations: in mathematics, we refer to a group of points as a “relation” Examples: { (2, -3); (2, 5); (5,1) }
Lecture Notes: Computer Graphics.
Computer Graphics World, View and Projection Matrices CO2409 Computer Graphics Week 8.
Dx = 2 dy = 3 Y X D Translation A translation is applied to an object by repositioning it along a straight-line path.
CO1301: Games Concepts Dr Nick Mitchell (Room CM 226) Material originally prepared by Gareth Bellaby.
Mathematics for Graphics. 1 Objectives Introduce the elements of geometry  Scalars  Vectors  Points Develop mathematical operations among them in a.
Week 5 - Wednesday.  What did we talk about last time?  Project 2  Normal transforms  Euler angles  Quaternions.
1 CO Games Concepts Week 20 Matrices continued Gareth Bellaby.
Math / Physics 101 GAM 376 Robin Burke Fall 2006.
CO1301: Games Concepts Dr Nick Mitchell (Room CM 226) Material originally prepared by Gareth Bellaby.
Scalar Quantities Scalar quantities are measurements that have only magnitude (size) but no direction. Examples of scalar quantities are; Distance Speed.
Graphics Matrices. Today’s Lecture Brought to you by the integer 6 and letter ‘K’; 2D and 3D points Matrices Rotations Translation Putting it all together.
CO1301: Games Concepts Dr Nick Mitchell (Room CM 226) Material originally prepared by Gareth Bellaby.
CGDD 4003 THE MATH LECTURE (BOILED DOWN, YET LIGHTLY SALTED)
SEM Basics 2 Byrne Chapter 2 Kline pg 7-15, 50-51, ,
Lecture 5: Introduction to 3D
AP Physics C – Vectors. 1.1 Vectors. Vectors are mathematical quantities indicated by arrows. The length of the arrow denotes the magnitude or the size.
Computer Graphics Matrices
CSCE 552 Fall 2012 Math By Jijun Tang. Applied Trigonometry Trigonometric functions  Defined using right triangle  x y h.
Honors Geometry.  We learned how to set up a polygon / vertex matrix  We learned how to add matrices  We learned how to multiply matrices.
Introduction to Game Programming & Design III Lecture III.
Copyright  1999 by James H. Money. All rights reserved. Except as permitted under United States Copyright Act of 1976, no part of this publication may.
Systems of Equations and Matrices Review of Matrix Properties Mitchell.
Geometric Transformations Ceng 477 Introduction to Computer Graphics Computer Engineering METU.
Chapter 4.1 Mathematical Concepts. 2 Applied Trigonometry "Old Henry And His Old Aunt" Defined using right triangle  x y h.
Circles March 18th A ___________ is the set of all point that are a fixed distance, called the _________ from a fixed point, called the _________.
Computer Graphics 2D Transformations
Computer Graphics 3: 2D Transformations
Computer Graphics 3: 2D Transformations
Kinematics Introduction to Motion
Intro & Point-to-Box, Circle-to-Circle, Point-to-Circle
4.1 Vectors in Physics Objective: Students will know how to resolve 2-Dimensional Vectors from the Magnitude and Direction of a Vector into their Components/Parts.
Curl and Divergence.
FP1 Matrices Transformations
OOP Paradigms There are four main aspects of Object-Orientated Programming Inheritance Polymorphism Abstraction Encapsulation We’ve seen Encapsulation.
CSC4820/6820 Computer Graphics Algorithms Ying Zhu Georgia State University Transformations.
GAM 325/425: Applied 3D Geometry
Kinematics in Two Dimensions
(c) University of Wisconsin, CS559
D2 Indices and matrices Matrix representation in computer systems:
Collision Detection.
Rotation and Translation
CO Games Concepts Week 12 Collision Detection
Game Programming Algorithms and Techniques
Robotics 1 Copyright Martin P. Aalund, Ph.D.
Presentation transcript:

Some Cool Tricks

 We can consider the screen as high school graph paper.  Each sprite or object is located somewhere in the coordinate system.

 Remember our screen is not like the school mathematical graph paper! The origin is at the top-left!  That means the bottom of our object is at a higher y position than the top!

 Moving things around is called translation.  Usually we translate our object to the origin before we perform rotation and scaling.

 Move every point in one object to another location.

 For rotation, lets visit the Siggraph web page: accessed August

 We use Pythagoras to find the distance between two points.

 Using (x, y) positions is common.  However, you may use (r, Θ)  r = distance from origin  Θ = angle.  Converting between the two systems is easy.  Just remember the name!

 Beware, we need a little bit more sophistication to calculate the angle… as this gives us ambiguity.

 We can use circle to circle collision as an example.  We find the centre of each circle and use Pythagoras to discover the distance between the two.  The equations to the right tell us when there has been a collicsion! We can possibly do this with square distances to avoid using expensive sqrt operations. We must be careful to avoid interpenetration as the entities will indefinite collide with each other.

 Interpenetration of objects.  Interlocking of objects.  Quantum Tunnelling Effects.

 Once again in scaling we need to translate our object’s origin to the origin of the world, we then perform the scaling operation.  Remember to translate back!

 We use logic all the time in coding.  We will use logic for our AI and decision making in games.  We will explicitly cover some rudimentary logic.

 And  Or  Not  Xor  Implies  Tautologies—Saying the same thing more than once.  Associative Laws—Order does not matter.  Distributive Laws—We can say things in different ways that mean the same thing.  Identity Laws

 Sets can be used to make decisions.  Sets indicate belongingness.

 Venn Diagrams  Union  Intersection  Difference.  Sets  Subsets  Compliment  Universal Set  Identity Laws

 What is in A, B and C?  What is in A?  What is in not A?  Useful for games.  Useful for determining strategies.

 Yes!  std::set!  How awesome is that?

 Vectors and matrices are mathematically convenient tools.  They are used in games for graphical mathematics.  So annoying that std::vector is named in such a way to make things a little confusing.

I like to call this Quantum Tunnelling. We miss the detection of a collision as the bullet passes through the wall.

Bounding box collision detection in 2D.

 Tricks  One’s Compliment

 The distance between two points can be calculated using Pythagoras.  This can be used for simple collision detection.  Movie, E13Y, accessed August E13Y

 OvVep2uSg, accessed August OvVep2uSg

 Analytical Geometry is concerned with points and the relationships between points.  We can find angles between two points to determine interesting relationships.

 Useful for determining:  (a) If a collision would take place.  (b) If a collision has taken place.

 Let’s look at the diagrams!  geometry/perpendicular-distance-point- line.php, accessed August geometry/perpendicular-distance-point- line.php

 Vectors can represent acceleration, velocity and displacement and any sort of force, which is essential to any physics orientated game.  It allows for you to calculate paths, trajectories and many aspects of physics within code.

 A vector is a point.  For two dimensional mathematics:  (x, y).  These vectors have interesting operations.  They make it easier to do mathematics.

 We can simply calculate the resulting vector when combining multiple forces…

 A matrix is a column by row matrix of values.  The matrix has defined operations so we can perform mathematical operations efficiently on a collection of points.

 Read the wikipage on 2D Graphics.  This will help you understand more about your programming project. 