[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y / ] [Home]
4chanarchives logo

Can't into basic math


Thread replies: 9
Thread images: 1

File: 204.gif (81KB, 300x100px) Image search: [Google] [Yandex] [Bing]
204.gif
81KB, 300x100px
Does this make sense for determining how "square" a photo is?

ratio = min(pic.width, pic.height) / max(pic.width, pic.height)
if ratio > min_squareness: print("squarish")
>>
pls
>>
>>53741108
Not enough info
>>
A square will have a ratio of 1 right? The way you have it, your ratio will always be less than or equal to one. So I don't think your way will ever print your message.

What you need to do is get a ratio and check to see how far away from 1 it is. The closer to one, the more square it is.
>>
>>53741108
Yes op, it makes perfect sense.
Take the ratio of the smaller/the larger - a number that will be between (0,1] - and year to see if the radio is great than a minimum tolerance (such as 0.8, 0.9, etc)
>>
>>53742828
IT can be greater than one, depending on what side is longer. Just determine how close to 1 the ratio is with a range of tolerance
>>
>>53742828
Oh, and determining upon your requirements, you might want to square the ratio to give it a sharper slope.
>>
>>53742878
No it can't. Not in his code (min/max) it'll always be <= 1
>>
>>53742828 Me
>>53742874
Actually, he's right. It'll print your message if you use a minimum tolerance as your min_squareness. For some reason I was thinking it would be 1. I think your way is good.
Thread replies: 9
Thread images: 1
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y / ] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
If a post contains illegal content, please click on its [Report] button and follow the instructions.
This is a 4chan archive - all of the content originated from them. If you need information for a Poster - you need to contact them.
This website shows only archived content and is not affiliated with 4chan in any way.
If you like this website please support us by donating with Bitcoin at 1XVgDnu36zCj97gLdeSwHMdiJaBkqhtMK