This file contains 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
#!/bin/bash | |
find . -name "*.swift" | while read line; do unexpand -t 4 "$line" > "$line.new"; mv "$line.new" "$line"; done |
This file contains 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
class PolylineUtils { | |
/* | |
* Converts a polyline to a polygon with the given thickness. | |
*/ | |
static Vector2[] GeneratePolygonFromPolyline(float thickness, Vector2[] points) { | |
if (points.Length < 2) { return points; } | |
Vector2[] result = new Vector2[points.Length * 2]; | |
var normal = Vector2.zero; | |
for (int i = 0; i < points.Length - 1; i++) { | |
var direction = (points[i + 1] - points[i]).normalized; |