A
A
amidaniram2014-06-28 17:03:28
satellite navigation
amidaniram, 2014-06-28 17:03:28

How can I tell if I'm facing the object?

I am writing an android app for learning purposes. The point is this.
We have a real object, we know its coordinates (longitude, latitude).
We know our coordinates (GPS same).
It is necessary to determine whether I am turned towards the object and if the object is in the visibility zone - display a message.
I'm doing it in Unity3D. But you can link to Java code or a purely mathematical explanation.
I do not know how to determine where we are turned. The phone has a compass. I can find out the degree between the north pole and the direction I'm looking. (Like he answered his own question?)
But still, I don’t understand the essence of the question. How do I know if I'm looking at an object or not.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
Vladimir Abramov, 2014-06-28
@amidaniram

>How to understand, I'm looking at an object
This is the most difficult thing to understand what it means you are looking at an object. Is it strange to ask a question without understanding its essence?
The magnetic sensor gives 3 angular coordinates relative to the axes of the device. Everything seemed to be fine? Everything is simple and clear as long as the device lies exactly on a horizontal surface. One of the coordinates is the azimuth (clockwise rotation relative to the server). Radin, if I'm not mistaken. Then everything is just mathematics, grade 9, etc.
But the fun begins when you take the device in your hands - it will rotate about 3 axes at once. Let me remind you that the magnetic sensor will take readings relative to the axes of the device. Those. then you will have to take readings from the accelerometer to determine the orientation of the device. Not grade 9, but you can estimate the transformation matrix. But here's the gag, which means you're looking in the right direction? What coordinate system should it be converted to? How to formalize that the paralipid is looking at something?
Draw this on a piece of paper. with all axles. Then read this developer.android.com/guide/topics/sensors/sensors...and sub-articles. Maybe the Orientation Sensor or some of the built-in ones will suit you. Or you may have to have the aforementioned sex with a magnetic and acceleration sensor (note that it will also respond to movements, and you have to wait until it resets).
But the main thing is the essence of the question - what does it mean the device looks at the object.

V
Vitaly Zheltyakov, 2014-06-28
@VitaZheltyakov

Mathematical explanation:
- You must, firstly, use the concept of the direction of view, determined by the angle in your coordinate system.
Secondly, knowing your coordinates and the coordinates of the target, you need to find the segments of the projections on the axis between yourself and the target (the difference in coordinates along the axes). These segments determine the direction to the target.
Knowing the segments of the projections, using the tangent or cotangent to them (depending on what is convenient for you), you can get the angle to the target in your coordinate system.
Further, everything is simple - we compare the angle of the direction of view and the angle to the target and draw conclusions.
Geometry - Grade 9...

3
386DX, 2014-06-28
@386DX

Draw a line between you and the object.
Draw a segment between you and north.
Measure the angle.
Measure the angle on the compass. If the corners match, then they are rotated.
Correct for the accelerometer if the phone is not horizontal.
IMHO

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question