Trying to normalise the scale of two shapes of different sizes

Hi there!

So I’m attempting to normalise the scale of two shapes that have the exact same geometry (i.e. they’re both rectangles) but they are of different sizes. I’m working solely in RhinoPython.

I’ve come up with two methods but attempting both has left me defeated:

  1. Scale them to the lowest possible value in a hope they both reach a scale threshold.
  2. Surround each in a bounding box and scale them accordingly.

I’m kind of at a loss as you can see haha. Would anyone be able to give me a push in the right direction?

Thanks :smiley:

Hi,

Can you just get some quantifiable property of each (length, area, volume etc.) and calculate a scale factor needed for each based on that?

-jarek

Hey @Jarek, thanks for the response.

I’m intending to achieve normalisation of two shapes that will have unique geometry to one another so getting some property from both might prove difficult but I’ll see what I can do. Thanks =)

Hi,

In your post you mentioned the geometry is the same…
In case of different shapes, I’d go with bounding box comparison, don’t know if there is any other reliable way. Basic boundingbox (world or cplane aligned), or write a routine to find smallest bounding box for each, for a more fancy approach.

-j

Maybe I am misreading it. What exactly do you mean by normalize? Have the rectangles have the same area, or scale both of them to the average sizes? An example image or file would be helpful.

-j

Ah sorry @Jarek I should have been more specific in my post.

I’m trying to scale them both to an average size. I’m using two rectangles (of differing sizes) as example shapes as I feel if I can get them to the exact same size, I’d be able to scale shapes of different geometry to similar sizes as well.

For example:
The shapes start off at different sizes:

And after scaling the result would be this:

It seems @Jarek suggestions of comparing properties to define the scale factor will work:

In your example above:

1 Get the length of both curve shapes
2 Calculate the average length
3 Scale each shape from the current to the average length.

If your shapes are not the same shape, I’d try and see how it works out if you use the boundingbox edge lengts to determine the scales

HTH

  • Willem

Thank you @Willem (and @Jarek!) that gave me the exact push I needed to figure out the normalisation!

Once I calculated the height of the bounding box of one shape I was able calculate the difference between its height and the desired height I wanted. I was able to figure out how much I needed to scale down (which I called my scaleFactor).

Thanks to everyone for helping me on this. I really appreciate your time and assistance :slight_smile: