CS) Informative
Maps on PDA-phones Chui Pui Ling Page 37
Translate
Rotate
There are several methods for determining a point is on the left or right direction of 2 points. The information is useful for noticing users with the direction that they should walk to. Obviously, consideration of different comparison cases for
the coordinates is a method, yet there are some mathematical methods which are more accurate can be applied.
Matrix Transformation Y-
A
xi s
X-Axis
P3 (x3,y3)
P3'
P3"
P1 (x1,y1)
P1"
P2'
P2"
P2 (x2,y2)
translation
rotationStep 1 PP, PP, PP with Pat the origin Step 2 PP, PP, PP with Plies on x-axis x cos -sin x
=
[22] y sin cosy Step 3 Case (x-coordinate of P) * (y-coordinate of P) < 0
Ö
P1, P2, P3 are collinear
CS) Informative Maps on PDA-phones
Chui Pui Ling Page 38 Case (x-coordinate of P) * (y-coordinate of P) < 0
Ö
P3 lies on the left plane of P1P2
Case3: (x-coordinate of P2”) * (y-coordinate of P3”) > 0 Plies on the right plane of PP
Triangle Geometry P2 (x2,y2)
P1 (x1,y1)
P3 (x3,y3)
Y-A
xis
X-Axis
Area of triangle ΔP1P2P3 = 1/2 *
[23]
= 1/2 * (x1*y2 + x2*y3 + x3*y1 – x2*y1 – x3*y2 - x1*y3) Case Area = 0 PP, Pare collinear Case 2: Area > 0 PP, Pare arranged in anticlockwise direction Plies on the left plane of PP Case Area < 0
P1, P2, P3 are arranged
in clockwise direction Ö
P3 lies on the right plane of P1P2 x1 y1 x2 y2 x3 y3 x1 y1
CS) Informative Maps on PDA-phones
Chui Pui Ling Page 39 Since it is easier to do the calculation for
the triangle geometry method, it is applied in the project. However, coordinates is of HK Grid 80 format which is of a large number, multiplication may cause overflow. To prevent overflow and
faster the calculation process, the coordinates are divided by a constant before the calculation.
CS) Informative Maps on PDA-phones
Chui Pui Ling Page 40
Share with your friends: