From c51f9bd979dbd79f20cb0abd543dc9b4df9f4e84 Mon Sep 17 00:00:00 2001 From: Paulo Custodio Date: Tue, 9 Mar 2021 20:01:18 +0000 Subject: Remove tabs --- challenge-101/paulo-custodio/lua/ch-2.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'challenge-101/paulo-custodio/lua/ch-2.lua') diff --git a/challenge-101/paulo-custodio/lua/ch-2.lua b/challenge-101/paulo-custodio/lua/ch-2.lua index 47a12b657e..54b02aa59d 100644 --- a/challenge-101/paulo-custodio/lua/ch-2.lua +++ b/challenge-101/paulo-custodio/lua/ch-2.lua @@ -5,10 +5,10 @@ Challenge 101 TASK #2 › Origin-containing Triangle Submitted by: Stuart Little -You are given three points in the plane, as a list of six co-ordinates: +You are given three points in the plane, as a list of six co-ordinates: A=(x1,y1), B=(x2,y2) and C=(x3,y3). -Write a script to find out if the triangle formed by the given three +Write a script to find out if the triangle formed by the given three co-ordinates contain origin (0,0). Print 1 if found otherwise 0. @@ -24,12 +24,12 @@ function point_in_triangle(xp,yp, x1,y1,x2,y2,x3,y3) local d3 = sign(xp,yp, x3,y3, x1,y1) local has_neg - if (d1 < 0) or (d2 < 0) or (d3 < 0) then + if (d1 < 0) or (d2 < 0) or (d3 < 0) then has_neg = true else has_neg = false end - + local has_neg = (d1 < 0) or (d2 < 0) or (d3 < 0) local has_pos = (d1 > 0) or (d2 > 0) or (d3 > 0) @@ -40,7 +40,7 @@ function point_in_triangle(xp,yp, x1,y1,x2,y2,x3,y3) end end -io.write(point_in_triangle(0,0, +io.write(point_in_triangle(0,0, tonumber(arg[1]), tonumber(arg[2]), tonumber(arg[3]), tonumber(arg[4]), tonumber(arg[5]), tonumber(arg[6])), "\n") -- cgit