开发者

Probability of intersection of two users with horizontal accuracy and vision area

开发者 https://www.devze.com 2023-03-25 09:40 出处:网络
I\'m receiving data from GPS and store them in MySQL database. I have following columns: User ID (int)

I'm receiving data from GPS and store them in MySQL database. I have following columns:

User ID (int)
Latitude (double)
Longitude (double)
Horizo开发者_如何学JAVAntal Accuracy (double)

Horizontal accuracy is radius around Lat/Long, so my user with equivalent probability can be in any point of this area.

I need to find out probability that two users was intersecting. But I also have vision area, which is 30 meters. If horizontal accuracy would be 0 I could just measure area of intersection of two circles that have radius of 30 meters around lat/long. But in my case that's not possible because horizontal accuracy could be in range from 5 to 3000. Usually it's more than my vision area.

I think I can measure area of intersection of two cones where inner circle of this cone will have radius of horizontal accuracy + 30 meters and outer circle will have radius of horizontal accuracy. But this solution seems to be little bit complicated.

I want to hear some thoughts about that and other possible solution.

I've checked MySQL Spatial extension and as far I can see it can't do such calculations for me.

Thanks.


I worked on just such a problem as you are describing. How I approached it was to convert the Lat/Long (world coordinates) into X/Y (Cartesian coordinates) then I applied the Pythagorean Theorem a^2 + b^2 = c^2 to solve the problem.

First you need to convert the Lat/Long Coordinates.

To get X you Multiply the Radius by the cosine (cos) of the angle (NOTE: this angle has to be expressed as radians).

To get Y you do the same as above but use the sine function (sin).

To convert degrees to radials Multiply the angle by the quantity of PI (Approx. 3.14159...) / 180.

Radians = Angle * (PI / 180);

To solve for the c^2 "C Squared" c = SQRT (a*a + b*b);

For more information on Degrees to Radians: http://www.mathwarehouse.com/trigonometry/radians/convert-degee-to-radians.php

For more information on: Converting Lat/Long to X/Y coordinates: http://www.mathsisfun.com/polar-cartesian-coordinates.html

I usually find the information that I need for this kind of problem by asking a question on ask.com.

All the best.

Allan

0

精彩评论

暂无评论...
验证码 换一张
取 消