Magnitude of a Vector

Download Report

Transcript Magnitude of a Vector

Magnitude of a Vector

• The magnitude of a vector, denoted as |a|, is defined as the square root of the sum of the squares of its components:

|a| = (x 2 + y 2 ) ½ .

if a = (1, 2), its magnitude |a| = (1+4) ½ = 5 ½ .

• The distance between any two points p(x 1 ,y 1 ) and q(x 2 ,y 2 ) in a plane is equal to the magnitude of a vector connecting p and q.

|p-q| = [(x 1 -x 2 ) 2 + (y 1 -y 2 ) 2 ] ½ .

Addition of Two Vectors

8 6 4 2 (0,0) (14, 8) (6, 6) b 2 4 6 a c (8, 2) c = a + b = (8+6, 2+6) 8 10 12 14 16

Subtraction of Two Vectors

8 6 4 2 (0,0) (6, 6) b c (2, -4) c = (a – b) = (8-6, 2-6) (8, 2) a 2 4 6 8 10 12 14 16

Scalar Multiplication of a Vector

h = 2 8 6 4 2 a = (6, 4) ha = (12, 8) (0,0) 2 4 6 8 10 12 14 16

Normal Vector

A normal vector has a magnitude equal to one. Any vector a = (x, y) can be normalized as

a ’ = (x’, y’) ,

by dividing its respective components by its magnitude:  

x

y

       

x

|

a

|

y

|

a

|    

Inner Product of Two Vectors

Inner product of two vectors is defined as the sum of the product of the respective components of the two vectors having the same number of components.

if a = (x 1 , y 1 ) and b = (x 2 , y 2 ), the inner product a ·b = x 1 x 2 + y 1 y 2

Inner Product of Two Vectors

The inner product of two vectors is also directly related to the angle between them, denoted by:

a · b = |a| |b| cosθ

The cosine of the angle between two vectors is found by:

cos θ= a · b / |a| |b|

Matrix

A matrix is a rectangular array of numbers (referred to as elements) arranged in rows and columns.

A = a

11

a

21

a

12

a

22

Addition of Two Matrices

If two matrices have the same number of rows and columns, they can be added: A =

4 5 2 3 1 2

and B =

3 6 0 3 2 2

A + B =

7 11 2 6 3 4

Product of Two Matrices

• • • The product

AB

of two matrices

A

and

B

is defined if and only if the number of columns in

A

is equal to the number of rows in

B .

If

A

is an

m

x

p

matrix and

B

the resulting matrix

C

is an

m

is a

p

x

n

x

n

matrix, matrix. Each element of

AB

is defined as the inner product of the ith row of

A

and the jth column of

B

: c

ij

= a

i1

b

1j

+a

i2

b

2j

+ ... + a

ip

b

pj

If

A

=

Product of Two Matrices

4 5 2 3 1 2 ,

B

= 3 0 2 6 3 2 (4) (3) + (5) (6) (4) (0) + (5) (3) (4) (2) + (5) (2) then

AB

= (2) (3) + (3) (6) (2) (0) + (3) (3) (2) (2) + (3) (2) (1) (3) + (2) (6) (1) (0) + (2) (3) (1) (2) + (2) (2) = 42 15 18 24 9 10 15 6 6

Some Important Matrices (1)

• • • • The

zero matrix

is any matrix whose elements are all zeroes A

square matrix

is any matrix having as many rows as columns The

identity matrix

, denoted as

I

, is defined as a square matrix whose diagonal elements are all ones and all other elements are zeroes Important properties of an identity matrix:

IA

=

AI

=

A

Some Important Matrices (2)

• • • The

transposed matrix

of a matrix

A

, denoted as

A T

, is formed by interchanging the rows and columns of

A

such that row i of A becomes column i of

A T

of

A T

and column j of

A

becomes row j The

symmetric matrix

whose elements

S T

=

S

s

ij

S is a square matrix = s

ji

. For symmetric matrix S , The

reciprocal matrix

of a square matrix

A

, denoted as

A -1 ,

is defined by its unique property:

AA -1

=

I

Determinant(

行列式

) of a Square Matrix

• Determinant is a scalar associated with a square matrix • Let

C

=

x1 x2 y1 y2

The determinant of

C

, denoted as |

C

|, is ascertained as: |

C

| = (x

1

y

2

– x

2

y

1

)

Usages of the Determinant

8 6 4 2 (0,0)

(14, 8) a = (4, 6)

| C |

b = (10, 2) C = a, b = 4 10 6 2

2 4 6 8 10 12 14 16

Homogeneous Coordinates

• • • Homogeneous coordinates are the extension of Cartesian coordinates from any dimension into the next higher dimension The homogeneous representation of a 2-D point (x, y) is (hx, hy, h), where h is any non-zero scalar When h = 1, the homogeneous coordinate of 2 D point (x, y) is (x, y, 1)

Translation (1)

Translation is used to offset the origin of the coordinate system in order to describe the positional changes of a point (x, y). Suppose that T x and T y are increments on the X-axis and Y-axis of the new position of a point (x, y), then the new coordinates: x‘ = x + T x y‘ = y + T y

Translation (2)

( x' y' 1 ) = ( x y 1)

T y y Y' Y y (x', y') (x, y) T x (0, 0) x (0, 0) x' X' X

1 0 0 0 1 0 T x T y 1 = (x + T x y + T y 1)

Rotation of the Coordinate System (1)

The rotation transformation is used to

rotate the original coordinate system

about the origin by some angle θ measured in the

counter-clockwise

direction from the X-axis • The rotation tranformations are defined as: x’ = x cosθ + y sinθ y’ = -x sinθ + y cosθ

Rotation of the Coordinate System (2) (x’ y’ 1) = (x y 1) Y cosθ sinθ -sinθ cosθ 0 0 0 0 1 y (x, y) θ x X

-30

Rotation of the Symboles

x’ = x cosθ – y sinθ y’ = x sinθ + y cosθ Y 40 30 A T r

=

cos θ sinθ 0 -sin θ cosθ 0 0 0 1 θ 20 B 10 C (x’ y’ 1) = (x y 1) T r X -20 -10 0 10 20 30

Scaling (1)

x ’ = S x · x y’ = S y · y H E Y G 40 H’ F G’ E’ F’ 30 20 B 10 A A’ B’ C C’ -30 -20 -10 0 10 20 30 40 X

Y

Scaling (2)

x’ = S x · x y’ = S y · y Y S x = 0.5

S y = 1 X X

Concatenation of Point Transformation (1)

Very often it is necessary to perform a sequence of point transformations known as

concatenation.

The matrix form of point transformation facilitates this process, because a series of transformations can be multiplied in order and stored in a single matrix that represents the whole transformation.

Concatenation of Point Transformation (2)

The sequence is important!

Given a translation matrix T, and a scaling matrix S, a new point p ’ = p·T·S. It is not necessarily equal to p ·S·T.

Concatenation of Point Transformation (3)

The concatenated matrix C = T ·S is defined as:

1 0 0 0 1 0 T x T y 1 Sx 0 0 0 Sy 0 0 0 1 = Sx 0 0 0 Sy 0 TxSx TySy 1

The concatenated matrix C = S ·T is defined as:

Sx 0 0 0 Sy 0 0 0 1 1 0 0 0 1 0 T x T y 1 = Sx 0 0 0 Sy 0 Tx Ty 1

The Representation of a Straight Line Y Ax + By + C = 0 A B C (x y 1) = 0 q (x 2 , y 2 ) y = mx + b; Where m = (-A / B) b = (-C/B) m (-C/A) b p (x 1 , y 1 ) X

A B C A B C

Direction of a Line Segment

= y 1 – y 2 x 2 – x 1 y 2 x 1 – y 1 x 2 Y | C | p = y 2 – y 1 x 1 – x 2 y 1 x 2 – y 2 x 1 v q (0, 0) Ax + By + C = 0 X

Point-Vector Form

• • The two endpoints of a line segments can also define the straight line passing from p to q in a point-vector form: L = { (x1, y1) + h (x2 – x1, y2 –y1)

|

h ∊ R } The point-vector form preserves the direction of the line segment between p and q, and for any point lying on the line segment between p an q, the value of h will be in the closed interval [0, 1].

For example if h = 0.5, then the point lies at the middle of the line segment.

Normalized Straight Line

• A straight line L, is normalized by dividing its respective parameters by the magnitude of the vector between p and q, (A 2 +B 2 ) ½

A’ B’ C’ = A / (A 2 + B 2 ) ½ B / (A 2 + B 2 ) ½ C /

(A 2 + B 2 ) ½ p’

q’

Questions for Review (1)

• •

If two points p (1, 2) and q (4, 1) are given, what is the magnitude of the vector v starting from the point p and ending at the point q?

If vector a = (1, 2), b = (4, 3), what is (a + b)? What is (a – b)? What is the angle between these two vectors?

Questions for Review (2)

Suppose A

=

4 5 2 3 1 2 B

=

3 0 2 6 3 2 What is the product of AB? Does the product BA exist? If it exists, what is BA?

What do the point transforming matrices look like for translation of a point, rotation of the point of the symbol, and scaling the symbol?

Questions for Review (3)

Why is the concatenation of the matrices for point transformation important? What are the advantages of the concatenation?

Why can one say that it is important to study the point and line relationships in digital cartography? ****(

Many cartographic functions utilize point and line relationships

)