Mathematic way to know 50 km around an specific coordinate - math

I'm investigating about the best way to know what coordinates are around an specific coordinate.
I mean:
If am in the coordinate:
#29.817178,-95.4012915
How I can know if the coordinate: #30.00121, -93.13213 has 50km (or less) of my actual position?

You should use the Haversine formula, a good explanation can be found here with a javascript example.

Since you're dealing with latitude and longitude, you need to calculate the great circle distance between your two points.
The formula is a bit detailed so I won't reproduce it here, but it's explained in the above linked Wikipedia article.

Related

Suggested package/function to compute the vertices of a 3-simplex (tetrahedron)

I'd like to draw the 3-simplex which encloses some random points in 3D. So for example:
pts <- rnorm(30)
pts <- matrix(pts, ncol = 3)
With these points, I'd like to compute the vertices of the 3-simplex (irregular tetrahedron) that just encloses these points. Can someone suggest a package/function that will do this? All manner of searching for simplex-related material is dominated by answers that relate to using simplices for other purposes, of which there are many. I just want to compute one and draw it. Seems simple, but I don't seem to know the relevant keywords for what I need.
If nobody can find a suitable package for this, you'll have to settle for doing it yourself, which isn't so difficult if you don't require it to be the absolute tightest fit. See this question over at mathexchange.
The simplest approach presented in this question seems to me to be translating the origin so that all points lie in the positive orthant (i.e, all point dimensions are positive) and then projecting the points to lie within the simplex denoted by each unit vector. To get this simplex in your original coordinate system you can take the inverse projection and inverse translation of the points in this simplex.
Another approach suggested there is to find the enveloping sphere (which you can for instance use Ritter's algorithm for), and then find an enveloping simplex of the sphere, which might be an easier task depending what you are most comfortable with.
I think you're looking for convhulln in the geometry package, but I'm no expert, so maybe that isn't quite what you are looking for.

How to get the nearest X points from point with latitude and longitude?

I have a list of points with latitude and longitude coordinates, from which I want to enter a point say X. I need help coming up with an algorithm to determine the closest 3 list members to that point x.
You'll probably have to use the Haversine Formula. It calculates Great Circle distance between two points on the Earth's surface. Here's a good article explaining that, and here's an answer to a question similar to yours. Hope that helps!
See the method computeDistanceBetween() in the google.maps.geometry.spherical namespace:
https://developers.google.com/maps/documentation/javascript/reference#spherical
Then, here's an old V2 demo that uses Array.sort():
http://maps.forum.nu/gm_array_sort.html
You could combine the two, implementing
computeDistanceBetween() instead of compareDistance() as the sorting function.
Note that this is all done client side.

cross ratio - what to do with the received factor?

I have read a lot about projective geometry and cross ratio, but I donĀ“t get a clue. Here is the problem:
I have four aligned points in a projective coordinate system: a, b, c, d
Something like this: a-------b--c------------d
The cross ratio should now be:
crossRatio = dst(ac)/dst(bc) / dst(ad)/dst(bd)
dst(ac) means the distance from point a to point c.
The result is e.g.: crossRatio=3,25.
I also have the length of dst(bc)=30cm in the real world. But since the points lie on a projective plane (see http://en.wikipedia.org/wiki/Cross-ratio) I think I cannot determine the lengths of all the distances just like that.
So what does this cross ratio mean and how can I use it for measurements of lengths in projective geometry?I just get no picture how it all works together.
Edit: I rewrote the question (because of a downvote before. And please next time tell me WHAT is wrong and can be improved). Sorry for unclear description, I hope it is a bit better now.
I posted the question in math.stackexchange in a bit different way and.... found out the answer my self after a decent amount of time. Look here, if interested.
answer

Calculate area of a object in cartesian plane

I wonder if someone can help me to find the area of a 2-D object in Cartesian plane , when we know coordinates of every points.
Eg : I want to calculate the area of a triangular. A(12,34) B(45,89) C(25,35)
I want a common algorithm to find any 2-D object's area.
Thank you.
Here you go, uses triangulation. This was literally the top result off Google when I searched "area of polygon given set of points". Please do your research before posting.
If your object is a simple polygon, there's no need to triangulate it to compute its area. There's a simple formula that depends only on the coordinates of the vertices. See http://en.wikipedia.org/wiki/Polygon#Area_and_centroid

Determine the centroid of multiple points

I'm writing a mapping application that I am writing in python and I need to get the lat/lon centroid of N points.
Say I have two locations
a.lat = 101
a.lon = 230
b.lat = 146
b.lon = 200
Getting the center of two points is fairly easy using a euclidean formula. I would like
to be able to do it for more then two points.
Fundamentally I'm looking to do something like http://a.placebetween.us/ where one can enter multiple addresses and find a the spot that is equidistant for everyone.
Have a look at the pdf document linked below. It explains how to apply the plane figure algorithm that Bill the Lizard mentions, but on the surface of a sphere.
poster thumbnail and some details http://img51.imageshack.us/img51/4093/centroidspostersummary.jpg
Source: http://www.jennessent.com/arcgis/shapes_poster.htm
There is also a 25 MB full-size PDF available for download.
Credit goes to mixdev for finding the link to the original source, and of course to Jenness Enterprises for making the information available. Note: I am in no way affiliated with the author of this material.
Adding to Andrew Rollings' answer.
You will also need to make sure that if you have points on either side of the 0/360 longitude line that you are measuring in the "right direction"
Is the center of (0,359) and (0, 1) at (0,0) or (0,180)?
If you are averaging angles and have to deal with them crossing the 0/360 then it is safer to sum the sin and cos of each value and then Average = atan2(sum of sines,sum of cosines)
(be careful of the argument order in your atan2 function)
The math is pretty simple if the points form a plane figure. There's no guarantee, however, that a set of latitudes and longitudes are that simple, so it may first be necessary to find the convex hull of the points.
EDIT: As eJames points out, you have to make corrections for the surface of a sphere. My fault for assuming (without thinking) that this was understood. +1 to him.
The below PDF has a bit more detail than the poster from Jenness Enterprises. It also handles conversion in both directions and for a spheroid (such as the Earth) rather than a perfect sphere.
Converting between 3-D Cartesian and ellipsoidal latitude, longitude and height coordinates
Separately average the latitudes and longitudes.

Resources