stackLine function
Implementation
List<List<int>> stackLine(List<int> p1, List<int> p2) {
final stack = <List<int>>[];
final dx = p2[0] - p1[0];
final dy = p2[1] - p1[1];
final length = math.sqrt(dx * dx + dy * dy).toInt();
final rad = math.atan2(dy, dx);
for (var l = 0; l < length; l++) {
final x = p1[0] + l * math.cos(rad);
final y = p1[1] + l * math.sin(rad);
stack.add([x.toInt(), y.toInt()]);
}
return stack.toSet().toList();
}