Beginning direct3d gameprogrammingmath01_primer_20160324_jintaeks

JinTaek Seo
JinTaek SeoDivision of Digital Contents, Dongseo University um 동서대학교 디지털콘텐츠 학부
Beginning Direct3D Game Programming:
Mathematics Primer
jintaeks@gmail.com
Division of Digital Contents, DongSeo University.
March 2016
2D Rotation
Goal: We want to get the rotated point of (x,y)
about theta(θ), (x',y').
2
Assumption: We just know the four fundamental rules of
arithmetic.
Domain and codomain
 In mathematics, the codomain or target set of a function is
the set Y into which all of the output of the function is
constrained to fall. It is the set Y in the notation y=f(x).
 A function f from X to Y. The large blue oval is Y which is the
codomain of f . The smaller oval inside Y is the image of f
3
Exponentiation
 Exponentiation is
a mathematical operation,
written as bn, involving two
numbers, the base b and
the exponent n.
 When n is a positive integer,
exponentiation corresponds to
repeated multiplication of the
base: that is, bn is the product of
multiplying n bases:
4
Factorial
 In mathematics, the factorial of a non-negative integer n,
denoted by n!, is the product of all positive integers less than
or equal to n.
5
Square Root
 In mathematics, a square root of a number a is a
number y such that y2 = a, in other words, a
number y whose square(the result of multiplying the number
by itself, or y × y) is a.
 For example, 4 and −4 are square roots of 16 because 42 =
(−4)2 = 16.
6
16 = 4
2
Cubic Root
 A Root is a general notation for all degrees.
 In case of square root, we can omit superscript 2.
7
27 = 3
3
16 = 4
2
Inverse function
 In mathematics, an inverse
function is a function that "reverses"
another function. That is, if f is a
function mapping x to y, then the
inverse function of f maps y back to x.
8
9
Pythagoras' theorem
 In mathematics, the Pythagorean theorem, also known
as Pythagoras' theorem, is a fundamental relation
in Euclidean geometry among the three sides of a right
triangle.
a2+b2=c2
10
proof
11
a2+b2=c2
 If the length of both a and b are known, then c can be
calculated as:
12
Summation Notation: Sigma(∑)
 In mathematics, summation (symbol: ∑) is the addition of
a sequence of numbers; the result is their sum or total.
13
14
Practice
 Write a function that calculate below equation.
15
Cartesian coordinate system
 A Cartesian coordinate system is a coordinate system that
specifies each point uniquely in a plane by a pair
of numerical coordinates, which are the signed distances to
the point from two fixed perpendicular directed lines,
measured in the same unit of length.
16
• The invention of Cartesian coordinates in
the 17th century by René
Descartes (Latinized name: Cartesius)
revolutionized mathematics.
Cartesian coordinate system
 Each reference line is called
a coordinate axis or just axis of the
system, and the point where they
meet is its origin, usually at ordered
pair (0, 0).
 The coordinates can also be defined
as the positions of the perpendicular
projections of the point onto the two
axes, expressed as signed distances
from the origin.
17
 Illustration of a Cartesian
coordinate plane. Four points are
marked and labeled with their
coordinates: (2,3) in green, (−3,1)
in red, (−1.5,−2.5) in blue, and the
origin (0,0) in purple.
18
 Cartesian coordinate system with a
circle of radius 2 centered at the
origin marked in red. The equation
of a circle is (x− a)2 +
(y − b)2 = r2 where a and b are the
coordinates of the
center (a, b) and r is the radius.
Three dimensions
 Choosing a Cartesian
coordinate system for a
three-dimensional space
means choosing an
ordered triplet of lines
(axes) that are pair-wise
perpendicular, have a
single unit of length for
all three axes and have an
orientation for each axis.
19
Notations and conventions
 The Cartesian coordinates of a point are usually written in
parentheses and separated by commas, as in (10, 5) or(3, 5, 7).
 The origin is often labelled with the capital letter O.
 In analytic geometry, unknown or generic coordinates are
often denoted by the letters (x, y) in the plane, and (x, y, z) in
three-dimensional space.
20
Quadrants
 The axes of a two-dimensional
Cartesian system divide the
plane into four infinite regions,
called quadrants, each
bounded by two half-axes.
 These are often numbered
from 1st to 4th and denoted
by Roman numerals: I (where
the signs of the two
coordinates are +,+), II (−,+), III
(−,−), and IV (+,−).
21
Cartesian formulae for the plane: distance
 The Euclidean distance between two points of the plane with
Cartesian coordinates (x1,y1) and (x2,y2) is like below:
 In three-dimensional space, the distance between
points (x1,y1,z1) and (x2,y2,z2) is
22
Translation and Rotation
 Translating a set of points of the plane, preserving the
distances and directions between them, is equivalent to
adding a fixed pair of numbers (a, b) to the Cartesian
coordinates of every point in the set.
 To rotate a figure counterclockwise around the origin by some
angle is equivalent to replacing every point with coordinates
(x,y) by the point with coordinates (x',y'), where
23
Affine Transformation
 Another way to represent coordinate transformations in
Cartesian coordinates is through affine transformations.
 In affine transformations an extra dimension is added and all
points are given a value of 1 for this extra dimension.
 The advantage of doing this is that point translations can be
specified in the final column of matrix A. In this way, all of the
euclidean transformations become transactable as matrix
point multiplications.
 The affine transformation is given by:
24
Orientation and handedness
 Once the x- and y-axes are specified, they determine
the line along which the z-axis should lie, but there are two
possible directions on this line.
 The two possible coordinate systems which result are called
'right-handed' and 'left-handed'.
25
• The left-handed orientation is shown on the left, and the
right-handed on the right.
26
 The right-handed Cartesian
coordinate system indicating the
coordinate planes.
• Unity 3D game engine uses
LHS.
Write a program that draws f(x)=x2
void OnDraw( HDC hdc ) {
SelectObject( hdc, GetStockObject( DC_PEN ) );
SetDCPenColor( hdc, RGB( 255, 0, 0 ) );
MoveToEx( hdc, 0, 0, NULL );
LineTo( hdc, 100, 50 );
}
27
 Use Win32 Gdi application on Windows7.
 We assume origin is located at (200,200) in the screen
coordinates.
 Draw the x-axis with a red line.
 Draw the y-axis with a blue line.
 20 pixel corresponds to 1 unit(real number).
28
Pi(π)
 The number π is a mathematical constant, the ratio of
a circle's circumference to its diameter, commonly
approximated as 3.14159.
 It has been represented by the Greek letter "π" since the mid-
18th century, though it is also sometimes spelled out as "pi"
(/paɪ/).
29
 π is commonly defined as the ratio of
a circle's circumference C to its diameter d:
30
Radian
 The radian is the standard unit of angular measure, used in
many areas of mathematics. An angle's measurement in
radians is numerically equal to the length of a corresponding
arc of a unit circle; one radian is just under 57.3 degrees.
31
Computing Pi
 Monte Carlo methods, which evaluate the results of multiple
random trials, can be used to create approximations of π.
 Draw a circle inscribed in a square, and randomly place dots
in the square. The ratio of dots inside the circle to the total
number of dots will approximately equal π/4.
32
Practice
 Write a program that approximately calculate the Pi.
33
Trigonometric functions
 In mathematics, the trigonometric functions (also called
the circular functions) are functions of an angle.
 They relate the angles of a triangle to the lengths of its sides.
34
Tangent line, secant line and chord
35
36
Do you know the difference between
angle, degree and radian?
37
38
39
40
41
Pythagorean trigonometric identity
42
How to implement trigonometric functions?
 Taylor polynomial
43
 The sine function (blue) is closely approximated by its Taylor
polynomial of degree 7 (pink) for a full cycle centered on the
origin.
44
Practice
 Write a my own Sine function. Use Taylor series formula.
 Use for-loop to implement Taylor series and tune proper
iteration count.
45
sum and difference formula
46
proof: Let's watch the video.
47
Inverse of trigonometric functions
48
2D Rotation: Do you remember the first question?
49
Practice
 Write a function gets a rotated position of (x,y) about theta.
50
References
 https://en.wikipedia.org/wiki/Pythagorean_theorem
 https://en.wikipedia.org/wiki/Trigonometric_functions
 https://www.youtube.com/watch?v=zcEMKv5yIYs
– The derivation of the Sum Identities for Cosine.
51
1 von 51

Recomendados

Introduction to coordinate geometry von
Introduction to coordinate geometryIntroduction to coordinate geometry
Introduction to coordinate geometryjoannahstevens
1.9K views11 Folien
Computer graphics von
Computer graphicsComputer graphics
Computer graphicsMydul Islam Rashed
609 views7 Folien
Introduction to homography von
Introduction to homographyIntroduction to homography
Introduction to homographyShih-Hsiang Lin
13.3K views32 Folien
IIT JEE Coordinate Geometry- Preparation Tips to Practical Applications! - as... von
IIT JEE Coordinate Geometry- Preparation Tips to Practical Applications! - as...IIT JEE Coordinate Geometry- Preparation Tips to Practical Applications! - as...
IIT JEE Coordinate Geometry- Preparation Tips to Practical Applications! - as...askiitian
3.5K views19 Folien
Ds lec 5_chap4 von
Ds lec 5_chap4Ds lec 5_chap4
Ds lec 5_chap4Self-Employed
255 views29 Folien
Planar graph( Algorithm and Application ) von
Planar graph( Algorithm and Application )Planar graph( Algorithm and Application )
Planar graph( Algorithm and Application )Abdullah Moin
521 views14 Folien

Más contenido relacionado

Was ist angesagt?

Algebra booklet von
Algebra bookletAlgebra booklet
Algebra bookletRameenKamran1
29 views8 Folien
Maths IB Important von
Maths IB ImportantMaths IB Important
Maths IB ImportantMagisetty Harikrushna
12.9K views19 Folien
Straight lines von
Straight linesStraight lines
Straight linesindu psthakur
46.1K views54 Folien
April 15, 2015 von
April 15, 2015April 15, 2015
April 15, 2015khyps13
256 views23 Folien
Coordinate geometry von
Coordinate geometryCoordinate geometry
Coordinate geometryErlyn Geronimo
8.1K views40 Folien
Soal Olimpiade von
Soal OlimpiadeSoal Olimpiade
Soal Olimpiadedinakudus
992 views9 Folien

Was ist angesagt?(19)

April 15, 2015 von khyps13
April 15, 2015April 15, 2015
April 15, 2015
khyps13256 views
Soal Olimpiade von dinakudus
Soal OlimpiadeSoal Olimpiade
Soal Olimpiade
dinakudus992 views
Math unit38 vectors von eLearningJa
Math unit38 vectorsMath unit38 vectors
Math unit38 vectors
eLearningJa113 views
coordinate Geometry straight line von SahilPuri14
coordinate Geometry   straight linecoordinate Geometry   straight line
coordinate Geometry straight line
SahilPuri142.4K views
Coordinate geometry von Carl Davis
Coordinate geometryCoordinate geometry
Coordinate geometry
Carl Davis520 views
Finding Area of a Composite Figure (Presentation) von CRISALDO CORDURA
Finding Area of a Composite Figure (Presentation)Finding Area of a Composite Figure (Presentation)
Finding Area of a Composite Figure (Presentation)
CRISALDO CORDURA2.8K views
presentation on co-ordinate geometery von FutureX1
presentation on co-ordinate geometerypresentation on co-ordinate geometery
presentation on co-ordinate geometery
FutureX1170 views
Analytic geometry lecture1 von admercano101
Analytic geometry lecture1Analytic geometry lecture1
Analytic geometry lecture1
admercano1014.7K views
3D Coordinate Geometry von ParasKulhari
3D Coordinate Geometry 3D Coordinate Geometry
3D Coordinate Geometry
ParasKulhari7.2K views

Destacado

Presentacion Postgradoen Accesibilidad y Diseño para Todos von
Presentacion Postgradoen Accesibilidad y Diseño para TodosPresentacion Postgradoen Accesibilidad y Diseño para Todos
Presentacion Postgradoen Accesibilidad y Diseño para TodosEnrique Rovira-Beleta y Ana Folch
329 views18 Folien
Copy Rights von
Copy RightsCopy Rights
Copy RightsBriannaStyles
117 views6 Folien
Ufficio Virtuale Padova von
Ufficio Virtuale PadovaUfficio Virtuale Padova
Ufficio Virtuale Padovagianluca pollesel
395 views11 Folien
Bioteknologia von
BioteknologiaBioteknologia
Bioteknologiaiazpiro1
294 views12 Folien
Sant cugat von
Sant cugatSant cugat
Sant cugatDuraLaura1rC
150 views8 Folien

Destacado(20)

Bioteknologia von iazpiro1
BioteknologiaBioteknologia
Bioteknologia
iazpiro1294 views
GuíA Guadalinex2 von magonal2
GuíA Guadalinex2GuíA Guadalinex2
GuíA Guadalinex2
magonal2240 views
Apresentação sobre os blogs moçambicanos para a conferência do cea von Nyikiwa
Apresentação sobre os blogs moçambicanos para a conferência do ceaApresentação sobre os blogs moçambicanos para a conferência do cea
Apresentação sobre os blogs moçambicanos para a conferência do cea
Nyikiwa178 views
گلستان ابوالحسن1 von guest3ba11f
گلستان ابوالحسن1گلستان ابوالحسن1
گلستان ابوالحسن1
guest3ba11f106 views
Beginning direct3d gameprogrammingmath02_logarithm_20160324_jintaeks von JinTaek Seo
Beginning direct3d gameprogrammingmath02_logarithm_20160324_jintaeksBeginning direct3d gameprogrammingmath02_logarithm_20160324_jintaeks
Beginning direct3d gameprogrammingmath02_logarithm_20160324_jintaeks
JinTaek Seo213 views
Gas Natural Vehicular: un combustible econòmic, sostenible i tecnològicament ... von AMTU
Gas Natural Vehicular: un combustible econòmic, sostenible i tecnològicament ...Gas Natural Vehicular: un combustible econòmic, sostenible i tecnològicament ...
Gas Natural Vehicular: un combustible econòmic, sostenible i tecnològicament ...
AMTU541 views
Tijs michiel verwest von montse81
Tijs michiel verwestTijs michiel verwest
Tijs michiel verwest
montse81335 views
Cara menghaspus section break von mbak_aul
Cara menghaspus section breakCara menghaspus section break
Cara menghaspus section break
mbak_aul172 views
E 12 bsp1779_pankajkumarvisualcv von Pankaj Kumar
E 12 bsp1779_pankajkumarvisualcvE 12 bsp1779_pankajkumarvisualcv
E 12 bsp1779_pankajkumarvisualcv
Pankaj Kumar204 views
Diversity Executive_The 4 Stages_1-2.2010 von Helene Lollis
Diversity Executive_The 4 Stages_1-2.2010Diversity Executive_The 4 Stages_1-2.2010
Diversity Executive_The 4 Stages_1-2.2010
Helene Lollis128 views

Similar a Beginning direct3d gameprogrammingmath01_primer_20160324_jintaeks

Beginning direct3d gameprogrammingmath06_transformations_20161019_jintaeks von
Beginning direct3d gameprogrammingmath06_transformations_20161019_jintaeksBeginning direct3d gameprogrammingmath06_transformations_20161019_jintaeks
Beginning direct3d gameprogrammingmath06_transformations_20161019_jintaeksJinTaek Seo
205 views50 Folien
Beginning direct3d gameprogrammingmath03_vectors_20160328_jintaeks von
Beginning direct3d gameprogrammingmath03_vectors_20160328_jintaeksBeginning direct3d gameprogrammingmath03_vectors_20160328_jintaeks
Beginning direct3d gameprogrammingmath03_vectors_20160328_jintaeksJinTaek Seo
193 views38 Folien
History,applications,algebra and mathematical form of plane in mathematics (p... von
History,applications,algebra and mathematical form of plane in mathematics (p...History,applications,algebra and mathematical form of plane in mathematics (p...
History,applications,algebra and mathematical form of plane in mathematics (p...guesta62dea
2.8K views41 Folien
Co-ordinate Geometry.pptx von
Co-ordinate Geometry.pptxCo-ordinate Geometry.pptx
Co-ordinate Geometry.pptxVictoriyaAmirtharaj
27 views12 Folien
Plano numerico von
Plano numericoPlano numerico
Plano numericoDargelisGomez1
39 views22 Folien
Class 10 mathematics compendium von
Class 10 mathematics compendiumClass 10 mathematics compendium
Class 10 mathematics compendiumAPEX INSTITUTE
415 views16 Folien

Similar a Beginning direct3d gameprogrammingmath01_primer_20160324_jintaeks(20)

Beginning direct3d gameprogrammingmath06_transformations_20161019_jintaeks von JinTaek Seo
Beginning direct3d gameprogrammingmath06_transformations_20161019_jintaeksBeginning direct3d gameprogrammingmath06_transformations_20161019_jintaeks
Beginning direct3d gameprogrammingmath06_transformations_20161019_jintaeks
JinTaek Seo205 views
Beginning direct3d gameprogrammingmath03_vectors_20160328_jintaeks von JinTaek Seo
Beginning direct3d gameprogrammingmath03_vectors_20160328_jintaeksBeginning direct3d gameprogrammingmath03_vectors_20160328_jintaeks
Beginning direct3d gameprogrammingmath03_vectors_20160328_jintaeks
JinTaek Seo193 views
History,applications,algebra and mathematical form of plane in mathematics (p... von guesta62dea
History,applications,algebra and mathematical form of plane in mathematics (p...History,applications,algebra and mathematical form of plane in mathematics (p...
History,applications,algebra and mathematical form of plane in mathematics (p...
guesta62dea2.8K views
EMT_2A_cylindrical coordinates.pptx von 5610UmarIqbal
EMT_2A_cylindrical coordinates.pptxEMT_2A_cylindrical coordinates.pptx
EMT_2A_cylindrical coordinates.pptx
5610UmarIqbal12 views
Coordinate geometry 9 grade von Siddu Lingesh
Coordinate geometry 9 gradeCoordinate geometry 9 grade
Coordinate geometry 9 grade
Siddu Lingesh275 views
Beginning direct3d gameprogrammingmath05_matrices_20160515_jintaeks von JinTaek Seo
Beginning direct3d gameprogrammingmath05_matrices_20160515_jintaeksBeginning direct3d gameprogrammingmath05_matrices_20160515_jintaeks
Beginning direct3d gameprogrammingmath05_matrices_20160515_jintaeks
JinTaek Seo212 views
Computer Graphics & linear Algebra von Xad Kuain
Computer Graphics & linear Algebra Computer Graphics & linear Algebra
Computer Graphics & linear Algebra
Xad Kuain2K views
Lecture 07 graphing linear equations von Hazel Joy Chong
Lecture 07 graphing linear equationsLecture 07 graphing linear equations
Lecture 07 graphing linear equations
Hazel Joy Chong1.1K views
Multiple integral(tripple integral) von jigar sable
Multiple integral(tripple integral)Multiple integral(tripple integral)
Multiple integral(tripple integral)
jigar sable5.3K views
Computer graphics unit 4th von TEJVEER SINGH
Computer graphics unit 4thComputer graphics unit 4th
Computer graphics unit 4th
TEJVEER SINGH243 views

Más de JinTaek Seo

Neural network 20161210_jintaekseo von
Neural network 20161210_jintaekseoNeural network 20161210_jintaekseo
Neural network 20161210_jintaekseoJinTaek Seo
457 views57 Folien
05 heap 20161110_jintaeks von
05 heap 20161110_jintaeks05 heap 20161110_jintaeks
05 heap 20161110_jintaeksJinTaek Seo
425 views20 Folien
02 linked list_20160217_jintaekseo von
02 linked list_20160217_jintaekseo02 linked list_20160217_jintaekseo
02 linked list_20160217_jintaekseoJinTaek Seo
256 views47 Folien
Hermite spline english_20161201_jintaeks von
Hermite spline english_20161201_jintaeksHermite spline english_20161201_jintaeks
Hermite spline english_20161201_jintaeksJinTaek Seo
1.4K views32 Folien
01 stack 20160908_jintaek_seo von
01 stack 20160908_jintaek_seo01 stack 20160908_jintaek_seo
01 stack 20160908_jintaek_seoJinTaek Seo
140 views45 Folien
03 fsm how_toimplementai_state_20161006_jintaeks von
03 fsm how_toimplementai_state_20161006_jintaeks03 fsm how_toimplementai_state_20161006_jintaeks
03 fsm how_toimplementai_state_20161006_jintaeksJinTaek Seo
186 views37 Folien

Más de JinTaek Seo(20)

Neural network 20161210_jintaekseo von JinTaek Seo
Neural network 20161210_jintaekseoNeural network 20161210_jintaekseo
Neural network 20161210_jintaekseo
JinTaek Seo457 views
05 heap 20161110_jintaeks von JinTaek Seo
05 heap 20161110_jintaeks05 heap 20161110_jintaeks
05 heap 20161110_jintaeks
JinTaek Seo425 views
02 linked list_20160217_jintaekseo von JinTaek Seo
02 linked list_20160217_jintaekseo02 linked list_20160217_jintaekseo
02 linked list_20160217_jintaekseo
JinTaek Seo256 views
Hermite spline english_20161201_jintaeks von JinTaek Seo
Hermite spline english_20161201_jintaeksHermite spline english_20161201_jintaeks
Hermite spline english_20161201_jintaeks
JinTaek Seo1.4K views
01 stack 20160908_jintaek_seo von JinTaek Seo
01 stack 20160908_jintaek_seo01 stack 20160908_jintaek_seo
01 stack 20160908_jintaek_seo
JinTaek Seo140 views
03 fsm how_toimplementai_state_20161006_jintaeks von JinTaek Seo
03 fsm how_toimplementai_state_20161006_jintaeks03 fsm how_toimplementai_state_20161006_jintaeks
03 fsm how_toimplementai_state_20161006_jintaeks
JinTaek Seo186 views
Beginning direct3d gameprogramming10_shaderdetail_20160506_jintaeks von JinTaek Seo
Beginning direct3d gameprogramming10_shaderdetail_20160506_jintaeksBeginning direct3d gameprogramming10_shaderdetail_20160506_jintaeks
Beginning direct3d gameprogramming10_shaderdetail_20160506_jintaeks
JinTaek Seo218 views
Beginning direct3d gameprogramming09_shaderprogramming_20160505_jintaeks von JinTaek Seo
Beginning direct3d gameprogramming09_shaderprogramming_20160505_jintaeksBeginning direct3d gameprogramming09_shaderprogramming_20160505_jintaeks
Beginning direct3d gameprogramming09_shaderprogramming_20160505_jintaeks
JinTaek Seo418 views
Beginning direct3d gameprogramming08_usingtextures_20160428_jintaeks von JinTaek Seo
Beginning direct3d gameprogramming08_usingtextures_20160428_jintaeksBeginning direct3d gameprogramming08_usingtextures_20160428_jintaeks
Beginning direct3d gameprogramming08_usingtextures_20160428_jintaeks
JinTaek Seo236 views
Beginning direct3d gameprogramming07_lightsandmaterials_20161117_jintaeks von JinTaek Seo
Beginning direct3d gameprogramming07_lightsandmaterials_20161117_jintaeksBeginning direct3d gameprogramming07_lightsandmaterials_20161117_jintaeks
Beginning direct3d gameprogramming07_lightsandmaterials_20161117_jintaeks
JinTaek Seo188 views
Beginning direct3d gameprogramming06_firststepstoanimation_20161115_jintaeks von JinTaek Seo
Beginning direct3d gameprogramming06_firststepstoanimation_20161115_jintaeksBeginning direct3d gameprogramming06_firststepstoanimation_20161115_jintaeks
Beginning direct3d gameprogramming06_firststepstoanimation_20161115_jintaeks
JinTaek Seo308 views
Beginning direct3d gameprogramming05_thebasics_20160421_jintaeks von JinTaek Seo
Beginning direct3d gameprogramming05_thebasics_20160421_jintaeksBeginning direct3d gameprogramming05_thebasics_20160421_jintaeks
Beginning direct3d gameprogramming05_thebasics_20160421_jintaeks
JinTaek Seo301 views
Beginning direct3d gameprogramming04_3dfundamentals_20160414_jintaeks von JinTaek Seo
Beginning direct3d gameprogramming04_3dfundamentals_20160414_jintaeksBeginning direct3d gameprogramming04_3dfundamentals_20160414_jintaeks
Beginning direct3d gameprogramming04_3dfundamentals_20160414_jintaeks
JinTaek Seo153 views
Beginning direct3d gameprogramming02_overviewofhalandcom_20160408_jintaeks von JinTaek Seo
Beginning direct3d gameprogramming02_overviewofhalandcom_20160408_jintaeksBeginning direct3d gameprogramming02_overviewofhalandcom_20160408_jintaeks
Beginning direct3d gameprogramming02_overviewofhalandcom_20160408_jintaeks
JinTaek Seo181 views
Beginning direct3d gameprogramming01_thehistoryofdirect3dgraphics_20160407_ji... von JinTaek Seo
Beginning direct3d gameprogramming01_thehistoryofdirect3dgraphics_20160407_ji...Beginning direct3d gameprogramming01_thehistoryofdirect3dgraphics_20160407_ji...
Beginning direct3d gameprogramming01_thehistoryofdirect3dgraphics_20160407_ji...
JinTaek Seo262 views
Beginning direct3d gameprogramming01_20161102_jintaeks von JinTaek Seo
Beginning direct3d gameprogramming01_20161102_jintaeksBeginning direct3d gameprogramming01_20161102_jintaeks
Beginning direct3d gameprogramming01_20161102_jintaeks
JinTaek Seo251 views
Beginning direct3d gameprogramming03_programmingconventions_20160414_jintaeks von JinTaek Seo
Beginning direct3d gameprogramming03_programmingconventions_20160414_jintaeksBeginning direct3d gameprogramming03_programmingconventions_20160414_jintaeks
Beginning direct3d gameprogramming03_programmingconventions_20160414_jintaeks
JinTaek Seo272 views
Beginning direct3d gameprogrammingmath04_calculus_20160324_jintaeks von JinTaek Seo
Beginning direct3d gameprogrammingmath04_calculus_20160324_jintaeksBeginning direct3d gameprogrammingmath04_calculus_20160324_jintaeks
Beginning direct3d gameprogrammingmath04_calculus_20160324_jintaeks
JinTaek Seo193 views
Beginning direct3d gameprogrammingcpp02_20160324_jintaeks von JinTaek Seo
Beginning direct3d gameprogrammingcpp02_20160324_jintaeksBeginning direct3d gameprogrammingcpp02_20160324_jintaeks
Beginning direct3d gameprogrammingcpp02_20160324_jintaeks
JinTaek Seo1.2K views
Boost pp 20091102_서진택 von JinTaek Seo
Boost pp 20091102_서진택Boost pp 20091102_서진택
Boost pp 20091102_서진택
JinTaek Seo339 views

Último

Digital Watermarking Of Audio Signals.pptx von
Digital Watermarking Of Audio Signals.pptxDigital Watermarking Of Audio Signals.pptx
Digital Watermarking Of Audio Signals.pptxAyushJaiswal781174
8 views25 Folien
Literature review and Case study on Commercial Complex in Nepal, Durbar mall,... von
Literature review and Case study on Commercial Complex in Nepal, Durbar mall,...Literature review and Case study on Commercial Complex in Nepal, Durbar mall,...
Literature review and Case study on Commercial Complex in Nepal, Durbar mall,...AakashShakya12
57 views115 Folien
Performance of Back-to-Back Mechanically Stabilized Earth Walls Supporting th... von
Performance of Back-to-Back Mechanically Stabilized Earth Walls Supporting th...Performance of Back-to-Back Mechanically Stabilized Earth Walls Supporting th...
Performance of Back-to-Back Mechanically Stabilized Earth Walls Supporting th...ahmedmesaiaoun
12 views84 Folien
Stone Masonry and Brick Masonry.pdf von
Stone Masonry and Brick Masonry.pdfStone Masonry and Brick Masonry.pdf
Stone Masonry and Brick Masonry.pdfMohammed Abdullah Laskar
20 views6 Folien
SNMPx von
SNMPxSNMPx
SNMPxAmatullahbutt
14 views12 Folien
802.11 Computer Networks von
802.11 Computer Networks802.11 Computer Networks
802.11 Computer NetworksTusharChoudhary72015
9 views33 Folien

Último(20)

Literature review and Case study on Commercial Complex in Nepal, Durbar mall,... von AakashShakya12
Literature review and Case study on Commercial Complex in Nepal, Durbar mall,...Literature review and Case study on Commercial Complex in Nepal, Durbar mall,...
Literature review and Case study on Commercial Complex in Nepal, Durbar mall,...
AakashShakya1257 views
Performance of Back-to-Back Mechanically Stabilized Earth Walls Supporting th... von ahmedmesaiaoun
Performance of Back-to-Back Mechanically Stabilized Earth Walls Supporting th...Performance of Back-to-Back Mechanically Stabilized Earth Walls Supporting th...
Performance of Back-to-Back Mechanically Stabilized Earth Walls Supporting th...
ahmedmesaiaoun12 views
DevOps to DevSecOps: Enhancing Software Security Throughout The Development L... von Anowar Hossain
DevOps to DevSecOps: Enhancing Software Security Throughout The Development L...DevOps to DevSecOps: Enhancing Software Security Throughout The Development L...
DevOps to DevSecOps: Enhancing Software Security Throughout The Development L...
Anowar Hossain12 views
An approach of ontology and knowledge base for railway maintenance von IJECEIAES
An approach of ontology and knowledge base for railway maintenanceAn approach of ontology and knowledge base for railway maintenance
An approach of ontology and knowledge base for railway maintenance
IJECEIAES12 views
Machine Element II Course outline.pdf von odatadese1
Machine Element II Course outline.pdfMachine Element II Course outline.pdf
Machine Element II Course outline.pdf
odatadese17 views
MSA Website Slideshow (16).pdf von msaucla
MSA Website Slideshow (16).pdfMSA Website Slideshow (16).pdf
MSA Website Slideshow (16).pdf
msaucla46 views
cloud computing-virtualization.pptx von RajaulKarim20
cloud computing-virtualization.pptxcloud computing-virtualization.pptx
cloud computing-virtualization.pptx
RajaulKarim2085 views
7_DVD_Combinational_MOS_Logic_Circuits.pdf von Usha Mehta
7_DVD_Combinational_MOS_Logic_Circuits.pdf7_DVD_Combinational_MOS_Logic_Circuits.pdf
7_DVD_Combinational_MOS_Logic_Circuits.pdf
Usha Mehta59 views
Thermal aware task assignment for multicore processors using genetic algorithm von IJECEIAES
Thermal aware task assignment for multicore processors using genetic algorithm Thermal aware task assignment for multicore processors using genetic algorithm
Thermal aware task assignment for multicore processors using genetic algorithm
IJECEIAES30 views

Beginning direct3d gameprogrammingmath01_primer_20160324_jintaeks

  • 1. Beginning Direct3D Game Programming: Mathematics Primer jintaeks@gmail.com Division of Digital Contents, DongSeo University. March 2016
  • 2. 2D Rotation Goal: We want to get the rotated point of (x,y) about theta(θ), (x',y'). 2 Assumption: We just know the four fundamental rules of arithmetic.
  • 3. Domain and codomain  In mathematics, the codomain or target set of a function is the set Y into which all of the output of the function is constrained to fall. It is the set Y in the notation y=f(x).  A function f from X to Y. The large blue oval is Y which is the codomain of f . The smaller oval inside Y is the image of f 3
  • 4. Exponentiation  Exponentiation is a mathematical operation, written as bn, involving two numbers, the base b and the exponent n.  When n is a positive integer, exponentiation corresponds to repeated multiplication of the base: that is, bn is the product of multiplying n bases: 4
  • 5. Factorial  In mathematics, the factorial of a non-negative integer n, denoted by n!, is the product of all positive integers less than or equal to n. 5
  • 6. Square Root  In mathematics, a square root of a number a is a number y such that y2 = a, in other words, a number y whose square(the result of multiplying the number by itself, or y × y) is a.  For example, 4 and −4 are square roots of 16 because 42 = (−4)2 = 16. 6 16 = 4 2
  • 7. Cubic Root  A Root is a general notation for all degrees.  In case of square root, we can omit superscript 2. 7 27 = 3 3 16 = 4 2
  • 8. Inverse function  In mathematics, an inverse function is a function that "reverses" another function. That is, if f is a function mapping x to y, then the inverse function of f maps y back to x. 8
  • 9. 9
  • 10. Pythagoras' theorem  In mathematics, the Pythagorean theorem, also known as Pythagoras' theorem, is a fundamental relation in Euclidean geometry among the three sides of a right triangle. a2+b2=c2 10
  • 12. a2+b2=c2  If the length of both a and b are known, then c can be calculated as: 12
  • 13. Summation Notation: Sigma(∑)  In mathematics, summation (symbol: ∑) is the addition of a sequence of numbers; the result is their sum or total. 13
  • 14. 14
  • 15. Practice  Write a function that calculate below equation. 15
  • 16. Cartesian coordinate system  A Cartesian coordinate system is a coordinate system that specifies each point uniquely in a plane by a pair of numerical coordinates, which are the signed distances to the point from two fixed perpendicular directed lines, measured in the same unit of length. 16 • The invention of Cartesian coordinates in the 17th century by René Descartes (Latinized name: Cartesius) revolutionized mathematics.
  • 17. Cartesian coordinate system  Each reference line is called a coordinate axis or just axis of the system, and the point where they meet is its origin, usually at ordered pair (0, 0).  The coordinates can also be defined as the positions of the perpendicular projections of the point onto the two axes, expressed as signed distances from the origin. 17
  • 18.  Illustration of a Cartesian coordinate plane. Four points are marked and labeled with their coordinates: (2,3) in green, (−3,1) in red, (−1.5,−2.5) in blue, and the origin (0,0) in purple. 18  Cartesian coordinate system with a circle of radius 2 centered at the origin marked in red. The equation of a circle is (x− a)2 + (y − b)2 = r2 where a and b are the coordinates of the center (a, b) and r is the radius.
  • 19. Three dimensions  Choosing a Cartesian coordinate system for a three-dimensional space means choosing an ordered triplet of lines (axes) that are pair-wise perpendicular, have a single unit of length for all three axes and have an orientation for each axis. 19
  • 20. Notations and conventions  The Cartesian coordinates of a point are usually written in parentheses and separated by commas, as in (10, 5) or(3, 5, 7).  The origin is often labelled with the capital letter O.  In analytic geometry, unknown or generic coordinates are often denoted by the letters (x, y) in the plane, and (x, y, z) in three-dimensional space. 20
  • 21. Quadrants  The axes of a two-dimensional Cartesian system divide the plane into four infinite regions, called quadrants, each bounded by two half-axes.  These are often numbered from 1st to 4th and denoted by Roman numerals: I (where the signs of the two coordinates are +,+), II (−,+), III (−,−), and IV (+,−). 21
  • 22. Cartesian formulae for the plane: distance  The Euclidean distance between two points of the plane with Cartesian coordinates (x1,y1) and (x2,y2) is like below:  In three-dimensional space, the distance between points (x1,y1,z1) and (x2,y2,z2) is 22
  • 23. Translation and Rotation  Translating a set of points of the plane, preserving the distances and directions between them, is equivalent to adding a fixed pair of numbers (a, b) to the Cartesian coordinates of every point in the set.  To rotate a figure counterclockwise around the origin by some angle is equivalent to replacing every point with coordinates (x,y) by the point with coordinates (x',y'), where 23
  • 24. Affine Transformation  Another way to represent coordinate transformations in Cartesian coordinates is through affine transformations.  In affine transformations an extra dimension is added and all points are given a value of 1 for this extra dimension.  The advantage of doing this is that point translations can be specified in the final column of matrix A. In this way, all of the euclidean transformations become transactable as matrix point multiplications.  The affine transformation is given by: 24
  • 25. Orientation and handedness  Once the x- and y-axes are specified, they determine the line along which the z-axis should lie, but there are two possible directions on this line.  The two possible coordinate systems which result are called 'right-handed' and 'left-handed'. 25 • The left-handed orientation is shown on the left, and the right-handed on the right.
  • 26. 26  The right-handed Cartesian coordinate system indicating the coordinate planes. • Unity 3D game engine uses LHS.
  • 27. Write a program that draws f(x)=x2 void OnDraw( HDC hdc ) { SelectObject( hdc, GetStockObject( DC_PEN ) ); SetDCPenColor( hdc, RGB( 255, 0, 0 ) ); MoveToEx( hdc, 0, 0, NULL ); LineTo( hdc, 100, 50 ); } 27  Use Win32 Gdi application on Windows7.  We assume origin is located at (200,200) in the screen coordinates.  Draw the x-axis with a red line.  Draw the y-axis with a blue line.  20 pixel corresponds to 1 unit(real number).
  • 28. 28
  • 29. Pi(π)  The number π is a mathematical constant, the ratio of a circle's circumference to its diameter, commonly approximated as 3.14159.  It has been represented by the Greek letter "π" since the mid- 18th century, though it is also sometimes spelled out as "pi" (/paɪ/). 29
  • 30.  π is commonly defined as the ratio of a circle's circumference C to its diameter d: 30
  • 31. Radian  The radian is the standard unit of angular measure, used in many areas of mathematics. An angle's measurement in radians is numerically equal to the length of a corresponding arc of a unit circle; one radian is just under 57.3 degrees. 31
  • 32. Computing Pi  Monte Carlo methods, which evaluate the results of multiple random trials, can be used to create approximations of π.  Draw a circle inscribed in a square, and randomly place dots in the square. The ratio of dots inside the circle to the total number of dots will approximately equal π/4. 32
  • 33. Practice  Write a program that approximately calculate the Pi. 33
  • 34. Trigonometric functions  In mathematics, the trigonometric functions (also called the circular functions) are functions of an angle.  They relate the angles of a triangle to the lengths of its sides. 34
  • 35. Tangent line, secant line and chord 35
  • 36. 36 Do you know the difference between angle, degree and radian?
  • 37. 37
  • 38. 38
  • 39. 39
  • 40. 40
  • 41. 41
  • 43. How to implement trigonometric functions?  Taylor polynomial 43
  • 44.  The sine function (blue) is closely approximated by its Taylor polynomial of degree 7 (pink) for a full cycle centered on the origin. 44
  • 45. Practice  Write a my own Sine function. Use Taylor series formula.  Use for-loop to implement Taylor series and tune proper iteration count. 45
  • 46. sum and difference formula 46
  • 47. proof: Let's watch the video. 47
  • 48. Inverse of trigonometric functions 48
  • 49. 2D Rotation: Do you remember the first question? 49
  • 50. Practice  Write a function gets a rotated position of (x,y) about theta. 50
  • 51. References  https://en.wikipedia.org/wiki/Pythagorean_theorem  https://en.wikipedia.org/wiki/Trigonometric_functions  https://www.youtube.com/watch?v=zcEMKv5yIYs – The derivation of the Sum Identities for Cosine. 51