From 56bd322ace7f6f03214cb8af82c49d8f13453210 Mon Sep 17 00:00:00 2001
From: Vytor Calixto <vytorcalixto@gmail.com>
Date: Tue, 24 Nov 2015 00:07:23 -0200
Subject: [PATCH] =?UTF-8?q?Arrumada=20fun=C3=A7=C3=A3o=20dos=20angulos?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 main.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/main.c b/main.c
index 3b7b9d8..0eb7f53 100644
--- a/main.c
+++ b/main.c
@@ -41,11 +41,17 @@ double angleFromOrigin(int x, int y) {
      * 2. Com o valor de X e da Hip, temos o seno do ângulo formado entre a hipotenusa e o eixo X
      * 3. Fazemos a função arco cosseno para pegar o valor do ângulo (em graus)
      */
-    double hip = sqrt(x*x + y*y);
-    return acos(x/hip) * 180/PI;
+    if(x && y) {
+        double hip = sqrt(x*x + y*y);
+        return acos(x/hip) * 180/PI;
+    }
+    return 0;
 }
 
 double angleFromPoint(int ox, int oy, int x, int y) {
+    if(ox == x && oy == y) {
+        return 0;
+    }
     //ox e oy são os pontos da nova referência
     double hip = distance(ox, oy, x, y);
     return acos((ox-x)/hip) * 180/PI;
-- 
GitLab