SlideShare a Scribd company logo
1 of 35
Vector Tools for
Computer Graphics
Computer Graphics
Basic Definitions
 Points specify location in space (or in the plane).
 Vectors have magnitude and direction (like
velocity).
Points  Vectors
Basics of Vectors
v
v
Q
P
Vector as displacement:
v is a vector from point P to point Q.
The difference between two points is a vector: v = Q - P
Another way:
The sum of a point and a vector is a point : P + v = Q
v
Q
P
Operations on Vectors
Two operations
Addition
a + b
a = (3,5,8), b = (-1,2,-4)
a + b = (2,7,4)
Multiplication be scalars
sa
a = (3,-5,8), s = 5
5a = (15,-25,40)
operations are done componentwise
Operations on vectors
Addition
a
b
a+ b
a
b
a+ b
Multiplication by scalar
a
2a
-a
Operations on vectors
Subtraction
a
c
a
-c
a-c
a
c
a-c
Properties of vectors
Length or size
2
2
2
2
1 ...
n
w
w
w 



|
w
|
w = (w1,w2,…,wn)
Unit vector
a
a
a 

• The process is called normalizing
• Used to refer direction
The standard unit vectors: i = (1,0,0), j = (0,1,0) and k = (0,0,1)
Dot Product
The dot product d of two vectors v = (v1,v2,…,vn)
and w = (w1,w2,…wn):
Properties
1. Symmetry: a·b = b·a
2. Linearity: (a+c) ·b = a·b + c·b
3. Homogeneity: (sa) ·b = s(a·b)
4. |b|2 = b·b
Application of Dot Product
Angle between two unit vectors b and c
c
b
y
x
Φb
Φc
θ
^
^
)
cos( c
b



Two vectors b and c are perpendicular (orthogonal/normal) if
b·c = 0
2D perp Vector
Which vector is perpendicular to the 2D vector a = (ax,ay)?
Let a = (ax,ay).
Then
a┴ = (-ay,ax)
is the
counterclockwise
perpendicular to a.
a┴
-a┴
a
a
What about 3D case?
Rotation in 2d
v
v┴
• We want to rotate a 2d vector v counterclockwise by an angle A
• First we determine perp(v), v┴
• Then we scale v by cosA and scale v┴ by sinA and take their sum
vcosA
v┴sinA A
vcosA + v┴sinA
Rotation in 3d
• We want to rotate a 3d vector l counterclockwise with respect to a
3d unit vector r by an angle A, where l and r are perpendicular to
each other
• First we determine the vector u, that is perpendicular to both l and
r and have a length equal to that of l
• So, u = r X l
• Then we scale l by cosA and scale u by sinA and take their sum
lcosA
usinA A
l
r
u
* note that, this method is
applicable only in cases
where the axis of rotation
and the vector which is to be
rotated are perpendicular to
each other
Rotation in 3d
• Example: Rotate (1, -1, 2) with respect to (-1, 3, 2), by 30°
• l = (1, -1, 2)
• r = (-1, 3, 2) / 12 = (-1/12, 1/4,1/6)
• u = l x r = ?
• Answer = l cos30° + u sin30° = ?
lcosA
usinA A
l
r
u
Orthogonal Projection
v
c
v┴
• We want to decompose the vector c into two vectors, one along the
direction of a unit vector v and another along perp(v)
• The length of the orthogonal projection of c along v is c.v
(as v is a unit vector)
• Thus the component (or orthogonal projection) of c along v is (c.v)v
• So the component of c along perp(v) is c-(c.v)v
c.v
Reflection [13]
a
n
r
m -m
e e
a
n
r
θ θ
r = a - 2 ( a . n) n
• Here m is the orthogonal projection of a along n
• m equals (a.n)n as n is a unit vector
Cross Product
 Also called vector product.
 Defined for 3D vectors only.
z
y
x
z
y
x
b
b
b
a
a
a
k
j
i
b
a 

Properties
1. Antisymmetry: a Χ b = - b Χ a
2. Linearity: (a +c) Χ b = a Χ b + c Χ b
3. Homogeneity: (sa) Χ b = s(a Χ b)
Geometric Interpretation of Cross Product
axb
a
b
x
y
z
P2
P1
P3
1. aXb is perpendicular to both a and b
2. | aXb | = area of the parallelogram defined by a and b
Representing Lines [11][12]
Line Ray
2 types of representations:
1. Two point form
2. Parametric representation
Parametric Representation of a Line
y
x
t = 1
B
P
v
t = 0
t < 0
t > 1
𝐿 𝑡 = 𝑃 + 𝑡𝒗
Planes in 3D
 4 fundamental forms
 Three-point form
 Parametric representation
 Point normal form
 Equation
Parametric Representation of Plane
P
a
b
𝑈 𝑠, 𝑡 = 𝑃 + 𝑠𝒂 + 𝑡𝒃
a and b cannot be parallel
Point Normal Form of a Plane
B
n
Representations of Plane [13]
Three Point
Point
Normal
Parametric
A=(0,0,n.C/ nz) C=(C-0)
B=(0,n.C/ ny,0)
n = (A-C)x(B – C)
{A,C, B}
{C, n}
{C, a, b}
Equation of a Plane [1][2][3][4]
• ax + by + cz + d = 0 is the standard equation of a plane in 3d
• If sqrt(a^2 + b^2 + c^2) = 1, then it is called the normalized form
• In the normalized form, |d| equals the distance of the plane from
the origin
P = (px, py)
p.n
Y
X
L
nx
ny
(x, y)
What about distance
from an arbitrary point?
How to convert between
equation and the other
forms?
Line-Plane Intersection [8]
• Plane: ax + by + cz + d = 0
• Line: P + tV
• Determine the specific value of t (say t’) for which the equation of
the plane is satisfied, i.e., the point on the line lies on the plane
Exercise:
Find intersection of 𝑥 + 2𝑦 + 3𝑧 + 4 = 0 and 1, 2, 3 + 𝑡(3, 2, 1).
Line-Line Intersection [5][6][7]
• Four possible cases:
• Coincident
• Parallel
• Not parallel and do not intersect
• Not parallel and intersect
Line-Line Intersection
• L1: P1 + tV1
• L2: P2 + sV2
• Parallel if V1 and V2 are in the same or opposite direction (i.e., the
angle between them are 0 degree or 180 degree)
• Coincident if they are parallel and have at least one point in common
• If they are not parallel, how to decide whether they intersect or not?
Line-Line Intersection
• If they are not parallel, how to decide whether they intersect or not?
• One solution
• Generate three equations for two unknowns
• Solve the first two equations to find a solution
• Check whether the solution satisfies the third equation
• Another solution
• Check whether (P1 – P2).(V1 X V2) = 0
• If lines intersect this condition must hold
• If lines do not intersect, is it sure not to hold?
Line-Line Intersection
Exercise:
Find intersection between 1, 2, 3 + 𝑡(1, 1, 1) and 1, 1, 1 + 𝑠 1, 2, 3 .
Plane-Plane Intersection [9][10]
• Intersection is a line
• So we need two points on the line, or one point and the direction
• How to get a point on the intersecting line?
• How to get the direction of the intersecting line?
Plane-Plane Intersection
• How to get a point on the intersecting line?
• Imagine another plane not parallel to the intersecting line, for
example the plane z = 0 (the XY plane).
• Now solve three equations to find their common intersection
point
Plane-Plane Intersection
• How to get the direction of the
intersecting line?
• Consider the planes in point-normal
form
• Plane 1: P1, n1
• Plane 2: P2, n2
• n1 and n2 are both perpendicular to the
intersecting line
• So the direction of the line of
intersection is along n1 X n2
Plane-Plane Intersection
Exercise:
Find intersection of 𝑥 + 2𝑦 − 𝑧 = 5
and 𝑥 − 4𝑦 + 𝑧 = 3.
Links
[1] http://www.songho.ca/math/plane/plane.html
[2] http://mathinsight.org/distance_point_plane
[3] https://www.youtube.com/watch?v=gw-4wltP5tY
[4] https://www.youtube.com/watch?v=7rIFO8hct9g
[5] https://www.youtube.com/watch?v=nKVCvY-FW5Q
[6] https://www.youtube.com/watch?v=bJ56Xr9081k
[7] https://www.youtube.com/watch?v=r5DwyBFxD7Q
[8] https://www.youtube.com/watch?v=Td9CZGkqrSg
[9] https://www.youtube.com/watch?v=SoSTdgqknvY
[10] https://www.youtube.com/watch?v=LpardiBTAvU
Links
[11] https://www.youtube.com/watch?v=FlLbI7DB0SM
[12] https://www.youtube.com/watch?v=nZ2mS5M4fcQ
[13] (textbook) Chapter 4, Computer Graphics using OpenGL (2nd edition)
by Francis S Hill, Jr.

More Related Content

Similar to 2-Vector.pptx

MA101-Lecturenotes(2019-20)-Module 13 (1).pdf
MA101-Lecturenotes(2019-20)-Module 13 (1).pdfMA101-Lecturenotes(2019-20)-Module 13 (1).pdf
MA101-Lecturenotes(2019-20)-Module 13 (1).pdfvasusingh34
 
MA101-Lecturenotes(2019-20)-Module 13 (1).pdf
MA101-Lecturenotes(2019-20)-Module 13 (1).pdfMA101-Lecturenotes(2019-20)-Module 13 (1).pdf
MA101-Lecturenotes(2019-20)-Module 13 (1).pdfvasusingh34
 
7.5 lines and_planes_in_space
7.5 lines and_planes_in_space7.5 lines and_planes_in_space
7.5 lines and_planes_in_spaceMahbub Alwathoni
 
GTU LAVC Line Integral,Green Theorem in the Plane, Surface And Volume Integra...
GTU LAVC Line Integral,Green Theorem in the Plane, Surface And Volume Integra...GTU LAVC Line Integral,Green Theorem in the Plane, Surface And Volume Integra...
GTU LAVC Line Integral,Green Theorem in the Plane, Surface And Volume Integra...Panchal Anand
 
Modeling Transformations
Modeling TransformationsModeling Transformations
Modeling TransformationsTarun Gehlot
 
Further pure mathmatics 3 vectors
Further pure mathmatics 3 vectorsFurther pure mathmatics 3 vectors
Further pure mathmatics 3 vectorsDennis Almeida
 
Chapter 12 Section 12.1 Three-Dimensional Coordinate Sys
Chapter 12 Section 12.1  Three-Dimensional Coordinate SysChapter 12 Section 12.1  Three-Dimensional Coordinate Sys
Chapter 12 Section 12.1 Three-Dimensional Coordinate SysEstelaJeffery653
 
Beginning direct3d gameprogrammingmath03_vectors_20160328_jintaeks
Beginning direct3d gameprogrammingmath03_vectors_20160328_jintaeksBeginning direct3d gameprogrammingmath03_vectors_20160328_jintaeks
Beginning direct3d gameprogrammingmath03_vectors_20160328_jintaeksJinTaek Seo
 
Analytical Geometry in three dimension
Analytical Geometry in three dimensionAnalytical Geometry in three dimension
Analytical Geometry in three dimensionSwathiSundari
 
2 d transformation
2 d transformation2 d transformation
2 d transformationAnkit Garg
 
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...
History,applications,algebra and mathematical form of plane in mathematics (p...guesta62dea
 
CLASS X MATHS
CLASS X MATHS CLASS X MATHS
CLASS X MATHS Rc Os
 
Straight_Lines in mat 111 full lecture.ppt
Straight_Lines in mat 111 full lecture.pptStraight_Lines in mat 111 full lecture.ppt
Straight_Lines in mat 111 full lecture.pptElaiyarajaR1
 
10_1425_web_Lec_04_2D_Motion.pdf
10_1425_web_Lec_04_2D_Motion.pdf10_1425_web_Lec_04_2D_Motion.pdf
10_1425_web_Lec_04_2D_Motion.pdfKumarRoshan23
 
Three dimensional geometry
Three dimensional geometryThree dimensional geometry
Three dimensional geometrynitishguptamaps
 

Similar to 2-Vector.pptx (20)

MA101-Lecturenotes(2019-20)-Module 13 (1).pdf
MA101-Lecturenotes(2019-20)-Module 13 (1).pdfMA101-Lecturenotes(2019-20)-Module 13 (1).pdf
MA101-Lecturenotes(2019-20)-Module 13 (1).pdf
 
MA101-Lecturenotes(2019-20)-Module 13 (1).pdf
MA101-Lecturenotes(2019-20)-Module 13 (1).pdfMA101-Lecturenotes(2019-20)-Module 13 (1).pdf
MA101-Lecturenotes(2019-20)-Module 13 (1).pdf
 
7.5 lines and_planes_in_space
7.5 lines and_planes_in_space7.5 lines and_planes_in_space
7.5 lines and_planes_in_space
 
Representation
RepresentationRepresentation
Representation
 
GTU LAVC Line Integral,Green Theorem in the Plane, Surface And Volume Integra...
GTU LAVC Line Integral,Green Theorem in the Plane, Surface And Volume Integra...GTU LAVC Line Integral,Green Theorem in the Plane, Surface And Volume Integra...
GTU LAVC Line Integral,Green Theorem in the Plane, Surface And Volume Integra...
 
Modeling Transformations
Modeling TransformationsModeling Transformations
Modeling Transformations
 
Kinematics-1
Kinematics-1Kinematics-1
Kinematics-1
 
Further pure mathmatics 3 vectors
Further pure mathmatics 3 vectorsFurther pure mathmatics 3 vectors
Further pure mathmatics 3 vectors
 
Chapter 12 Section 12.1 Three-Dimensional Coordinate Sys
Chapter 12 Section 12.1  Three-Dimensional Coordinate SysChapter 12 Section 12.1  Three-Dimensional Coordinate Sys
Chapter 12 Section 12.1 Three-Dimensional Coordinate Sys
 
Vectors Victor
Vectors VictorVectors Victor
Vectors Victor
 
1533 game mathematics
1533 game mathematics1533 game mathematics
1533 game mathematics
 
Beginning direct3d gameprogrammingmath03_vectors_20160328_jintaeks
Beginning direct3d gameprogrammingmath03_vectors_20160328_jintaeksBeginning direct3d gameprogrammingmath03_vectors_20160328_jintaeks
Beginning direct3d gameprogrammingmath03_vectors_20160328_jintaeks
 
Analytical Geometry in three dimension
Analytical Geometry in three dimensionAnalytical Geometry in three dimension
Analytical Geometry in three dimension
 
2 d transformation
2 d transformation2 d transformation
2 d transformation
 
Transformations
TransformationsTransformations
Transformations
 
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...
History,applications,algebra and mathematical form of plane in mathematics (p...
 
CLASS X MATHS
CLASS X MATHS CLASS X MATHS
CLASS X MATHS
 
Straight_Lines in mat 111 full lecture.ppt
Straight_Lines in mat 111 full lecture.pptStraight_Lines in mat 111 full lecture.ppt
Straight_Lines in mat 111 full lecture.ppt
 
10_1425_web_Lec_04_2D_Motion.pdf
10_1425_web_Lec_04_2D_Motion.pdf10_1425_web_Lec_04_2D_Motion.pdf
10_1425_web_Lec_04_2D_Motion.pdf
 
Three dimensional geometry
Three dimensional geometryThree dimensional geometry
Three dimensional geometry
 

Recently uploaded

When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...Gary Wood
 
Rich Dad Poor Dad ( PDFDrive.com )--.pdf
Rich Dad Poor Dad ( PDFDrive.com )--.pdfRich Dad Poor Dad ( PDFDrive.com )--.pdf
Rich Dad Poor Dad ( PDFDrive.com )--.pdfJerry Chew
 
How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17Celine George
 
Major project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategiesMajor project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategiesAmanpreetKaur157993
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSAnaAcapella
 
PSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptxPSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptxMarlene Maheu
 
Details on CBSE Compartment Exam.pptx1111
Details on CBSE Compartment Exam.pptx1111Details on CBSE Compartment Exam.pptx1111
Details on CBSE Compartment Exam.pptx1111GangaMaiya1
 
Pharmaceutical Biotechnology VI semester.pdf
Pharmaceutical Biotechnology VI semester.pdfPharmaceutical Biotechnology VI semester.pdf
Pharmaceutical Biotechnology VI semester.pdfBALASUNDARESAN M
 
diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....Ritu480198
 
PS-Policies-on-Enrolment-Transfer-of-Docs-Checking-of-School-Forms-and-SF10-a...
PS-Policies-on-Enrolment-Transfer-of-Docs-Checking-of-School-Forms-and-SF10-a...PS-Policies-on-Enrolment-Transfer-of-Docs-Checking-of-School-Forms-and-SF10-a...
PS-Policies-on-Enrolment-Transfer-of-Docs-Checking-of-School-Forms-and-SF10-a...nhezmainit1
 
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjMohammed Sikander
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxmarlenawright1
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfPondicherry University
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project researchCaitlinCummins3
 
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...Nguyen Thanh Tu Collection
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...Nguyen Thanh Tu Collection
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsSandeep D Chaudhary
 

Recently uploaded (20)

When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...
 
Rich Dad Poor Dad ( PDFDrive.com )--.pdf
Rich Dad Poor Dad ( PDFDrive.com )--.pdfRich Dad Poor Dad ( PDFDrive.com )--.pdf
Rich Dad Poor Dad ( PDFDrive.com )--.pdf
 
How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17
 
Major project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategiesMajor project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategies
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
 
PSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptxPSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptx
 
Details on CBSE Compartment Exam.pptx1111
Details on CBSE Compartment Exam.pptx1111Details on CBSE Compartment Exam.pptx1111
Details on CBSE Compartment Exam.pptx1111
 
Pharmaceutical Biotechnology VI semester.pdf
Pharmaceutical Biotechnology VI semester.pdfPharmaceutical Biotechnology VI semester.pdf
Pharmaceutical Biotechnology VI semester.pdf
 
diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....
 
PS-Policies-on-Enrolment-Transfer-of-Docs-Checking-of-School-Forms-and-SF10-a...
PS-Policies-on-Enrolment-Transfer-of-Docs-Checking-of-School-Forms-and-SF10-a...PS-Policies-on-Enrolment-Transfer-of-Docs-Checking-of-School-Forms-and-SF10-a...
PS-Policies-on-Enrolment-Transfer-of-Docs-Checking-of-School-Forms-and-SF10-a...
 
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
 
VAMOS CUIDAR DO NOSSO PLANETA! .
VAMOS CUIDAR DO NOSSO PLANETA!                    .VAMOS CUIDAR DO NOSSO PLANETA!                    .
VAMOS CUIDAR DO NOSSO PLANETA! .
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project research
 
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & Systems
 
Mattingly "AI & Prompt Design: Named Entity Recognition"
Mattingly "AI & Prompt Design: Named Entity Recognition"Mattingly "AI & Prompt Design: Named Entity Recognition"
Mattingly "AI & Prompt Design: Named Entity Recognition"
 
Mattingly "AI and Prompt Design: LLMs with NER"
Mattingly "AI and Prompt Design: LLMs with NER"Mattingly "AI and Prompt Design: LLMs with NER"
Mattingly "AI and Prompt Design: LLMs with NER"
 

2-Vector.pptx

  • 1. Vector Tools for Computer Graphics Computer Graphics
  • 2. Basic Definitions  Points specify location in space (or in the plane).  Vectors have magnitude and direction (like velocity). Points  Vectors
  • 3. Basics of Vectors v v Q P Vector as displacement: v is a vector from point P to point Q. The difference between two points is a vector: v = Q - P Another way: The sum of a point and a vector is a point : P + v = Q v Q P
  • 4. Operations on Vectors Two operations Addition a + b a = (3,5,8), b = (-1,2,-4) a + b = (2,7,4) Multiplication be scalars sa a = (3,-5,8), s = 5 5a = (15,-25,40) operations are done componentwise
  • 5. Operations on vectors Addition a b a+ b a b a+ b Multiplication by scalar a 2a -a
  • 7. Properties of vectors Length or size 2 2 2 2 1 ... n w w w     | w | w = (w1,w2,…,wn) Unit vector a a a   • The process is called normalizing • Used to refer direction The standard unit vectors: i = (1,0,0), j = (0,1,0) and k = (0,0,1)
  • 8. Dot Product The dot product d of two vectors v = (v1,v2,…,vn) and w = (w1,w2,…wn): Properties 1. Symmetry: a·b = b·a 2. Linearity: (a+c) ·b = a·b + c·b 3. Homogeneity: (sa) ·b = s(a·b) 4. |b|2 = b·b
  • 9. Application of Dot Product Angle between two unit vectors b and c c b y x Φb Φc θ ^ ^ ) cos( c b    Two vectors b and c are perpendicular (orthogonal/normal) if b·c = 0
  • 10. 2D perp Vector Which vector is perpendicular to the 2D vector a = (ax,ay)? Let a = (ax,ay). Then a┴ = (-ay,ax) is the counterclockwise perpendicular to a. a┴ -a┴ a a What about 3D case?
  • 11. Rotation in 2d v v┴ • We want to rotate a 2d vector v counterclockwise by an angle A • First we determine perp(v), v┴ • Then we scale v by cosA and scale v┴ by sinA and take their sum vcosA v┴sinA A vcosA + v┴sinA
  • 12. Rotation in 3d • We want to rotate a 3d vector l counterclockwise with respect to a 3d unit vector r by an angle A, where l and r are perpendicular to each other • First we determine the vector u, that is perpendicular to both l and r and have a length equal to that of l • So, u = r X l • Then we scale l by cosA and scale u by sinA and take their sum lcosA usinA A l r u * note that, this method is applicable only in cases where the axis of rotation and the vector which is to be rotated are perpendicular to each other
  • 13. Rotation in 3d • Example: Rotate (1, -1, 2) with respect to (-1, 3, 2), by 30° • l = (1, -1, 2) • r = (-1, 3, 2) / 12 = (-1/12, 1/4,1/6) • u = l x r = ? • Answer = l cos30° + u sin30° = ? lcosA usinA A l r u
  • 14. Orthogonal Projection v c v┴ • We want to decompose the vector c into two vectors, one along the direction of a unit vector v and another along perp(v) • The length of the orthogonal projection of c along v is c.v (as v is a unit vector) • Thus the component (or orthogonal projection) of c along v is (c.v)v • So the component of c along perp(v) is c-(c.v)v c.v
  • 15. Reflection [13] a n r m -m e e a n r θ θ r = a - 2 ( a . n) n • Here m is the orthogonal projection of a along n • m equals (a.n)n as n is a unit vector
  • 16. Cross Product  Also called vector product.  Defined for 3D vectors only. z y x z y x b b b a a a k j i b a   Properties 1. Antisymmetry: a Χ b = - b Χ a 2. Linearity: (a +c) Χ b = a Χ b + c Χ b 3. Homogeneity: (sa) Χ b = s(a Χ b)
  • 17. Geometric Interpretation of Cross Product axb a b x y z P2 P1 P3 1. aXb is perpendicular to both a and b 2. | aXb | = area of the parallelogram defined by a and b
  • 18. Representing Lines [11][12] Line Ray 2 types of representations: 1. Two point form 2. Parametric representation
  • 19. Parametric Representation of a Line y x t = 1 B P v t = 0 t < 0 t > 1 𝐿 𝑡 = 𝑃 + 𝑡𝒗
  • 20. Planes in 3D  4 fundamental forms  Three-point form  Parametric representation  Point normal form  Equation
  • 21. Parametric Representation of Plane P a b 𝑈 𝑠, 𝑡 = 𝑃 + 𝑠𝒂 + 𝑡𝒃 a and b cannot be parallel
  • 22. Point Normal Form of a Plane B n
  • 23. Representations of Plane [13] Three Point Point Normal Parametric A=(0,0,n.C/ nz) C=(C-0) B=(0,n.C/ ny,0) n = (A-C)x(B – C) {A,C, B} {C, n} {C, a, b}
  • 24. Equation of a Plane [1][2][3][4] • ax + by + cz + d = 0 is the standard equation of a plane in 3d • If sqrt(a^2 + b^2 + c^2) = 1, then it is called the normalized form • In the normalized form, |d| equals the distance of the plane from the origin P = (px, py) p.n Y X L nx ny (x, y) What about distance from an arbitrary point? How to convert between equation and the other forms?
  • 25. Line-Plane Intersection [8] • Plane: ax + by + cz + d = 0 • Line: P + tV • Determine the specific value of t (say t’) for which the equation of the plane is satisfied, i.e., the point on the line lies on the plane Exercise: Find intersection of 𝑥 + 2𝑦 + 3𝑧 + 4 = 0 and 1, 2, 3 + 𝑡(3, 2, 1).
  • 26. Line-Line Intersection [5][6][7] • Four possible cases: • Coincident • Parallel • Not parallel and do not intersect • Not parallel and intersect
  • 27. Line-Line Intersection • L1: P1 + tV1 • L2: P2 + sV2 • Parallel if V1 and V2 are in the same or opposite direction (i.e., the angle between them are 0 degree or 180 degree) • Coincident if they are parallel and have at least one point in common • If they are not parallel, how to decide whether they intersect or not?
  • 28. Line-Line Intersection • If they are not parallel, how to decide whether they intersect or not? • One solution • Generate three equations for two unknowns • Solve the first two equations to find a solution • Check whether the solution satisfies the third equation • Another solution • Check whether (P1 – P2).(V1 X V2) = 0 • If lines intersect this condition must hold • If lines do not intersect, is it sure not to hold?
  • 29. Line-Line Intersection Exercise: Find intersection between 1, 2, 3 + 𝑡(1, 1, 1) and 1, 1, 1 + 𝑠 1, 2, 3 .
  • 30. Plane-Plane Intersection [9][10] • Intersection is a line • So we need two points on the line, or one point and the direction • How to get a point on the intersecting line? • How to get the direction of the intersecting line?
  • 31. Plane-Plane Intersection • How to get a point on the intersecting line? • Imagine another plane not parallel to the intersecting line, for example the plane z = 0 (the XY plane). • Now solve three equations to find their common intersection point
  • 32. Plane-Plane Intersection • How to get the direction of the intersecting line? • Consider the planes in point-normal form • Plane 1: P1, n1 • Plane 2: P2, n2 • n1 and n2 are both perpendicular to the intersecting line • So the direction of the line of intersection is along n1 X n2
  • 33. Plane-Plane Intersection Exercise: Find intersection of 𝑥 + 2𝑦 − 𝑧 = 5 and 𝑥 − 4𝑦 + 𝑧 = 3.
  • 34. Links [1] http://www.songho.ca/math/plane/plane.html [2] http://mathinsight.org/distance_point_plane [3] https://www.youtube.com/watch?v=gw-4wltP5tY [4] https://www.youtube.com/watch?v=7rIFO8hct9g [5] https://www.youtube.com/watch?v=nKVCvY-FW5Q [6] https://www.youtube.com/watch?v=bJ56Xr9081k [7] https://www.youtube.com/watch?v=r5DwyBFxD7Q [8] https://www.youtube.com/watch?v=Td9CZGkqrSg [9] https://www.youtube.com/watch?v=SoSTdgqknvY [10] https://www.youtube.com/watch?v=LpardiBTAvU
  • 35. Links [11] https://www.youtube.com/watch?v=FlLbI7DB0SM [12] https://www.youtube.com/watch?v=nZ2mS5M4fcQ [13] (textbook) Chapter 4, Computer Graphics using OpenGL (2nd edition) by Francis S Hill, Jr.