mirror of
https://github.com/ColonelParrot/jscanify.git
synced 2025-12-30 22:31:52 +00:00
Make distance() more succinct
This commit is contained in:
parent
8a0ec08de1
commit
dbfff42790
@ -22,7 +22,7 @@ let cv;
|
||||
* @returns distance between two points
|
||||
*/
|
||||
function distance(p1, p2) {
|
||||
return Math.sqrt((p1.x - p2.x) ** 2 + (p1.y - p2.y) ** 2);
|
||||
return Math.hypot(p1.x - p2.x, p1.y - p2.y);
|
||||
}
|
||||
|
||||
class jscanify {
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
* @returns distance between two points
|
||||
*/
|
||||
function distance(p1, p2) {
|
||||
return Math.sqrt((p1.x - p2.x) ** 2 + (p1.y - p2.y) ** 2);
|
||||
return Math.hypot(p1.x - p2.x, p1.y - p2.y);
|
||||
}
|
||||
|
||||
class jscanify {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user