This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | -- point1, point2 and point3 take a tile coordinate formatted in row, col. eg. {10,10} | |
| function drawTriangle(point1, point2, point3, terrainToDraw) | |
| local function sign(p1, p2, p3) | |
| return (p1[2] - p3[2]) * (p2[1] - p3[1]) - (p2[2] - p3[2]) * (p1[1] - p3[1]) | |
| end | |
| local function pointInTriangle(point, v1, v2, v3) | |
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | -- point1, point2 and point3 take a tile coordinate formatted in row, col. eg. {10,10} | |
| function getSquaresInTriangle(point1, point2, point3) | |
| tiles = {} | |
| local function sign(p1, p2, p3) | |
| return (p1[2] - p3[2]) * (p2[1] - p3[1]) - (p2[2] - p3[2]) * (p1[1] - p3[1]) | |
| end | |
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | -- draws a box of terrain from a start coordinate to an end coordinate | |
| -- startRow, startCol (int) are the start row and col coordinates of the rectangle | |
| -- endRow, endCol (int) are the start row and col coordinates of the rectangle | |
| -- pickedTerrain is the terrain type you wish the rectangle to be filled with | |
| function drawRect(startRow, startCol, endRow, endCol, pickedTerrain) | |
| local function sign(number) | |
| return number > 0 and 1 or (number == 0 and 0 or -1) | |
| end | |