How can I calculate the latitude-longitude of a place, when the latitude-longitude information of its 3 nearby places, and the distances to the place are given?
E.g, A,B and C are three places with latitude-longitude (x1,y1), (x2,y2) and (x3,y3). Let D be at distance k1, k2 and k3-km from A, B and C respectively. How can one determine the latitude-longitude of D.
In case, all these points, A,B,C and D are on a plane, then this can be calculated, by determining the point of intersection of the three circles, from A, B and C with radius k1, k2 and k3, respectively. However, how to determine the position, when the points are on a sphere and not on a circle?
Starting with a plane, here is an alternative method to your suggested 3 circles:
Since you know the coordinates of A,B and C, you can calculate the length of AB,AC and BC.
Lets mark by X the point point we want to find.
we know that AX=k1, BX=k2 and CX=k3
Now draw the 3 triangles: ABX, ACX, EDX. We know the length of all their edges, therefore we can calculate the angles.
Knowing all coordinates, lengths and angles we can calculate the coordinates of X.
For a sphere- almost the same idea can be used. However:
Coordinates should be in Lat/Lon radians
Distances should be calculated using great circle distance formula. See Aviation Formulary.
Total angles in a triangle is not 180 - It is between 180 and 540.
Knowing the edges lenghts, angles can be calculated using the spherical law of cosines
Now, coordinates of X can be calculated.
It takes some time to get used to working with spherical trigonometry, however this is the right tool for such problems.
I'll assume k1, k2, k3 are distances on the sphere.
You may be able to solve this most precisely by using a special case of the Vincenty formula. With your three sets of values for x, y, and k, you can set up a system of equations to solve for the latitude and longitude of the fourth point. Solving this system would probably be extremely tricky due to its complexity, but there may be computational tools that could perform such a solve.
Related
Q)A box contains 4 red balls, 3 green balls and 3 blue balls. Two balls are selected at
random without replacement. Let X represent the number of red balls in the sample and
Y the number of green balls in the sample.
a) Arrange the different pairs of values of (X, Y ) as the cells in a table, each cell being
filled with the probability of that pair of values occurring, i.e. provide the joint
probability distribution.
b) What does the random variable Z = 2 - X - Y represent?
c) Calculate Cov(X, Y ).
d) Calculate P(X = 1 | -2 < X - Y < 2).
I couldn't understand how to think to solve the part a) in this question and so on.
To solving this question first of all you have to create a tree with this two events. First data in this question is that we can take is , these are not independent event. so you can create tree like this,
In first part you have to create the joint table of X and Y.
there is 0,1,2 are the only possible values that each variable can get.
The critical situations are that X-1 , Y-0 and X-0 , Y-1 .Because they got two possible chances in same situation that one color ball take first and that same color ball select the second time.
So this is the table that can get according to this tree.
part b represent the blue balls in selected sample
from Wikipedia,
A linear DDA starts by calculating the smaller of dy or dx for a unit increment of the other. A line is then sampled at unit intervals in one coordinate and corresponding integer values nearest the line path are determined for the other coordinate.
Considering a line with a positive slope, if the slope is less than or equal to 1, we sample at unit x intervals (dx=1) [...]
For lines with a slope greater than 1, we reverse the role of x and y i.e. we sample at dy=1 [...]
Similar calculations are carried out to determine pixel positions along a line with a negative slope
How does the slope (positive or negative) affect the algorithm?
why is the gradient being less or equal to 1 important?
If your gradient is negative (in one of the dimensions) and you walk along that direction with unit increments, you have to adapt your loop to count backwards.
If you walk along the wrong dimension (with unit increments), you will end up with gaps on the line. E.g., if you have slope 2 and you walk along the x-direction, only every second row will contain a pixel.
I don't know if this question makes sense, but is there a formulaic way to calculate the height of a chord from a circle's edge in one of the circles from 3 tangent circles?
I have included a diagram to provide detail. Circles C1, C2 and C3 are connected at tangents and have equal radii (in this case 1 mm, but that is only for depiction). Triangle ABC is formed by connecting the centers of these circles. Line LM meets sides AB and AC and is tangential to Circle C1. Line PQ cuts through Circle C1 and triangle ABC and is tangential to both circles C2 and C3.
Diagram for question
What is the formula for the distance (x) between lines LM and PQ?
Given that the radii are equal (say, r), the total height of these 3 circles (line RS shown in diagram, which is my objective to calculate) is 4 times the radius minus the distance (x) between lines LM and PQ. In other words,
|RS| = {(4*r) - x}
variable x needs to be converted into a formula based exclusively on radius r so as to solve this equation.
It has been a while since I revisited my high school geometry lessons, so I hope this can be solved.
Distance A-LM is equal to r (circle center - tangent)
Distance BC-PQ is equal to r
If we add these distances and subtract distance PQ-LM (x), we'll get height of equilateral triangle ABC (with edge 2*r)
r + r - x = height of ABC = 2 * r * sqrt(3)/ 2
x = r * (2 - sqrt(3))
I've got a big number of nodes (lon,lat) in WGS-84 and I need to draw them on a Pixmap, so I have read a lot of Q&A here, but haven't found the algorithm how to convert lon/lat from WGS-84 to a x/y coordinates. By the way, I need to draw a simple scheme of map. Any ideas?
To go from WGS-84 latitude and longitude to an two-dimensional map, you first need to consider what kind of projection you have. This is because one minute of arc, for example, could mean different distance changes over a particular projection. You're mapping an ellipsoid to a plane, so you're going to get some distortion somewhere.
But for a simple case, let's say that your area is small enough, and close enough to the equator, that the change in angle (latitude or longitude) corresponds to a constant change in distance on the map (Y or X).
So, if you have a 600*600 image of a particular area, and it corresponds to a 10-minute by 10-minute area of the earth that has an upper-left corner at 30 degrees north, 40 degrees west.
To locate the pixel where 29 degrees, 55 minutes north, 39 degrees, 57 minutes west, we use a proportion for both latitude and longitude:
5' / 10' = Y / 600 pixels ---> Y = 300 (from the top edge)
3' / 10' = X / 600 pixels ---> X = 180 (from the left edge)
Hope that helps.
Suppose 5 samples of hue are taken using a simple HSV model for color, having values 355, 5, 5, 5, 5, all a hue of red and "next" to each other as far as perception is concerned. But the simple average is 75 which is far away from 0 or 360, close to a yellow-green.
What is a better way to calculate this mean and associated std?
The simple solution is to convert those angles to a set of vectors, from polar coordinates into cartesian coordinates.
Since you are working with colors, think of this as a conversion into the (a*,b*) plane. Then take the mean of those coordinates, and then revert back into polar form again. Done in matlab,
theta = [355,5,5,5,5];
x = cosd(theta); % cosine in terms of degrees
y = sind(theta); % sine with a degree argument
Now, take the mean of x and y, compute the angle, then
convert back from radians to degrees.
meanangle = atan2(mean(y),mean(x))*180/pi
meanangle =
3.0049
Of course, this solution is valid only for the mean angle. As you can see, it yields a consistent result with the mean of the angles directly, where I recognize that 355 degrees really wraps to -5 degrees.
mean([-5 5 5 5 5])
ans =
3
To compute the standard deviation, it is simplest to do it as
std([-5 5 5 5 5])
ans =
4.4721
Yes, that requires me to do the wrap explicitly.
I think the method proposed by user85109 is a good way to compute the mean, but not the standard deviation:
imagine to have three angles: 180, 180, 181
the mean would be correctly computed, as a number aproximately equal to 180
but from [180,180,-179] you would compute a high variance when in fact it is near zero
At first glance, I would compute separately the means and variances for the half positive angles , [0 to 180] and fot the negative ones [0,-180] and later I would compute the combined variance
https://www.emathzone.com/tutorials/basic-statistics/combined-variance.html
taking into account that the global mean and the difference between it and the local means has to be computed in both directions: clockwise and counterclockwise, and the the correct one has to be chosen.