Distance Metric different units - geometry

I am trying to cluster a radar database. The observations of a radar are given in Azimuth angle and range. For processing speed reasons I do not want to transform this polar data into a Cartesian system.
A normal Euclidean distance metric needs the same unit in x- and y-direction. I need to find the distance in azimuth direction and in range direction. Basically, you can imagine the Euclidean distance metric working in a circle and my solution should work in an ellipse.
A simple solution to the problem is in the attached image the red example.
Sketech of ellipse radius
I take from a centre point the distance in both directions.
I am searching for a solution that is more advanced like the blue example where I have all the points in an elliptical search.
EDIT:
I asked the same question a bit different formulated in the mathematics forum, maybe that helps you to understand my problem better. https://math.stackexchange.com/questions/3635438/epsilon-neighbourhood-for-polar-data

Related

Accurate direct distance between two points (latitude, longitude, and altitude)

First of all, thanks for reading. I have Vincenty working in Excel(VBA) already, and want to do this in Excel, but this is a math question, not a coding question. By the way, I'll readily cop up front to the fact that ellipsoids are way over my head.
I'm looking to calculate accurate direct distance between two objects, given their latitude, longitude and altitude. Vincenty was an interesting start, but two issues:
(a) Vincenty is the distance along the ellipsoid, and I would need the chord length.
(b) Vincenty doesn't account for elevation, and the distance between points increases as elevation increases.
It would be easy to take Vincenty as my horizontal distance, and use the elevation difference to solve for the slope, but that doesn't seem accurate.
Maybe this should just be solving for the line between points on concentric circles (i.e. the lower elevation versus the higher elevation) except what Earth radius to use? I mean, it's an ellipsoid, so...?
My distances will typically be 10 - 40 miles, but millimeter precision is required.
Point me in the right direction? Thanks! ~Mike

Compute points at a given geodesic distance on a mesh

Repeating this question for better visibility. I have a triangular mesh (assume a manifold mesh). I want to sample corners of a square on a mesh that is independent of the triangulation.
I am following these steps
Sample a triangle (based on the areas of the triangles)
Sample a point uniformly on the triangle/face
Sample a pair of random perpendicular directions
I want to calculate the distance of three other corners of the square given an edge length. Since the corners can be on any other face, the output should be of the format (Face, barycentric coordinates on that face).
I am looking at libraries such as Polyscope or pygeodesic that use the heat method to compute the geodesic distance between two vertices of the mesh, but I am not sure how to get points at an arbitrary geodesic distance from another point.

How to calculate what percentage of a pixel is within the bounds of a shape

I have a 2d grid where pixel centers are at the intersection of two half-grid lines, as shown below.
I also have a shape that is drawn on this grid. In my case the shape is a glyph, and is described by segments. Each segment has a start point, end point and a number of off-curve points. These segments can be quadratic curves or lines. What's important is that I can know the points and functions that make up the outline of the shape.
The rule for deciding which pixels should be turned on is simple: if the center of the pixel falls within the shape outline, turn that pixel on. The following image shows an example of applying this rule.
Now the problem I'm facing has to do with anti aliasing. What I'd like to do is to calculate what percentage of the area of a given pixel falls within the outline. As an example, in the image above, I've drawn a red square around a pixel that would be about 15% inside the shape.
The purpose of this would be so that I can then turn that pixel on only by 15% and thus get some cleaner edges for the final raster image.
While I was able to find algorithms for determining if a given point falls within a polygon (ray casting), I wasn't able to find anything about this type of problem.
Can someone can point me toward some algorithms to achieve this? Also let me know if I'm going about this problem in the wrong way!
This sounds like an X, Y problem.
You are asking for a way to calculate the perecentage of pixel coverage, but based on your question, it sounds that what you want to do is anti alias a polygon.
If you are working only with single color 2D shapes (i.e red, blue, magenta... squares, lines, curves...) A very simple solution is to create your image and blur the result afterwards.
This will automatically give you a smooth outline and is simple to implement in many languages.

Determine if square cell is inside polygon

For instance, I want the grid cells (squares) inside or partially inside polygon #14 to be associated with #14. Is there an algorithm that will compute if a square is inside a polygon efficiently?
I have the coordinates of the edges that make up the polygon.
If I get it right, this is an implementation of Fortune's algorithm in JavaScript, that takes a set of 2-d points (called sites) and returns a structure containing data for a Voronoi diagram computed for this points. It returns polygons in a list called cells. It seems to use Euclidean distance as measurement. If it's true we know that polygons are always convex (see Formal definition section in Voronoi wiki page).
Now, these are options to solve this problem (hard to simple):
1. Polygon Clipping:
Form a polygon for the square.
Find its intersection with all cells.
Calculate area of this intersections.
Find the largest intersection.
2- Point in Polygon:
You also can simply find the cell that center of the square lies inside it. Ray casting is a robust PIP algorithm. Although there's a simpler approach for convex polygons (see Convex Polygons section here).
3. Distance Between Points:
I if you know the site associated to each cell then you just need to calculate distance between center of square to all sites. Regardless of what distance measurement you use to compute the Voronoi, the center point of square lie inside the cell that distance of it's associated site is minimum, since this is actually the idea for partitioning the plane in a Voronoi diagram.
Exceptions:
First approach is computationally expensive but most accurate. Second and third options work fine in most cases, however, there are exceptions that they fail to decide correctly:
Second and third are pretty much alike, but the down side of PIP is cases where point lies on edges of the polygon that cost you more overhead to detect.

Drawing a circular, minor arc given the centre point and two other points

Does anyone know how to draw a circular, minor arc given the centre point and two other points that lie on the circle?
I want to draw the pixels directly to the screen, and preferably, not have to calculate the angles.
I am using SDL and C, but may be OK studying code given that uses a different language.
Thanks.
All points on a circle are equal distance to the centre.
Given you know two points on the circle you can calculate this distance.
Assuming you have cartesian coordinates, for every x or y value between the known points calculate the other value so that the point is equal distance to the centre and plot these points.
I think this is conceptually the easiest way, though not the most efficient.

Resources