From b2d97ca3d65e5e8fbfd573c703b48027019a7579 Mon Sep 17 00:00:00 2001 From: David Minnerly <voxeldavid@gmail.com> Date: Fri, 30 Apr 2021 15:19:40 -0400 Subject: [PATCH] Make a folder for shape detection functions --- src/detectOrientation.lua | 4 ++-- src/detectShape.lua | 12 ++++++------ src/init.lua | 4 ++-- src/{ => shapes}/isChevron.lua | 2 +- src/{ => shapes}/isCircle.lua | 2 +- src/{ => shapes}/isLine.lua | 0 src/{ => shapes}/isRectangle.lua | 4 ++-- src/{ => shapes}/isSquare.lua | 4 ++-- src/{ => shapes}/isTriangle.lua | 4 ++-- 9 files changed, 18 insertions(+), 18 deletions(-) rename src/{ => shapes}/isChevron.lua (89%) rename src/{ => shapes}/isCircle.lua (87%) rename src/{ => shapes}/isLine.lua (100%) rename src/{ => shapes}/isRectangle.lua (68%) rename src/{ => shapes}/isSquare.lua (67%) rename src/{ => shapes}/isTriangle.lua (64%) diff --git a/src/detectOrientation.lua b/src/detectOrientation.lua index ed3cebf..e743bda 100644 --- a/src/detectOrientation.lua +++ b/src/detectOrientation.lua @@ -20,8 +20,8 @@ (N, E, S, W). ]] -local isLine = require(script.Parent.isLine) -local isChevron = require(script.Parent.isChevron) +local isLine = require(script.Parent.shapes.isLine) +local isChevron = require(script.Parent.shapes.isChevron) local Orientation = require(script.Parent.Orientation) type Array<T> = { [number]: T } diff --git a/src/detectShape.lua b/src/detectShape.lua index 98603cc..bd36f06 100644 --- a/src/detectShape.lua +++ b/src/detectShape.lua @@ -1,12 +1,12 @@ local sortCounterClockwise = require(script.Parent.sortCounterClockwise) local getConvexHull = require(script.Parent.getConvexHull) local getPolygonArea = require(script.Parent.getPolygonArea) -local isLine = require(script.Parent.isLine) -local isChevron = require(script.Parent.isChevron) -local isCircle = require(script.Parent.isCircle) -local isRectangle = require(script.Parent.isRectangle) -local isSquare = require(script.Parent.isSquare) -local isTriangle = require(script.Parent.isTriangle) +local isLine = require(script.Parent.shapes.isLine) +local isChevron = require(script.Parent.shapes.isChevron) +local isCircle = require(script.Parent.shapes.isCircle) +local isRectangle = require(script.Parent.shapes.isRectangle) +local isSquare = require(script.Parent.shapes.isSquare) +local isTriangle = require(script.Parent.shapes.isTriangle) local Shape = require(script.Parent.Shape) local function detectShape(points: {[number]: Vector2}) diff --git a/src/init.lua b/src/init.lua index 18a2a65..91e4f1c 100644 --- a/src/init.lua +++ b/src/init.lua @@ -14,7 +14,7 @@ return { getPolygonArea = require(script.getPolygonArea), getSideLengths = require(script.getSideLengths), getTriangleArea = require(script.getTriangleArea), - isLine = require(script.isLine), - isChevron = require(script.isChevron), + isLine = require(script.shapes.isLine), + isChevron = require(script.shapes.isChevron), sortCounterClockwise = require(script.sortCounterClockwise), } diff --git a/src/isChevron.lua b/src/shapes/isChevron.lua similarity index 89% rename from src/isChevron.lua rename to src/shapes/isChevron.lua index bbf2f89..255bfd2 100644 --- a/src/isChevron.lua +++ b/src/shapes/isChevron.lua @@ -1,4 +1,4 @@ -local getCornerIndices = require(script.Parent.getCornerIndices) +local getCornerIndices = require(script.Parent.Parent.getCornerIndices) type Array<T> = { [number]: T } diff --git a/src/isCircle.lua b/src/shapes/isCircle.lua similarity index 87% rename from src/isCircle.lua rename to src/shapes/isCircle.lua index 59f0e75..4780194 100644 --- a/src/isCircle.lua +++ b/src/shapes/isCircle.lua @@ -1,4 +1,4 @@ -local getPerimeter = require(script.Parent.getPerimeter) +local getPerimeter = require(script.Parent.Parent.getPerimeter) local function fuzzyeq(a, b, epsilon) return math.abs(a - b) <= epsilon diff --git a/src/isLine.lua b/src/shapes/isLine.lua similarity index 100% rename from src/isLine.lua rename to src/shapes/isLine.lua diff --git a/src/isRectangle.lua b/src/shapes/isRectangle.lua similarity index 68% rename from src/isRectangle.lua rename to src/shapes/isRectangle.lua index 94f20d0..19897c0 100644 --- a/src/isRectangle.lua +++ b/src/shapes/isRectangle.lua @@ -1,5 +1,5 @@ -local getBoundingBox = require(script.Parent.getBoundingBox) -local getSideLengths = require(script.Parent.getSideLengths) +local getBoundingBox = require(script.Parent.Parent.getBoundingBox) +local getSideLengths = require(script.Parent.Parent.getSideLengths) local RECTANGLE_PERCENT = 0.75 diff --git a/src/isSquare.lua b/src/shapes/isSquare.lua similarity index 67% rename from src/isSquare.lua rename to src/shapes/isSquare.lua index bec07f7..110b496 100644 --- a/src/isSquare.lua +++ b/src/shapes/isSquare.lua @@ -1,5 +1,5 @@ -local getBoundingBox = require(script.Parent.getBoundingBox) -local getSideLengths = require(script.Parent.getSideLengths) +local getBoundingBox = require(script.Parent.Parent.getBoundingBox) +local getSideLengths = require(script.Parent.Parent.getSideLengths) local SQUARE_PERCENT = 0.60 diff --git a/src/isTriangle.lua b/src/shapes/isTriangle.lua similarity index 64% rename from src/isTriangle.lua rename to src/shapes/isTriangle.lua index d08a40b..90c8769 100644 --- a/src/isTriangle.lua +++ b/src/shapes/isTriangle.lua @@ -1,5 +1,5 @@ -local getLargestTriangle = require(script.Parent.getLargestTriangle) -local getTriangleArea = require(script.Parent.getTriangleArea) +local getLargestTriangle = require(script.Parent.Parent.getLargestTriangle) +local getTriangleArea = require(script.Parent.Parent.getTriangleArea) local TRIANGLE_PERCENT = 0.75