{"id":2461,"date":"2016-07-04T10:48:46","date_gmt":"2016-07-04T14:48:46","guid":{"rendered":"http:\/\/local.brightwhiz\/?p=2461"},"modified":"2021-12-09T04:50:53","modified_gmt":"2021-12-09T09:50:53","slug":"vectors-3d-math-game-programming","status":"publish","type":"post","link":"http:\/\/local.brightwhiz\/vectors-3d-math-game-programming\/","title":{"rendered":"3D Math for Game Programming: Vectors – Part 5"},"content":{"rendered":"\n

We now resume our series on 3D math for game programming from where we left off and talk about Vectors. In the last article of the series we took a look at Nested Coordinate Spaces<\/a> and learned how to specify them and handle coordinate space transformations.<\/p>\n\n\n\n

Today we will be introducing you to vectors and how they are used in 3D Math for game programming<\/a>. This is a reminder that If you are new to this series you can go over and get started with the introduction to 3D Math for computer graphics here<\/a>.<\/p>\n\n\n\n

What are Vectors<\/h2>\n\n\n\n

When dissecting Vectors in the concept of 3D <\/a>Math then we need to distinguish between the two definitions in terms of abstract and purely mathematical definition and the geometric definition. And yes! We know geometry is part of math but work with us now. I am going somewhere with this. For the purposes of 3D math<\/a>, it is important to understand both implementations.<\/p>\n\n\n\n

In mathematical terms, a Vector is a list of numbers or to us programmers, it is an array of numbers. Still in that same mood, as a mathematician, you must be able to distinguish between Vector vs Scalar<\/strong> quantities. A scalar quantity just to mention is an ordinary number. To illustrate, “velocity” and “displacement” are vector quantities, while “speed” and “distance” are scalar quantities.<\/p>\n\n\n\n

The next term we introduce is “dimension”<\/strong>. Dimension is the value that tells us how many numbers a Vector has. Logic tells us that a Dimension is a number higher than zero. Therefore a single dimension Vector is also a Scalar or 1D Vector. We will mostly be looking at 2D, 3D, and 4D Vectors in this series. we will use x and y to refer to the elements in a 2D vector, x, y, and z to refer to elements in a 3D vector, and x, y, z, and w to refer to elements in a 4D vector.<\/p>\n\n\n\n

Now for the Geometric Definition of a Vector<\/h3>\n\n\n\n
\"2D<\/a>
A 2D Vector<\/figcaption><\/figure><\/div>\n\n\n\n

Geometrically a Vector is a directed line segment that has magnitude and direction. Magnitude is the length of the Vector and is usually non-negative. A direction is a way in which the Vector points in the coordinate space. This illustration is usually done with an arrowhead at the end of the magnitude line.<\/p>\n\n\n\n

It is good to note now that Vectors do not have an absolute position but they imply a relative position. For example: “The car is 13 miles east of here”. This statement gives a relative position but not an absolute one.<\/p>\n\n\n\n

\"2D<\/a>
Specifying a 2D Vector<\/figcaption><\/figure><\/div>\n\n\n\n

To specify Vectors you need to do so using the axis in the plane in which they are placed. For instance, the 2D Vector here can be specified as [x, y]. The illustration shows where X and Y come from. The same applies to 3D and 4D Vectors. In this case, it is x units to the right and y units up.<\/p>\n\n\n\n

A Vector even though being a single line can also be specified as a series of displacements (straight lines) leading to the same point<\/strong>. You can have a series of different magnitudes and directions. Think of it as you being able to drive home from work. You are not restricted to using a single route but you may have several options. Theoretically flying from one city to another a plane usually flies in a single Vector (Not in the real world but it works for this purposes) while driving to the same destination you will have to complete the trip with a series of Vectors. Now we just mentioned a Point<\/strong>, Therefore:<\/p>\n\n\n\n

Vectors vs Points<\/h2>\n\n\n\n

A “point” specifies a position, and a “vector” specifies a displacement. Remember from previous articles in this series that a point has a location while obviously, a Vector doesn’t have a position.<\/p>\n\n\n\n

From the illustration above we can say a point is the tip of the arrowhead while a Vector remember is the Line. It is important at this time to note that points are relative positions. They are relative to the Origin of the coordinate system used to specify their coordinates. Take note that Vectors are specified with square brackets like [x,y] while Points are specified using parenthesis (x,y).<\/p>\n\n\n\n

For now, we will stop here. In Part 6 of the series, we will start off with the relevant parts of Linear Algebra that we will be used to perform operations on Vectors.<\/p>\n","protected":false},"excerpt":{"rendered":"

We now resume our series on 3D math for game programming from where we left off and talk about Vectors. In the last article of the series we took a…<\/p>\n","protected":false},"author":1,"featured_media":2462,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,27,16],"tags":[33,35,37,111,145,146,195,262,471,611,616],"yoast_head":"\nVectors in 2D and 3D Math for Game Programming<\/title>\n<meta name=\"description\" content=\"In this fifth part in our series of 3D math for game programming we get introduced to Vectors as used in these these types of applications\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/local.brightwhiz\/vectors-3d-math-game-programming\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Vectors in 2D and 3D Math for Game Programming\" \/>\n<meta property=\"og:description\" content=\"In this fifth part in our series of 3D math for game programming we get introduced to Vectors as used in these these types of applications\" \/>\n<meta property=\"og:url\" content=\"http:\/\/local.brightwhiz\/vectors-3d-math-game-programming\/\" \/>\n<meta property=\"og:site_name\" content=\"Brightwhiz.com\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/brightwhiz\/\" \/>\n<meta property=\"article:published_time\" content=\"2016-07-04T14:48:46+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-12-09T09:50:53+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/local.brightwhiz\/wp-content\/uploads\/2016\/05\/3D-Math-Vectors.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"630\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Michael Bright\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@brightwhizmag\" \/>\n<meta name=\"twitter:site\" content=\"@brightwhizmag\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Michael Bright\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"http:\/\/local.brightwhiz\/vectors-3d-math-game-programming\/#article\",\"isPartOf\":{\"@id\":\"http:\/\/local.brightwhiz\/vectors-3d-math-game-programming\/\"},\"author\":{\"name\":\"Michael Bright\",\"@id\":\"http:\/\/local.brightwhiz\/#\/schema\/person\/81f0f3126f13834ae2e7f381b3028e32\"},\"headline\":\"3D Math for Game Programming: Vectors – Part 5\",\"datePublished\":\"2016-07-04T14:48:46+00:00\",\"dateModified\":\"2021-12-09T09:50:53+00:00\",\"mainEntityOfPage\":{\"@id\":\"http:\/\/local.brightwhiz\/vectors-3d-math-game-programming\/\"},\"wordCount\":752,\"commentCount\":0,\"publisher\":{\"@id\":\"http:\/\/local.brightwhiz\/#organization\"},\"image\":{\"@id\":\"http:\/\/local.brightwhiz\/vectors-3d-math-game-programming\/#primaryimage\"},\"thumbnailUrl\":\"http:\/\/local.brightwhiz\/wp-content\/uploads\/2016\/05\/3D-Math-Vectors.jpg\",\"keywords\":[\"3D\",\"3D math\",\"3D modeling\",\"C++\",\"Computer games\",\"Computer graphics\",\"Digital arts\",\"Game Development\",\"Programming\",\"Vectors\",\"video games\"],\"articleSection\":[\"Articles\",\"Programming\",\"Technology\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"http:\/\/local.brightwhiz\/vectors-3d-math-game-programming\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"http:\/\/local.brightwhiz\/vectors-3d-math-game-programming\/\",\"url\":\"http:\/\/local.brightwhiz\/vectors-3d-math-game-programming\/\",\"name\":\"Vectors in 2D and 3D Math for Game Programming\",\"isPartOf\":{\"@id\":\"http:\/\/local.brightwhiz\/#website\"},\"primaryImageOfPage\":{\"@id\":\"http:\/\/local.brightwhiz\/vectors-3d-math-game-programming\/#primaryimage\"},\"image\":{\"@id\":\"http:\/\/local.brightwhiz\/vectors-3d-math-game-programming\/#primaryimage\"},\"thumbnailUrl\":\"http:\/\/local.brightwhiz\/wp-content\/uploads\/2016\/05\/3D-Math-Vectors.jpg\",\"datePublished\":\"2016-07-04T14:48:46+00:00\",\"dateModified\":\"2021-12-09T09:50:53+00:00\",\"description\":\"In this fifth part in our series of 3D math for game programming we get introduced to Vectors as used in these these types of applications\",\"breadcrumb\":{\"@id\":\"http:\/\/local.brightwhiz\/vectors-3d-math-game-programming\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\/\/local.brightwhiz\/vectors-3d-math-game-programming\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/local.brightwhiz\/vectors-3d-math-game-programming\/#primaryimage\",\"url\":\"http:\/\/local.brightwhiz\/wp-content\/uploads\/2016\/05\/3D-Math-Vectors.jpg\",\"contentUrl\":\"http:\/\/local.brightwhiz\/wp-content\/uploads\/2016\/05\/3D-Math-Vectors.jpg\",\"width\":1200,\"height\":630,\"caption\":\"Game Programming 3D Math Vectors\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\/\/local.brightwhiz\/vectors-3d-math-game-programming\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"http:\/\/local.brightwhiz\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"3D Math for Game Programming: Vectors – Part 5\"}]},{\"@type\":\"WebSite\",\"@id\":\"http:\/\/local.brightwhiz\/#website\",\"url\":\"http:\/\/local.brightwhiz\/\",\"name\":\"Brightwhiz.com\",\"description\":\"Best Tech guides, Tutorials, and News\",\"publisher\":{\"@id\":\"http:\/\/local.brightwhiz\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\/\/local.brightwhiz\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"http:\/\/local.brightwhiz\/#organization\",\"name\":\"Brightwhiz\",\"url\":\"http:\/\/local.brightwhiz\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/local.brightwhiz\/#\/schema\/logo\/image\/\",\"url\":\"http:\/\/local.brightwhiz\/wp-content\/uploads\/2021\/11\/brightwhiz-com-logo-orange.png\",\"contentUrl\":\"http:\/\/local.brightwhiz\/wp-content\/uploads\/2021\/11\/brightwhiz-com-logo-orange.png\",\"width\":706,\"height\":135,\"caption\":\"Brightwhiz\"},\"image\":{\"@id\":\"http:\/\/local.brightwhiz\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/brightwhiz\/\",\"https:\/\/x.com\/brightwhizmag\",\"https:\/\/instagram.com\/bright_whiz\/\",\"https:\/\/www.pinterest.com\/sobbayi\/\",\"https:\/\/www.youtube.com\/channel\/UC6sCdP_d_RiTIM7ErFT-PSQ\"]},{\"@type\":\"Person\",\"@id\":\"http:\/\/local.brightwhiz\/#\/schema\/person\/81f0f3126f13834ae2e7f381b3028e32\",\"name\":\"Michael Bright\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/local.brightwhiz\/#\/schema\/person\/image\/\",\"url\":\"http:\/\/1.gravatar.com\/avatar\/da90485875ff0aafa38fdd494abe87d1?s=96&d=mm&r=g\",\"contentUrl\":\"http:\/\/1.gravatar.com\/avatar\/da90485875ff0aafa38fdd494abe87d1?s=96&d=mm&r=g\",\"caption\":\"Michael Bright\"},\"sameAs\":[\"https:\/\/sobbayi.com\"],\"url\":\"http:\/\/local.brightwhiz\/author\/sobbayiadmin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Vectors in 2D and 3D Math for Game Programming","description":"In this fifth part in our series of 3D math for game programming we get introduced to Vectors as used in these these types of applications","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"http:\/\/local.brightwhiz\/vectors-3d-math-game-programming\/","og_locale":"en_US","og_type":"article","og_title":"Vectors in 2D and 3D Math for Game Programming","og_description":"In this fifth part in our series of 3D math for game programming we get introduced to Vectors as used in these these types of applications","og_url":"http:\/\/local.brightwhiz\/vectors-3d-math-game-programming\/","og_site_name":"Brightwhiz.com","article_publisher":"https:\/\/www.facebook.com\/brightwhiz\/","article_published_time":"2016-07-04T14:48:46+00:00","article_modified_time":"2021-12-09T09:50:53+00:00","og_image":[{"width":1200,"height":630,"url":"http:\/\/local.brightwhiz\/wp-content\/uploads\/2016\/05\/3D-Math-Vectors.jpg","type":"image\/jpeg"}],"author":"Michael Bright","twitter_card":"summary_large_image","twitter_creator":"@brightwhizmag","twitter_site":"@brightwhizmag","twitter_misc":{"Written by":"Michael Bright","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"http:\/\/local.brightwhiz\/vectors-3d-math-game-programming\/#article","isPartOf":{"@id":"http:\/\/local.brightwhiz\/vectors-3d-math-game-programming\/"},"author":{"name":"Michael Bright","@id":"http:\/\/local.brightwhiz\/#\/schema\/person\/81f0f3126f13834ae2e7f381b3028e32"},"headline":"3D Math for Game Programming: Vectors – Part 5","datePublished":"2016-07-04T14:48:46+00:00","dateModified":"2021-12-09T09:50:53+00:00","mainEntityOfPage":{"@id":"http:\/\/local.brightwhiz\/vectors-3d-math-game-programming\/"},"wordCount":752,"commentCount":0,"publisher":{"@id":"http:\/\/local.brightwhiz\/#organization"},"image":{"@id":"http:\/\/local.brightwhiz\/vectors-3d-math-game-programming\/#primaryimage"},"thumbnailUrl":"http:\/\/local.brightwhiz\/wp-content\/uploads\/2016\/05\/3D-Math-Vectors.jpg","keywords":["3D","3D math","3D modeling","C++","Computer games","Computer graphics","Digital arts","Game Development","Programming","Vectors","video games"],"articleSection":["Articles","Programming","Technology"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["http:\/\/local.brightwhiz\/vectors-3d-math-game-programming\/#respond"]}]},{"@type":"WebPage","@id":"http:\/\/local.brightwhiz\/vectors-3d-math-game-programming\/","url":"http:\/\/local.brightwhiz\/vectors-3d-math-game-programming\/","name":"Vectors in 2D and 3D Math for Game Programming","isPartOf":{"@id":"http:\/\/local.brightwhiz\/#website"},"primaryImageOfPage":{"@id":"http:\/\/local.brightwhiz\/vectors-3d-math-game-programming\/#primaryimage"},"image":{"@id":"http:\/\/local.brightwhiz\/vectors-3d-math-game-programming\/#primaryimage"},"thumbnailUrl":"http:\/\/local.brightwhiz\/wp-content\/uploads\/2016\/05\/3D-Math-Vectors.jpg","datePublished":"2016-07-04T14:48:46+00:00","dateModified":"2021-12-09T09:50:53+00:00","description":"In this fifth part in our series of 3D math for game programming we get introduced to Vectors as used in these these types of applications","breadcrumb":{"@id":"http:\/\/local.brightwhiz\/vectors-3d-math-game-programming\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["http:\/\/local.brightwhiz\/vectors-3d-math-game-programming\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/local.brightwhiz\/vectors-3d-math-game-programming\/#primaryimage","url":"http:\/\/local.brightwhiz\/wp-content\/uploads\/2016\/05\/3D-Math-Vectors.jpg","contentUrl":"http:\/\/local.brightwhiz\/wp-content\/uploads\/2016\/05\/3D-Math-Vectors.jpg","width":1200,"height":630,"caption":"Game Programming 3D Math Vectors"},{"@type":"BreadcrumbList","@id":"http:\/\/local.brightwhiz\/vectors-3d-math-game-programming\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"http:\/\/local.brightwhiz\/"},{"@type":"ListItem","position":2,"name":"3D Math for Game Programming: Vectors – Part 5"}]},{"@type":"WebSite","@id":"http:\/\/local.brightwhiz\/#website","url":"http:\/\/local.brightwhiz\/","name":"Brightwhiz.com","description":"Best Tech guides, Tutorials, and News","publisher":{"@id":"http:\/\/local.brightwhiz\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/local.brightwhiz\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"http:\/\/local.brightwhiz\/#organization","name":"Brightwhiz","url":"http:\/\/local.brightwhiz\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/local.brightwhiz\/#\/schema\/logo\/image\/","url":"http:\/\/local.brightwhiz\/wp-content\/uploads\/2021\/11\/brightwhiz-com-logo-orange.png","contentUrl":"http:\/\/local.brightwhiz\/wp-content\/uploads\/2021\/11\/brightwhiz-com-logo-orange.png","width":706,"height":135,"caption":"Brightwhiz"},"image":{"@id":"http:\/\/local.brightwhiz\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/brightwhiz\/","https:\/\/x.com\/brightwhizmag","https:\/\/instagram.com\/bright_whiz\/","https:\/\/www.pinterest.com\/sobbayi\/","https:\/\/www.youtube.com\/channel\/UC6sCdP_d_RiTIM7ErFT-PSQ"]},{"@type":"Person","@id":"http:\/\/local.brightwhiz\/#\/schema\/person\/81f0f3126f13834ae2e7f381b3028e32","name":"Michael Bright","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/local.brightwhiz\/#\/schema\/person\/image\/","url":"http:\/\/1.gravatar.com\/avatar\/da90485875ff0aafa38fdd494abe87d1?s=96&d=mm&r=g","contentUrl":"http:\/\/1.gravatar.com\/avatar\/da90485875ff0aafa38fdd494abe87d1?s=96&d=mm&r=g","caption":"Michael Bright"},"sameAs":["https:\/\/sobbayi.com"],"url":"http:\/\/local.brightwhiz\/author\/sobbayiadmin\/"}]}},"_links":{"self":[{"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/posts\/2461"}],"collection":[{"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/comments?post=2461"}],"version-history":[{"count":0,"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/posts\/2461\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/media\/2462"}],"wp:attachment":[{"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/media?parent=2461"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/categories?post=2461"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/tags?post=2461"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}