finding point coordinates on map image - geometry

If I had an image with snippet of a map, like in the example below; and I only knew the coordinates of 2 points (A and B) in that image (both pixel coordinates from the top-left corner and their corresponding latitudes and longitudes).
How could I calculate the coordinates of any other point, such as C, knowing its pixel coordinates in the image?

Related

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 find points in a certain distance to a Latitude/Longitude Coordinate

I'm working with Latitude/Longitude Coordinates and i'm trying to find an equation for a circle on the surface that includes all points that have a certain distance(on the surface) from the center.
It's important that this should work also with very big distances (for example half the perimeter of the earth), so the flat-earth approximation probably won't work, but assuming it's a perfect sphere is okay.
Can anybody help?
Thanks in advance!
I have this very same problem.
What I do is to convert the latitude and longitude to Cartesian coordinates fixed at the center of the Earth (which I assume is spherical).
I interpret these coordinates as a mathematical vector.
I also convert the desired "distance from center of circle"
to an angle at the center of the Earth,
that is, if the distance is d then the angle is alpha = d/R
where R is the Earth's radius.
I then find three vectors.
The first vector, v1, is just cos(alpha) times my original vector,
that is, it points from the center of the Earth to the center of my circle
and it has length R*cos(alpha).
The other two vectors, v2 and v3, have length R*sin(alpha),
and they are both perpendicular to v1 and to each other.
I can then get any point on the desired circle by taking
v1 + cos(beta)*v2 + sin(beta)*v3
where beta can range from 0 to 2*pi.
Finally, if I want the latitude and longitude of that point,
I convert it back from Cartesian coordinates.
If you never actually care about the Cartesian coordinate model but will
instead use only the latitudes and longitudes that result,
you can simplify the procedure slightly by assuming R == 1.
You can then simplify the formulas so that you never have to define
the variable R.
The coordinate conversions in either direction can be fairly straightforward.
An easy way to find vector v2 is to take the x and y coordinates of v1
(ignoring z), rotate the resulting vector 90 degrees in the x-y plane
(so if you started with (x,y,z), the new vector is (-y,x,0)),
and then scale the vector to the desired size.
Of course if the x and y coordinates of v1 are zero then you can
let v2 be any vector in the x-y plane.
To get v3 you can take the cross product of v1 and v2 and scale
as desired.

Subtract Rectangle from Polygon

I'm looking for an algorithm that will subtract a rectangle from a simple, concave polygon and return a remainder of polygons. If the rectangle encloses the polygon, the remainder is null. In most cases, it looks like at least one edge will be shared between the rectangle and the polygon.
I've been digging around the internet, but I've not found a good lead.
Can someone point me in the right direction?
That's easy: Find the intersections between the rectangle and the edges of the simple polygon and cut the segments there. This does not require a spatial search structure as the 4 edges of the polygon are a constant factor, so that runs in linear time.
Then compute a constrained Delaunay triangulation of all segments and use seed points to grow the regions. Combine the regions appropriately (the triangles inside the simple polygon minus the ones inside the rectangle minus triangles outside. The triangles that remain are your result and the border edges are the edges of the resulting polygon.
Edit: I'm sorry if the answer was too short. The figure below shows the idea.
a) The two input polygons
b) The CDT after insertion of the (cutted) segments
c) The grown regions
d) The green region minus the red region
e) The border edges of the region of d.

How to calculate mid point vertices?

I have a set of vertices to draw a circle, but I want to draw a high-res circle by drawing twice the number of vertices, I cant just increase the number of vertices what I need is to calculate the mid points from the supplied vertices, if that makes sense
So from that image how can I calculate the points A, B, C, ... given the points V0, V1, V2, ... and the center point of the circle ?
Please note that I cant just calculate the mid-points by rotating the vertices they need to be calculated using their position
Thanks
The center of the circle can be determined by making a perpendicular line to two neighboring "sides", and intersecting them.
If there are an even number of vertices, just pick two which are opposite to each other, and "avarage them" - calculate the midpoint.
Then, you can just rotate all the vertices to either way by 180°/No.vertices around this center, so you get the ones you are looking for. Of course, you should keep the existing ones too.

computing the bounding rectangle of planar geometry in 3D space

As an input, I receive some planar, triangulated geometry. Now, I need to compute the four coordinates of the corners of the bounding rectangle. Any Ideas?
I'm going to assume that you mean 2D space in the question title, because everything else refers to 2D.
Go through all the vertices (x,y) in your geometry, and calculate the maximum and minimum of the x's, and the max and min of the y's.
Then the vertices of your bounding rectangle will be (min_x,min_y), (max_x,min_y), (max_x, max_y), and (min_x, max_y).

Resources