Y
Y
ywitodenasuby2019-09-06 00:24:16
Android
ywitodenasuby, 2019-09-06 00:24:16

How to draw a direction?

I have my coordinates and the coordinates of the building. It is necessary that I walk along the street and an arrow is drawn in the activity in the direction to this building. How to do it?
CompassApp.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
X
xmoonlight, 2019-09-06
@xmoonlight

The question will be deleted, and advice to you: all such tasks are for freelance.
If something doesn't work out, give your code examples in the text of the question so that your work can be seen.
All the best!

J
jcmvbkbc, 2019-09-06
@jcmvbkbc

I have my coordinates and the coordinates of the building. It is necessary that I walk along the street and an arrow is drawn in the activity in the direction to this building.

Obviously, the data presented is not enough. You also need to know how the phone is oriented in the coordinate system of you and the building. Those. conditionally, unit vectors directed up and to the right on the screen. Judging by the picture, it is proposed to assume that the phone is facing north. Well, you can.
Subtracting your coordinates from the coordinates of the building you will get a vector directed from yourself to the building. Normalizing it to one and taking the projections of this vector onto the "up" and "right" vectors, you will get the coordinates of the direction vector on the screen.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question