# Difference similarity shape, length, width, height, regardless of scale, most similar

• Jan 30th 2013, 03:11 PM
xinlo
Difference similarity shape, length, width, height, regardless of scale, most similar
Lets say you have a rectangular prism.
Model: LxWxH: 192 x 210 x 212

various rectangular prisms L,W,H
186,205,204
186,206,205
188,210,206
191,209,210
188,208,209
185,207,208
197,204,207
199,211,214
210,192,212 (should be farthest from a match)
384,420,424 (should be perfect match)

How would you pick the one that most closely matches the proportions of the original shape? scale does not matter, only proportions

In the above data set I added one with the same dimensions but in a different order, also a couple where the width is greater than the height.
The solving method should show those value as the least similar.
I also added one that has the exact same dimensions as the original only doubled, it should return the closest match.(perfet match, although there wont usually be a perfect match)

when its two dimensions its much simpler, you could just divide the length/width and pick which ever number is closest to the result of the original model.

I dont need a solution, these numbers are just examples, I am just wanting to know what equation you would use to solve this type of problem.
I am working on a software project where I will need to do a lot of work comparing the difference between sets of numbers.
• Jan 30th 2013, 07:26 PM
chiro
Re: Difference similarity shape, length, width, height, regardless of scale, most sim
Hey xinlo.

For this problem you might want to use a metric where d(x,y) = SQRT((x0-y0)^2 + (x1-y1)^2 + (x2-y2)^2) where (x0,x1,x2) is LWH for item 1 and (y0,y1,y2) is LWH for item 2.

Smaller value indicates closer fit.

This is a very crude way of doing it but it does provide a starting point.
• Jan 30th 2013, 07:47 PM
xinlo
Re: Difference similarity shape, length, width, height, regardless of scale, most sim
When I tried that just now but

384,420,424 got a value of 354.835173 and it should have been the closest match, should I normalize the values based on the height, or maybe there is another way.
• Jan 30th 2013, 08:21 PM
chiro
Re: Difference similarity shape, length, width, height, regardless of scale, most sim
Well the metric I gave was a standard one but you may want to add to or change it based on the actual attribute you are looking for (i.e. incorporate the nature of the ratio into the metric).
• Jan 30th 2013, 10:23 PM
xinlo
Re: Difference similarity shape, length, width, height, regardless of scale, most sim
yep, i am only looking for geometric similarity, with the objects in question facing the same direction

As far as I can tell once normalized this works excellent! Thank you so very much :)

here is how I normalized it, and it seems to be exactly what I needed. Just hope the way I am normalizing it is the correct way to go about it, so nothing creeps up on me when im not expecting it.

The reason I normalized it is because the scale of the object does not matter only geometric similarity.

=SQRT((x0/x2-y0/y2)^2 + (x1/x2-y1/y2)^2 + (x2/x2-y2/y2)^2)

x0,x1,x2 = 192,210,212 = 0
--------------------------------------------
y0,y1,y2 = 384,420,424 = 0
y0,y1,y2 = 191,209,210 = 0.006062527
y0,y1,y2 = 188,208,209 = 0.007700726
y0,y1,y2 = 186,206,205 = 0.014407578
y0,y1,y2 = 186,205,204 = 0.015581448
y0,y1,y2 = 185,207,208 = 0.016883492
y0,y1,y2 = 199,211,214 = 0.024675823
y0,y1,y2 = 188,210,206 = 0.029679298
y0,y1,y2 = 197,204,207 = 0.046307593
y0,y1,y2 = 210,192,212 = 0.120074736