SlideShare a Scribd company logo
1 of 16
Download to read offline
Video Game Development: VectorsA. Babadi 1 of 16
In The Name Of God
Video Game Development
Amin Babadi
Department of Electrical and Computer Engineering
Isfahan University of Technology
Spring 2015
Vectors
Video Game Development: VectorsA. Babadi 2 of 16
Outline
 What is a game engine?
 Vector definition
 The dot product
 Vector projection
 The cross product
Video Game Development: VectorsA. Babadi 3 of 16
Game Engine
 A game engine is a software designed for the creation and
development of video games.
 The core functionality typically provided by a game engine
includes:
o A rendering engine,
o A physics engine,
o Scripting support,
o Multi-threading support,
o Animation support,
o Etc.
 More about game engines comes in next lectures.
Video Game Development: VectorsA. Babadi 4 of 16
Game Engine
 Examples of well-known game engines:
o CryEngine,
o Unreal Engine,
o Gamebyro,
o Unity,
o Wintermute Engine,
o XNA Game Studio,
o Game Maker.
Video Game Development: VectorsA. Babadi 5 of 16
Vectors
 Vectors are of fundamental importance in any game engine.
 They mainly are used for representing points in space and
spatial directions.
o But for now, we make no distinction between vectors representing
points and vectors representing directions, nor do we concern
ourselves with how vectors are transformed from one coordinate
system to another.
Video Game Development: VectorsA. Babadi 6 of 16
Vector Properties
 We usually restrict ourselves to vectors defined by n-tuples of
real numbers, where n is typically 2, 3, or 4.
𝑉 = 𝑣1, 𝑣2, … , 𝑣 𝑛
 The numbers 𝑣𝑖 are called the components of the vector 𝑉.
 𝑉 may also be represented by a 𝑛 × 1 matrix:
𝑉 =
𝑣1
𝑣2
:
𝑣 𝑛
= 𝑣1 𝑣2 … 𝑣 𝑛
𝑇
 The components can usually be labeled with the name of the
axis to which they correspond.
𝑃 = 𝑝 𝑥, 𝑝 𝑦, 𝑝 𝑧
Video Game Development: VectorsA. Babadi 7 of 16
Vector Properties
𝛼𝑉 = 𝑉𝛼 = 𝛼𝑣1, 𝛼𝑣2, … , 𝛼𝑣 𝑛
𝑃 + 𝑄 = 𝑝1 + 𝑞1, 𝑝2 + 𝑞2, … , 𝑝 𝑛 + 𝑞 𝑛
𝑉 = 𝑣𝑖
2
𝑛
𝑖=1
 If 𝑉 = 1, 𝑉 is called a unit vector. If 𝑉 > 0, 𝑉 can be
converted to a unit vector. This operation is called
normalization.
𝑉′ =
1
𝑉
𝑉
Video Game Development: VectorsA. Babadi 8 of 16
The Dot Product
 The dot product of two vectors supplies a measure of the
similarity (or difference) between the directions in which the
two vectors point.
𝑃. 𝑄 = 𝑄. 𝑃 = 𝑝𝑖 𝑞𝑖
𝑛
𝑖=1
 It is also known as the scalar product or inner product, and is
one of the most heavily used operations in 3D graphics.
 𝑃. 𝑄 may also be expressed as the matrix product:
𝑃 𝑇 𝑄 = 𝑝1 𝑝2 … 𝑝 𝑛
𝑞1
𝑞2
:
𝑞 𝑛
Video Game Development: VectorsA. Babadi 9 of 16
The Dot Product
𝑃. 𝑄 = 𝑃 𝑄 cos 𝛼
The dot product is related to the angle
between two vectors.
Video Game Development: VectorsA. Babadi 10 of 16
The Dot Product
The sign of the dot product tells us whether two vectors lie on the
same side or on opposite sides of a plane.
Video Game Development: VectorsA. Babadi 11 of 16
The Dot Product
 Vectors whose dot product yields zero are called orthogonal
(or perpendicular) vectors.
 We define the zero vector 𝟎 = 0,0, … , 0 to be orthogonal to
every vector 𝑃.
Video Game Development: VectorsA. Babadi 12 of 16
cos 𝛼 =
𝑥
𝑃
⇒ 𝑥 = 𝑃 cos 𝛼 =
𝑃. 𝑄
𝑄
 We now have this formula for the projection of 𝑃 onto 𝑄:
𝑝𝑟𝑜𝑗 𝑄
𝑃
=
𝑃. 𝑄
𝑄 2
𝑄
Projecting Vectors
𝛼
𝑃
𝑄
𝑥
Video Game Development: VectorsA. Babadi 13 of 16
The Cross Product
 The cross product (vector product) of two 3D vectors, returns
a new vector that is perpendicular to both of the vectors
being multiplied together.
𝑃 × 𝑄 =
𝑖 𝑗 𝑘
𝑝 𝑥 𝑝 𝑦 𝑝 𝑧
𝑞 𝑥 𝑞 𝑦 𝑞 𝑧
= 𝑝 𝑦 𝑞 𝑧 − 𝑝 𝑧 𝑞 𝑦, 𝑝 𝑧 𝑞 𝑥 − 𝑝 𝑥 𝑞 𝑧, 𝑝 𝑥 𝑞 𝑦 − 𝑝 𝑦 𝑞 𝑥
Video Game Development: VectorsA. Babadi 14 of 16
The Cross Product
 Theorem:
𝑃 × 𝑄 . 𝑃 = 𝑃 × 𝑄 . 𝑄 = 0
The right hand rule provides an easy way for determining in which
direction the cross product points.
Video Game Development: VectorsA. Babadi 15 of 16
The Cross Product
 Theorem:
𝑃 × 𝑄 = 𝑃 𝑄 sin 𝛼
The right hand rule provides an easy way for determining in which
direction the cross product points.
Video Game Development: VectorsA. Babadi 16 of 16
References
 Lengyel’s textbook,
 Wikipedia, and
 Some other sources on the Internet.

More Related Content

Viewers also liked

07. Data Structures
07. Data Structures07. Data Structures
07. Data StructuresAmin Babadi
 
Creating Video Games From Scratch Sky Con
Creating Video Games From Scratch Sky ConCreating Video Games From Scratch Sky Con
Creating Video Games From Scratch Sky ConMartha Rotter
 
Game development pipeline 2
Game development pipeline 2Game development pipeline 2
Game development pipeline 2David Kovalenko
 
Game development pipeline
Game development pipelineGame development pipeline
Game development pipelineGAME Studios
 
06. Game Architecture
06. Game Architecture06. Game Architecture
06. Game ArchitectureAmin Babadi
 
04. The Rendering Pipeline
04. The Rendering Pipeline04. The Rendering Pipeline
04. The Rendering PipelineAmin Babadi
 
Workflows for developing next gen 3D browser games
Workflows for developing next gen 3D browser gamesWorkflows for developing next gen 3D browser games
Workflows for developing next gen 3D browser gamesMichael Plank
 
2D Game Workflow
2D Game Workflow2D Game Workflow
2D Game WorkflowZak Warren
 
Reussir Son Social Game - smart&geek
Reussir Son Social Game - smart&geekReussir Son Social Game - smart&geek
Reussir Son Social Game - smart&geekSmart&Geek
 
Building the pipeline for FUN - Game Development
 Building the pipeline for FUN - Game Development Building the pipeline for FUN - Game Development
Building the pipeline for FUN - Game DevelopmentFaunaFace, Inc
 
The Art of Game Development
The Art of Game DevelopmentThe Art of Game Development
The Art of Game DevelopmentAmir H. Fassihi
 
Battlelog - Building scalable web sites with tight game integration
Battlelog - Building scalable web sites with tight game integrationBattlelog - Building scalable web sites with tight game integration
Battlelog - Building scalable web sites with tight game integrationElectronic Arts / DICE
 
Parallel Futures of a Game Engine
Parallel Futures of a Game EngineParallel Futures of a Game Engine
Parallel Futures of a Game EngineJohan Andersson
 
Killzone Shadow Fall: Creating Art Tools For A New Generation Of Games
Killzone Shadow Fall: Creating Art Tools For A New Generation Of GamesKillzone Shadow Fall: Creating Art Tools For A New Generation Of Games
Killzone Shadow Fall: Creating Art Tools For A New Generation Of GamesGuerrilla
 
Game Engine Overview
Game Engine OverviewGame Engine Overview
Game Engine OverviewSharad Mitra
 
Uncharted 2: Character Pipeline
Uncharted 2: Character PipelineUncharted 2: Character Pipeline
Uncharted 2: Character PipelineNaughty Dog
 

Viewers also liked (20)

07. Data Structures
07. Data Structures07. Data Structures
07. Data Structures
 
Creating Video Games From Scratch Sky Con
Creating Video Games From Scratch Sky ConCreating Video Games From Scratch Sky Con
Creating Video Games From Scratch Sky Con
 
Game development pipeline 2
Game development pipeline 2Game development pipeline 2
Game development pipeline 2
 
Game development pipeline
Game development pipelineGame development pipeline
Game development pipeline
 
3 d game workflow
3 d game workflow 3 d game workflow
3 d game workflow
 
06. Game Architecture
06. Game Architecture06. Game Architecture
06. Game Architecture
 
04. The Rendering Pipeline
04. The Rendering Pipeline04. The Rendering Pipeline
04. The Rendering Pipeline
 
Workflows for developing next gen 3D browser games
Workflows for developing next gen 3D browser gamesWorkflows for developing next gen 3D browser games
Workflows for developing next gen 3D browser games
 
2D Game Workflow
2D Game Workflow2D Game Workflow
2D Game Workflow
 
Reussir Son Social Game - smart&geek
Reussir Son Social Game - smart&geekReussir Son Social Game - smart&geek
Reussir Son Social Game - smart&geek
 
3 d workflow
3 d workflow3 d workflow
3 d workflow
 
Building the pipeline for FUN - Game Development
 Building the pipeline for FUN - Game Development Building the pipeline for FUN - Game Development
Building the pipeline for FUN - Game Development
 
The Art of Game Development
The Art of Game DevelopmentThe Art of Game Development
The Art of Game Development
 
Battlelog - Building scalable web sites with tight game integration
Battlelog - Building scalable web sites with tight game integrationBattlelog - Building scalable web sites with tight game integration
Battlelog - Building scalable web sites with tight game integration
 
Parallel Futures of a Game Engine
Parallel Futures of a Game EngineParallel Futures of a Game Engine
Parallel Futures of a Game Engine
 
Animation.process
Animation.processAnimation.process
Animation.process
 
Killzone Shadow Fall: Creating Art Tools For A New Generation Of Games
Killzone Shadow Fall: Creating Art Tools For A New Generation Of GamesKillzone Shadow Fall: Creating Art Tools For A New Generation Of Games
Killzone Shadow Fall: Creating Art Tools For A New Generation Of Games
 
Mobile Game Publishing Through The ZALO Game Center
Mobile Game Publishing Through The ZALO Game Center Mobile Game Publishing Through The ZALO Game Center
Mobile Game Publishing Through The ZALO Game Center
 
Game Engine Overview
Game Engine OverviewGame Engine Overview
Game Engine Overview
 
Uncharted 2: Character Pipeline
Uncharted 2: Character PipelineUncharted 2: Character Pipeline
Uncharted 2: Character Pipeline
 

Similar to 05. Vectors

Midterm revision 2022 without answer.pdf
Midterm revision 2022  without answer.pdfMidterm revision 2022  without answer.pdf
Midterm revision 2022 without answer.pdfAhmedSalah48055
 
Virtual Reality gaming: analysis of Yon Paradox development - Fabio Mosca - C...
Virtual Reality gaming: analysis of Yon Paradox development - Fabio Mosca - C...Virtual Reality gaming: analysis of Yon Paradox development - Fabio Mosca - C...
Virtual Reality gaming: analysis of Yon Paradox development - Fabio Mosca - C...Codemotion
 
Joshua meyer y1 gd engine_terminology
Joshua meyer y1 gd engine_terminologyJoshua meyer y1 gd engine_terminology
Joshua meyer y1 gd engine_terminologyJoshCollege
 
Y1 gd engine_terminology
Y1 gd engine_terminologyY1 gd engine_terminology
Y1 gd engine_terminologyJordanianmc
 
[Review] RAVEN: Perception-aware Optimization of Power Consumption for Mobile...
[Review] RAVEN: Perception-aware Optimization of Power Consumption for Mobile...[Review] RAVEN: Perception-aware Optimization of Power Consumption for Mobile...
[Review] RAVEN: Perception-aware Optimization of Power Consumption for Mobile...Jinhan Kim
 
AI Dominoes Project
AI Dominoes ProjectAI Dominoes Project
AI Dominoes ProjectAdil Gasimov
 
Y1 gd engine_terminology
Y1 gd engine_terminologyY1 gd engine_terminology
Y1 gd engine_terminologyJordanianmc
 
Game engine terminology/glossary
Game engine terminology/glossaryGame engine terminology/glossary
Game engine terminology/glossarygordonpj96
 
BASICS OF DIGITAL IMAGE PROCESSING,MARIA PETROU
BASICS OF DIGITAL IMAGE PROCESSING,MARIA PETROUBASICS OF DIGITAL IMAGE PROCESSING,MARIA PETROU
BASICS OF DIGITAL IMAGE PROCESSING,MARIA PETROUanjunarayanan
 
Y1 gd engine_terminology (1) (4)
Y1 gd engine_terminology (1) (4) Y1 gd engine_terminology (1) (4)
Y1 gd engine_terminology (1) (4) TomCrook
 
Y1 gd engine_terminology
Y1 gd engine_terminologyY1 gd engine_terminology
Y1 gd engine_terminologyJordanianmc
 
WP7 HUB_XNA overview
WP7 HUB_XNA overviewWP7 HUB_XNA overview
WP7 HUB_XNA overviewMICTT Palma
 
Knock Knock on GameDev Gate
Knock Knock on GameDev GateKnock Knock on GameDev Gate
Knock Knock on GameDev GateBeMyApp
 

Similar to 05. Vectors (20)

Sprite js vs craftyjs
Sprite js vs craftyjsSprite js vs craftyjs
Sprite js vs craftyjs
 
Programmers guide
Programmers guideProgrammers guide
Programmers guide
 
Midterm revision 2022 without answer.pdf
Midterm revision 2022  without answer.pdfMidterm revision 2022  without answer.pdf
Midterm revision 2022 without answer.pdf
 
Virtual Reality gaming: analysis of Yon Paradox development - Fabio Mosca - C...
Virtual Reality gaming: analysis of Yon Paradox development - Fabio Mosca - C...Virtual Reality gaming: analysis of Yon Paradox development - Fabio Mosca - C...
Virtual Reality gaming: analysis of Yon Paradox development - Fabio Mosca - C...
 
Joshua meyer y1 gd engine_terminology
Joshua meyer y1 gd engine_terminologyJoshua meyer y1 gd engine_terminology
Joshua meyer y1 gd engine_terminology
 
Unity
UnityUnity
Unity
 
Y1 gd engine_terminology
Y1 gd engine_terminologyY1 gd engine_terminology
Y1 gd engine_terminology
 
[Review] RAVEN: Perception-aware Optimization of Power Consumption for Mobile...
[Review] RAVEN: Perception-aware Optimization of Power Consumption for Mobile...[Review] RAVEN: Perception-aware Optimization of Power Consumption for Mobile...
[Review] RAVEN: Perception-aware Optimization of Power Consumption for Mobile...
 
AI Dominoes Project
AI Dominoes ProjectAI Dominoes Project
AI Dominoes Project
 
Y1 gd engine_terminology
Y1 gd engine_terminologyY1 gd engine_terminology
Y1 gd engine_terminology
 
Gamedev(en)
Gamedev(en)Gamedev(en)
Gamedev(en)
 
Gamedev(en)
Gamedev(en)Gamedev(en)
Gamedev(en)
 
Game engine terminology/glossary
Game engine terminology/glossaryGame engine terminology/glossary
Game engine terminology/glossary
 
BASICS OF DIGITAL IMAGE PROCESSING,MARIA PETROU
BASICS OF DIGITAL IMAGE PROCESSING,MARIA PETROUBASICS OF DIGITAL IMAGE PROCESSING,MARIA PETROU
BASICS OF DIGITAL IMAGE PROCESSING,MARIA PETROU
 
Alexey Savchenko, Unreal Engine
Alexey Savchenko, Unreal EngineAlexey Savchenko, Unreal Engine
Alexey Savchenko, Unreal Engine
 
Y1 gd engine_terminology (1) (4)
Y1 gd engine_terminology (1) (4) Y1 gd engine_terminology (1) (4)
Y1 gd engine_terminology (1) (4)
 
Engine Terminology
Engine TerminologyEngine Terminology
Engine Terminology
 
Y1 gd engine_terminology
Y1 gd engine_terminologyY1 gd engine_terminology
Y1 gd engine_terminology
 
WP7 HUB_XNA overview
WP7 HUB_XNA overviewWP7 HUB_XNA overview
WP7 HUB_XNA overview
 
Knock Knock on GameDev Gate
Knock Knock on GameDev GateKnock Knock on GameDev Gate
Knock Knock on GameDev Gate
 

Recently uploaded

Transport layer issues and challenges - Guide
Transport layer issues and challenges - GuideTransport layer issues and challenges - Guide
Transport layer issues and challenges - GuideGOPINATHS437943
 
The SRE Report 2024 - Great Findings for the teams
The SRE Report 2024 - Great Findings for the teamsThe SRE Report 2024 - Great Findings for the teams
The SRE Report 2024 - Great Findings for the teamsDILIPKUMARMONDAL6
 
Risk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfRisk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfROCENODodongVILLACER
 
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfgUnit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfgsaravananr517913
 
Correctly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleCorrectly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleAlluxio, Inc.
 
welding defects observed during the welding
welding defects observed during the weldingwelding defects observed during the welding
welding defects observed during the weldingMuhammadUzairLiaqat
 
Energy Awareness training ppt for manufacturing process.pptx
Energy Awareness training ppt for manufacturing process.pptxEnergy Awareness training ppt for manufacturing process.pptx
Energy Awareness training ppt for manufacturing process.pptxsiddharthjain2303
 
An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...Chandu841456
 
Mine Environment II Lab_MI10448MI__________.pptx
Mine Environment II Lab_MI10448MI__________.pptxMine Environment II Lab_MI10448MI__________.pptx
Mine Environment II Lab_MI10448MI__________.pptxRomil Mishra
 
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTIONTHE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTIONjhunlian
 
National Level Hackathon Participation Certificate.pdf
National Level Hackathon Participation Certificate.pdfNational Level Hackathon Participation Certificate.pdf
National Level Hackathon Participation Certificate.pdfRajuKanojiya4
 
Indian Dairy Industry Present Status and.ppt
Indian Dairy Industry Present Status and.pptIndian Dairy Industry Present Status and.ppt
Indian Dairy Industry Present Status and.pptMadan Karki
 
Introduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHIntroduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHC Sai Kiran
 
System Simulation and Modelling with types and Event Scheduling
System Simulation and Modelling with types and Event SchedulingSystem Simulation and Modelling with types and Event Scheduling
System Simulation and Modelling with types and Event SchedulingBootNeck1
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...VICTOR MAESTRE RAMIREZ
 
Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxk795866
 

Recently uploaded (20)

Transport layer issues and challenges - Guide
Transport layer issues and challenges - GuideTransport layer issues and challenges - Guide
Transport layer issues and challenges - Guide
 
The SRE Report 2024 - Great Findings for the teams
The SRE Report 2024 - Great Findings for the teamsThe SRE Report 2024 - Great Findings for the teams
The SRE Report 2024 - Great Findings for the teams
 
Risk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfRisk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdf
 
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfgUnit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
 
Correctly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleCorrectly Loading Incremental Data at Scale
Correctly Loading Incremental Data at Scale
 
welding defects observed during the welding
welding defects observed during the weldingwelding defects observed during the welding
welding defects observed during the welding
 
POWER SYSTEMS-1 Complete notes examples
POWER SYSTEMS-1 Complete notes  examplesPOWER SYSTEMS-1 Complete notes  examples
POWER SYSTEMS-1 Complete notes examples
 
Energy Awareness training ppt for manufacturing process.pptx
Energy Awareness training ppt for manufacturing process.pptxEnergy Awareness training ppt for manufacturing process.pptx
Energy Awareness training ppt for manufacturing process.pptx
 
An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...
 
Mine Environment II Lab_MI10448MI__________.pptx
Mine Environment II Lab_MI10448MI__________.pptxMine Environment II Lab_MI10448MI__________.pptx
Mine Environment II Lab_MI10448MI__________.pptx
 
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTIONTHE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
 
National Level Hackathon Participation Certificate.pdf
National Level Hackathon Participation Certificate.pdfNational Level Hackathon Participation Certificate.pdf
National Level Hackathon Participation Certificate.pdf
 
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
 
Indian Dairy Industry Present Status and.ppt
Indian Dairy Industry Present Status and.pptIndian Dairy Industry Present Status and.ppt
Indian Dairy Industry Present Status and.ppt
 
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
 
Introduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHIntroduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECH
 
System Simulation and Modelling with types and Event Scheduling
System Simulation and Modelling with types and Event SchedulingSystem Simulation and Modelling with types and Event Scheduling
System Simulation and Modelling with types and Event Scheduling
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...
 
Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptx
 
Design and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdfDesign and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdf
 

05. Vectors

  • 1. Video Game Development: VectorsA. Babadi 1 of 16 In The Name Of God Video Game Development Amin Babadi Department of Electrical and Computer Engineering Isfahan University of Technology Spring 2015 Vectors
  • 2. Video Game Development: VectorsA. Babadi 2 of 16 Outline  What is a game engine?  Vector definition  The dot product  Vector projection  The cross product
  • 3. Video Game Development: VectorsA. Babadi 3 of 16 Game Engine  A game engine is a software designed for the creation and development of video games.  The core functionality typically provided by a game engine includes: o A rendering engine, o A physics engine, o Scripting support, o Multi-threading support, o Animation support, o Etc.  More about game engines comes in next lectures.
  • 4. Video Game Development: VectorsA. Babadi 4 of 16 Game Engine  Examples of well-known game engines: o CryEngine, o Unreal Engine, o Gamebyro, o Unity, o Wintermute Engine, o XNA Game Studio, o Game Maker.
  • 5. Video Game Development: VectorsA. Babadi 5 of 16 Vectors  Vectors are of fundamental importance in any game engine.  They mainly are used for representing points in space and spatial directions. o But for now, we make no distinction between vectors representing points and vectors representing directions, nor do we concern ourselves with how vectors are transformed from one coordinate system to another.
  • 6. Video Game Development: VectorsA. Babadi 6 of 16 Vector Properties  We usually restrict ourselves to vectors defined by n-tuples of real numbers, where n is typically 2, 3, or 4. 𝑉 = 𝑣1, 𝑣2, … , 𝑣 𝑛  The numbers 𝑣𝑖 are called the components of the vector 𝑉.  𝑉 may also be represented by a 𝑛 × 1 matrix: 𝑉 = 𝑣1 𝑣2 : 𝑣 𝑛 = 𝑣1 𝑣2 … 𝑣 𝑛 𝑇  The components can usually be labeled with the name of the axis to which they correspond. 𝑃 = 𝑝 𝑥, 𝑝 𝑦, 𝑝 𝑧
  • 7. Video Game Development: VectorsA. Babadi 7 of 16 Vector Properties 𝛼𝑉 = 𝑉𝛼 = 𝛼𝑣1, 𝛼𝑣2, … , 𝛼𝑣 𝑛 𝑃 + 𝑄 = 𝑝1 + 𝑞1, 𝑝2 + 𝑞2, … , 𝑝 𝑛 + 𝑞 𝑛 𝑉 = 𝑣𝑖 2 𝑛 𝑖=1  If 𝑉 = 1, 𝑉 is called a unit vector. If 𝑉 > 0, 𝑉 can be converted to a unit vector. This operation is called normalization. 𝑉′ = 1 𝑉 𝑉
  • 8. Video Game Development: VectorsA. Babadi 8 of 16 The Dot Product  The dot product of two vectors supplies a measure of the similarity (or difference) between the directions in which the two vectors point. 𝑃. 𝑄 = 𝑄. 𝑃 = 𝑝𝑖 𝑞𝑖 𝑛 𝑖=1  It is also known as the scalar product or inner product, and is one of the most heavily used operations in 3D graphics.  𝑃. 𝑄 may also be expressed as the matrix product: 𝑃 𝑇 𝑄 = 𝑝1 𝑝2 … 𝑝 𝑛 𝑞1 𝑞2 : 𝑞 𝑛
  • 9. Video Game Development: VectorsA. Babadi 9 of 16 The Dot Product 𝑃. 𝑄 = 𝑃 𝑄 cos 𝛼 The dot product is related to the angle between two vectors.
  • 10. Video Game Development: VectorsA. Babadi 10 of 16 The Dot Product The sign of the dot product tells us whether two vectors lie on the same side or on opposite sides of a plane.
  • 11. Video Game Development: VectorsA. Babadi 11 of 16 The Dot Product  Vectors whose dot product yields zero are called orthogonal (or perpendicular) vectors.  We define the zero vector 𝟎 = 0,0, … , 0 to be orthogonal to every vector 𝑃.
  • 12. Video Game Development: VectorsA. Babadi 12 of 16 cos 𝛼 = 𝑥 𝑃 ⇒ 𝑥 = 𝑃 cos 𝛼 = 𝑃. 𝑄 𝑄  We now have this formula for the projection of 𝑃 onto 𝑄: 𝑝𝑟𝑜𝑗 𝑄 𝑃 = 𝑃. 𝑄 𝑄 2 𝑄 Projecting Vectors 𝛼 𝑃 𝑄 𝑥
  • 13. Video Game Development: VectorsA. Babadi 13 of 16 The Cross Product  The cross product (vector product) of two 3D vectors, returns a new vector that is perpendicular to both of the vectors being multiplied together. 𝑃 × 𝑄 = 𝑖 𝑗 𝑘 𝑝 𝑥 𝑝 𝑦 𝑝 𝑧 𝑞 𝑥 𝑞 𝑦 𝑞 𝑧 = 𝑝 𝑦 𝑞 𝑧 − 𝑝 𝑧 𝑞 𝑦, 𝑝 𝑧 𝑞 𝑥 − 𝑝 𝑥 𝑞 𝑧, 𝑝 𝑥 𝑞 𝑦 − 𝑝 𝑦 𝑞 𝑥
  • 14. Video Game Development: VectorsA. Babadi 14 of 16 The Cross Product  Theorem: 𝑃 × 𝑄 . 𝑃 = 𝑃 × 𝑄 . 𝑄 = 0 The right hand rule provides an easy way for determining in which direction the cross product points.
  • 15. Video Game Development: VectorsA. Babadi 15 of 16 The Cross Product  Theorem: 𝑃 × 𝑄 = 𝑃 𝑄 sin 𝛼 The right hand rule provides an easy way for determining in which direction the cross product points.
  • 16. Video Game Development: VectorsA. Babadi 16 of 16 References  Lengyel’s textbook,  Wikipedia, and  Some other sources on the Internet.