I have some set of points making a specific pattern. I want to find a linear mapping (dilations + translations) to find a similar pattern in a second larger set of points. I want to find the best (or at least a good) fit in the second data. I am having a problem getting Mathematica to find the best one.
Set of points:
Second larger set of points:
Here is my function to find nearest point:
These seems to work based on this test:
Next I set up a measure of how close a particular mapping got the points in data to the points in coords.
I them asked Mathematica to find the best a,b,c,d for the transformation. I added the minimum requirements on the scaling coefficients a and b so that it doesn't just shrink it to a single point.
This however ends up with points which looks nothing like the original shape.
manually trying some other mappings I find ones that look more like the original. For example with a=0.05, b=0.05, c=114, d=34.5 I get the image:
Checking my 'score' for both shows that my mapping is 'worse' so my question is how do I improve my methodology so that I get a more human acceptable better mapping.