This is a translated page. The original can be found here: http://iwebdevel.com/2009/06/17/coding-dont-make-mistakes-when-resizing-objects-preserve-the-initial-ratio-correctly/
UPDATES VIA RSS | Email GÜNCELLEME VIA RSS | E-posta Get updates via feedburner Get updates via twitter
Home / Coding / Coding: Don't make mis… Ana Sayfa / Kodlama / Kodlama: yanlış yapmayın ...

Coding: Don't make mistakes when resizing objects! Kodlama: zaman nesneleri yeniden boyutlandırma hataları yapmayın! Preserve the initial ratio correctly! Doğru ilk oranı koru!

Posted on 17. 17 tarihinde gönderildi. Jun, 2009 by Dragos in Coding Haziran, 2009 Dragos tarafından Kodlama içinde

I was tempted many times to do quick adjustments to my code, without taking into consideration some basic mathematical principles. Bir çok kez benim kodu hızlı ayarlamalar yapmak, dikkate bazı temel matematiksel ilkeleri almadan ayartmıştı oldu. For examples if a box is first of all 100px tall and 60px wide, and then I notice that this box does not fit the place where it was intended to be placed,  what I did was to subtract 10 px from the width of the box, for it to fit some area, and at the same time I subtracted 10 px from the height also, thinking that doing so I kept the ratio of the initial sizes of the box. Eğer bir kutu tüm 100px uzun boylu ve geniş 60px, sonra ilk örnek için ben bu kutusuna yerleştirilmesi için ne yaptım kutusunun genişliği 10 px çıkarmak oldu yer o düşünülmüştü uymuyor, fark için, bazı alanına sığdırmak için ve yüksekliği de 10 px çıkarılınca aynı zamanda, düşünme bu yüzden kutunun ilk boyutlarının oranı muhafaza yapıyorum. In fact this is not true! Aslında doğru değil bu!

Here's why: Here's why:

The ratio of the initial box is 100px/60px=1.66 Ilk kutusunun oranı = 1,66 100px/60px olduğunu

In the second case the ratio is: (100px-10px)/(60px-10px)=1.8 İkinci durumda oranıdır: (100px-10px) / (60px-10px) = 1,8

So, if you used to apply the same technique as I did to quickly resize objects, forget about it, as it's wrong! Yani, eğer ben hızlı bir şekilde nesneleri yeniden boyutlandırmak için mi, aynı tekniği uygulamak için unutmak kullanılan bu konuda, gibi yanlış! Instead use the old method from school to determine a variable from two fractions, preserving the ratios. Bunun yerine okuldan bir değişken belirlemek için iki kesirler gelen oranları koruyarak eski yöntemi kullanın. Back to the example above, in order to find out the new height value of the box I'd use this formula: 100px/60px=(100px-10px)/x, so x=60px*90px/100px=54px (instead of the incorrect value of 50px). Yukarıdaki örnekte Geri için sipariş bu formülü: 100px/60px = (100px-10px) / x, böylece x = 60px * 90px/100px = 54px (yerine kullanmak istediğiniz kutunun yeni yükseklik değerini öğrenmek için 50px yanlış değer). That's it! That's it!

Translate this post Translate bu yazı


No related posts. İlgili mesajlar.

    blog comments powered by Disqus Blog Yorumlar Disqus tarafından desteklenmektedir