Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

9
LINES

< > BotCompany Repo | #1034032 // g22_squareness - how square-ish is a rectangle? (probability value)

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (4820L/27K).

static double g22_squareness(Rect r) {
  ret doubleRatio(min(r.w, r.h), max(r.w, r.h));
}

// Original approach - turns out this is just the same as the version
// above
/*static double g22_squareness_b(Rect r) {
  ret distanceToProbability(doubleRatio(max(r.w, r.h), min(r.w, r.h))-1);
}*/

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: 109 / 172
Version history: 6 change(s)
Referenced in: [show references]