Not sure how to approach this somewhat complex problem... I want to make a general solution finder for a real-world application.

264 Views Asked by At

I believe I've generalized the problem as simple as possible.

Here is what is given:

(1) Dimensions of rectangle.

(2) Mesh/grid dimensions are constant, i.e., 6x6.

(3) Point coordinates.

(4) Line emanating from point length is constant, i.e., 3.

(5) Green zone is 0.75-1.5 from point, constant.

(6) Blue zone is 1.25 in from rectangle perimeter.

(7) Point-emanating lines will never escape the bounds of the rectangle.

(8) Point-emanating lines will never lay parallel on top of/within a grid line.

Definitions: "tip length" the distance from any one edge vertex of the grid to the point the grid line intersects the rectangle bounds < 6.

Here is what the goal is:

Arrange the mesh in such a way that (1) a horizontal or vertical grid line intersects the point-emanating line in the green zone AND (2) maintain as many edge vertices WITHIN the blue zone, so, say, if the left and top edge can only fit, and the bottom and right edge has tip lengths greater than 1.5 that's fine. The desired output would be the lengths of both the 90 degree and 180 degree tip lengths of the top left edge vertex. Each vector, basically, will point either up or down typically, but sometimes there is a vector that points in a random direction or a series of them.

enter image description here

There could be up to a hundred point-emanating lines with their respective origin coordinates. Realistically though the point-emanating line and the grid are actual physical objects that have thickness, so this might not even be useful. Grid line width is 3/16, and point-emanating line is 1/4 if that's important.

Ideally, even though some input will output no solution, the program should output the "best" solution which would be to minimized edge tip lengths from being greater than 1.5 while also minimizing the number of point-emanating line mismatches. So, say, you manage to fit it to 47 of the lines, but it requires 50, then highlight the three that don't match and is that the lowest number of mismatches for all arrangements?