diff options
author | Tom Barrett <tombarrett@siu.edu> | 2017-11-24 05:03:02 -0600 |
---|---|---|
committer | Tom Barrett <tombarrett@siu.edu> | 2017-11-24 05:03:02 -0600 |
commit | 007bb4def33ac4291f6d5b014ab57f2c760c1e3b (patch) | |
tree | f9fc43a8b452561a373c99a1be269051cf62bd16 /src/location.rs | |
parent | ae4e10f00eab3c9a7a9f5239392e67ef3c39fb1a (diff) |
-added threaded path calculation
Diffstat (limited to 'src/location.rs')
-rw-r--r-- | src/location.rs | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/location.rs b/src/location.rs index a6ac623..509b551 100644 --- a/src/location.rs +++ b/src/location.rs @@ -2,6 +2,7 @@ pub struct Location(pub i32, pub i32); impl Location { + pub fn distance(&self, other: &Location) -> usize { (((self.0 - other.0).pow(2) + (self.1 - other.1).pow(2)) as f64).sqrt() as usize } |