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

13
LINES

< > BotCompany Repo | #1005804 // pointDistance - distance between two points (Pt)

JavaX fragment (include)

static double pointDistance(Pt a, Pt b) {
  ret sqrt(sqr(a.x-b.x) + sqr(a.y-b.y));
}

static double pointDistance(double x1, double y1, double x2, double y2) {
  ret sqrt(sqr(x1-x2) + sqr(y1-y2));
}

ifclass DoublePt
static double pointDistance(DoublePt a, DoublePt b) {
  ret pointDistance(a.x, a.y, b.x, b.y);
}
endif

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, sawdedvomwva, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1005804
Snippet name: pointDistance - distance between two points (Pt)
Eternal ID of this version: #1005804/5
Text MD5: 87a38e858ae951e5929d06c31ecf2011
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-04-15 03:40:19
Source code size: 331 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 553 / 570
Version history: 4 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1015064 - ptDistance - synonym of pointDistance - distance between two points (Pt)
#1016924 - ptDistanceSquared - squared distance between two points (Pt)