Articles Tagged 'scaling'

Mathematics: resize in proportion

ci viene chiesto di renderlo più piccolo del 20%! Given a large rectangular object w and high h we are asked to make it smaller by 20%! First of all, we decrease of 20% its width:

1
object.width object.width = - ((object.width * 20) / 100)

from which

1
object.width object.width = - (object.width * 0.2)

from which

1
object.width = object.width * (1-0.2)

For the height is exactly the same.

When there's a third object, ie there has been given the percentage to be removed from our object, but by a third party, we have:

1
2
3
rate = object.width / object.height
object.width = terzo.width * (1-0.2)
object.height = object.width / installments

More ...


Stop SOPA