Is there analytical way to find the distance of a point to its projection on a Logarithmic spiral? If not, how to approximate the distance? - distance

In one of my experiment, I need measure the Euclidean distance from a point to its projection on a Logarithmic spiral. The spiral formula is:
$$x=e^{0.14\theta}cos(\theta)$$
$$y=e^{0.14\theta}sin(\theta)$$
$\theta$ is a sequence of 158 numbers ranging from -19 to -12.7 by step 0.04. There is a point outside spiral. Is there anyway to find the distance from it to its projection on the spiral?

Related

Is there a fast method to calculate the nearest point in a data set under a point-depending distance function

I am searching for a (fast) way to calculate the nearest point y in a dataset to a given point x under a (x,y)-depending distance function.
My distance function has the form: d(x,y) = 1/f(x,y) * |||x-y||^2, where ||x|| denotes the standard Euclidean-norm. The function f(x,y) fulfills all necessary properties such that d(x,y) is a distance measurement i.e. positive, symmetric,...
For a "normal" distance function I could to some transformation on the data itself and use some k-nearest neighbor approaches. But for this case I could not find something useful. Does anyone have an idea?
Right now, I am using Julia for the implementation.
You should be able to use most standard spacial indexes (kd-tree, r-tree, quadtree, and their derivatives) as long as d(x,y) is "convex".
With "convex" I mean that a curve of equidistant points around P is convex. E.g. for Euclidean this is a circle, for Manhatten/Taxi distance it is a square.
This is required because these indexes usually partition the data into squares, rectangles or half-spaces (kd-tree), so they rely on calculating the minimum distance to a group of points by calculating the distance to the corner or sides of a bounding rectangle. As long as your distance function is convex (or at least not concave) then any index of these indexes should work.

How to do manual calculation based on distance transform obtain in MATLAB?

Euclidean is distance transform from a . I am using Euclidean = bwdist(a,'euclidean');
Based on this, may i know how the calculation works? from/to what point MATLAB calculate to get the Euclidean based on MATLAB?
From formula , sqrt[(x2-x1)^2 + (y2-y1)^2], which means we need 2 points. How do MATLAB calculation for each pixel? Thank you
I think the following link explains about the function quite directly.
https://uk.mathworks.com/help/images/ref/bwdist.html
D = bwdist(BW) computes the Euclidean distance transform of the binary image BW. For each pixel in BW, the distance transform assigns a number that is the distance between that pixel and the nearest nonzero pixel of BW.
for your first point a(1,1), the nearest point is a(2,2), so the distance is sqrt(2).
for a(1,2), the nearest non-zero is a(2,2) too, so the distance is sqrt(1) = 1.
for a(2,2), the nearest non-zero is it self, so the distance is sqrt(0) = 0.
Good luck.

Stability of pose estimation using n points

I am using chessboard to estimate translation vector between it and the camera. Firstly, the intrinsic camera parameters are calculated, then translation vector are estimated using n points detected from the chessboard.
I found a very strange phenomenon: the translation vector is accurate and stable when using more points in the chessboard, and such phenomenon is more obvious when the distance is farer. For instance, the square in the chessboard is 1cm*1cm, when the distance is 3m, translation vector is accurately estimated when using 25 points, while it is inaccurate and unstable using the minimal 4 points. However, when the distance is 0.6m, estimation results of translation vector using 4 points and 25 points are similar, which are all accurate.
How to explain this phenomenon (in theory)? what's the relationship between stable estimation result and distance, and number of points?
Thanks.
When you are using a smaller number of points, the calculation of the translation vector is more sensitive to the noise in coordinates of those points. Point coordinates are noisy due to a finite resolution of the camera (among other things). A that noise only increases with distance. So using a larger number of points should provide for a better estimation.

Distance matrix in kilometres from latitude and longitude data in matlab

In matlab, I have a list of 2410 locations given by their latitude and longitude. I want to create a distance matrix in kilometres. I know how to do this in degrees but how do I do this in kilometres? I have the mapping toolbox, using 2016b. Thanks!
For example, my distance matrix in degrees looks like this:
First you need to ask your self what you mean by distance.
Do you want the euclidean distance between the points? Imagine you could tunnel through the earth from one point to the other, this is the euclidean distance between the points. To calculate this distance you need to first convert each of the lat long points to ecef points. You can do this conversion with this code (https://www.mathworks.com/matlabcentral/fileexchange/7942-covert-lat--lon--alt-to-ecef-cartesian). After you've converted each point to an ecef point you can now calculate the euclidean norm https://en.wikipedia.org/wiki/Norm_(mathematics)) between each possible pair of points.
Or do you want to calculate the distance a traveler would traverse if they were to walk along the surface of the earth. From the looks of it, this is a much more difficult problem requiring an iterative solver. Fortunately someone has already done the work of implementing an algorithm to do this for you (https://www.mathworks.com/matlabcentral/fileexchange/5379-geodetic-distance-on-wgs84-earth-ellipsoid). Note if you read the comments of this function it appears as if mathworks has already implemented a different algorithm to perform the same calculation in the mapping toolbox. To calculate the matrix you simply need to iterate over each possible pairing of lat long points and plug them into the vdist function.
Following should calculate the distance matrix for you using the vdist function above. Note I have not tested this code so you may to to correct errors.
points % assuming this is a matrix of your points [2 x N] formatted as follows
% [ lat1 , lat2, ... ]
% [ lon1 , lat2, ... ]
dist = zeros(N,N); % the resulting distance matrix
for(idx1 = 1:N)
for(idx2 = 1:N)
dist(idx1,idx2) = vdist(points(1,idx1),points(2,idx1),points(1,idx2)points(2,idx2) );
end
end
Note because the earth surface is manifold (https://en.wikipedia.org/wiki/Manifold) the results will be similar if the points are close to each other. If speed is important to you and the points are closely grouped, you may want to use the first method to calculate your distance matrix. How close together the points should be to make use of this approximation will depend on how accurate you need the results to be.

MATLAB Genetic Algorithm : Distance of separation between solution points

I need to optimize the location of 10 Transmitters and 10 Receivers (modeled as points on an aperture plane) so as to minimize a certain objective scalar using Genetic Algorithm toolbox in MATLAB. My question is: I have (10+10)*2 = 40 variables (optimizing x and y positions of each point). How do I model the constraints in the form Ax <= b, such that each point is separated by a minimum distance in both x and y directions from all other points?
I'd model the objective function as the euclidian distance between the points, which you are trying to minimize. Also the transmitters and receivers must have a minimum distance between them. So this distance should be minimum, but greater than the minimum distance of the equipment. I'd look into the dimensions of the plane to identify all the constraints.