I'm not familiar with search algorithms specifically, but this would be the best programmatic approach, pseudoed out below.
Objects we use:
vertex { //generic x,y coordinate
int x;
int y;
}
vertices[3]; //3 vertices: 0, 1, 2 (0 is start, 1 is mid, 2 is end);
And our algorithm, which depends on the most efficient path already found not having weirdness like ¯|_|¯
boolean hasObstacles = false;
int increment = 0;
//there's some other ways to set this up, but this should make the most sense to explaining which way we need to go
if(vertices[0].x < vertices[2].x)
increment = 1;
else
increment = -1;
for(int i = vertices[0].x; i != vertices[2].x; i = i + increment) {
//check for collision at coordinate (i, vertices[0].y), set hasObstacles to true if collision
}
if(vertices[0].y < vertices[2].y)
increment = 1;
else
increment = -1;
for(int i = vertices[0].y; i != vertices[2].y; i = i + increment) {
//check for collision at coordinate (vertices[2].x, i), set hasObstacles to true if collision
}
if(!hasObstacles) {
//we can remove these 3 vertices and add this point to our list of vertices.
vertex corner = new vertex(vertices[2].x, vertices[0].y) // relocation of point
}
The scan should progress one vertex at a time. If the 3 vertices are replaced with a single vertex, the next scan should use that new vertex as 0.