Libraryless. Click here for Pure Java version (4820L/27K).
1 | static double g22_squareness(Rect r) { |
2 | ret doubleRatio(min(r.w, r.h), max(r.w, r.h)); |
3 | } |
4 | |
5 | // Original approach - turns out this is just the same as the version |
6 | // above |
7 | /*static double g22_squareness_b(Rect r) { |
8 | ret distanceToProbability(doubleRatio(max(r.w, r.h), min(r.w, r.h))-1); |
9 | }*/ |
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1034032 |
Snippet name: | g22_squareness - how square-ish is a rectangle? (probability value) |
Eternal ID of this version: | #1034032/7 |
Text MD5: | 8b525d5133b453878e872edc5a76d3c3 |
Transpilation MD5: | f6212dd2004a90ef99944ec853e626cb |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-01-18 01:26:40 |
Source code size: | 298 bytes / 9 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 219 / 308 |
Version history: | 6 change(s) |
Referenced in: | [show references] |