From f71675dd21a7af71b09f0d2b5f69010bdf87de2e Mon Sep 17 00:00:00 2001 From: Debucquoy Date: Thu, 27 Apr 2023 10:35:36 +0200 Subject: [PATCH] addition of vectors Vector to string --- app/src/main/java/school_project/Vec2.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/src/main/java/school_project/Vec2.java b/app/src/main/java/school_project/Vec2.java index 7bf6ed9..6529e15 100644 --- a/app/src/main/java/school_project/Vec2.java +++ b/app/src/main/java/school_project/Vec2.java @@ -26,4 +26,13 @@ public class Vec2 implements Serializable { } return false; } + + public Vec2 add(Vec2 o){ + return new Vec2(x + o.x, y + o.y); + } + + @Override + public String toString() { + return "("+x+","+y+")"; + } }