From e9388a4f4c47d1df503ed538e62c09e010c6aa2d Mon Sep 17 00:00:00 2001 From: Pacien TRAN-GIRARD Date: Mon, 23 Nov 2015 11:43:34 +0100 Subject: Add zero vector constructor --- src/ch/epfl/maze/util/Vector2D.java | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/ch') 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 { /* shift constant to compute the hash */ private static final int SHIFT = 1000; + private static final int ZERO = 0; + /* 2-dimension coordinates */ private final int mX, mY; @@ -24,6 +26,13 @@ public final class Vector2D { mY = y; } + /** + * Constructs a 2-dimensional zero vector. + */ + public Vector2D() { + this(Vector2D.ZERO, Vector2D.ZERO); + } + /** * Adds two coordinates to the vector. * -- cgit v1.2.3