diff options
author | Pacien TRAN-GIRARD | 2015-11-23 11:43:34 +0100 |
---|---|---|
committer | Pacien TRAN-GIRARD | 2015-11-23 11:43:34 +0100 |
commit | e9388a4f4c47d1df503ed538e62c09e010c6aa2d (patch) | |
tree | acf632ad6273aa4c5efddb1b18adff170aea0b82 /src/ch | |
parent | 00dcbed592b743e5fa31a0a3870ac590365436b0 (diff) | |
download | maze-solver-e9388a4f4c47d1df503ed538e62c09e010c6aa2d.tar.gz |
Add zero vector constructor
Diffstat (limited to 'src/ch')
-rw-r--r-- | src/ch/epfl/maze/util/Vector2D.java | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/ch/epfl/maze/util/Vector2D.java b/src/ch/epfl/maze/util/Vector2D.java index 66b0216..407851c 100644 --- a/src/ch/epfl/maze/util/Vector2D.java +++ b/src/ch/epfl/maze/util/Vector2D.java | |||
@@ -9,6 +9,8 @@ public final class Vector2D { | |||
9 | /* shift constant to compute the hash */ | 9 | /* shift constant to compute the hash */ |
10 | private static final int SHIFT = 1000; | 10 | private static final int SHIFT = 1000; |
11 | 11 | ||
12 | private static final int ZERO = 0; | ||
13 | |||
12 | /* 2-dimension coordinates */ | 14 | /* 2-dimension coordinates */ |
13 | private final int mX, mY; | 15 | private final int mX, mY; |
14 | 16 | ||
@@ -25,6 +27,13 @@ public final class Vector2D { | |||
25 | } | 27 | } |
26 | 28 | ||
27 | /** | 29 | /** |
30 | * Constructs a 2-dimensional zero vector. | ||
31 | */ | ||
32 | public Vector2D() { | ||
33 | this(Vector2D.ZERO, Vector2D.ZERO); | ||
34 | } | ||
35 | |||
36 | /** | ||
28 | * Adds two coordinates to the vector. | 37 | * Adds two coordinates to the vector. |
29 | * | 38 | * |
30 | * @param x Horizontal coordinate to add | 39 | * @param x Horizontal coordinate to add |