17 lines
746 B
Text
17 lines
746 B
Text
require "bitmap"
|
|
local fmt = require "fmt"
|
|
|
|
local triangles = {
|
|
{ { {0, 0}, {5, 0}, {0, 5} }, { {0, 0}, {5, 0}, {0, 6} } },
|
|
{ { {0, 0}, {0, 5}, {5, 0} }, { {0, 0}, {0, 5}, {5, 0} } },
|
|
{ { {0, 0}, {5, 0}, {0, 5} }, { {-10, 0}, {-5, 0}, {-1, 6} } },
|
|
{ { {0, 0}, {5, 0}, {2.5, 5} }, { {0, 4}, {2.5,-1}, {5, 4} } },
|
|
{ { {0, 0}, {1, 1}, {0, 2} }, { {2, 1}, {3, 0}, {3, 2} } },
|
|
{ { {0, 0}, {1, 1}, {0, 2} }, { {2, 1}, {3, -2}, {3, 4} } },
|
|
{ { {0, 0}, {1, 0}, {0, 1} }, { {1, 0}, {2, 0}, {1, 1} } }
|
|
}
|
|
|
|
for triangles as ts do
|
|
local overlap = bitmap.polygonsOverlap(ts[1], ts[2])
|
|
fmt.print("%-26s and %-28s overlap? %s", fmt.swrite(ts[1]), fmt.swrite(ts[2]), overlap)
|
|
end
|