How do I scale one rectangle to the maximum size possible within another rectangle?

scale = min(dst.width/src.width, dst.height/src.height)

This is your approach but written more cleanly.

To use this, the scaled rectangle would have the shape:

width = src.width * scale
height = src.height * scale

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)