Add triangles.scad.

This commit is contained in:
voussoir 2022-01-04 14:51:17 -08:00
parent 722b92d175
commit 71c5616e24
No known key found for this signature in database
GPG key ID: 5F7554F8C26DACCB

39
voussoir/triangles.scad Normal file
View file

@ -0,0 +1,39 @@
module right_triangle(width, height, center=false)
{
if (center)
{
polygon([
[-width/2, -height/2],
[width/2, -height/2],
[width/2, height/2]
]);
}
else
{
polygon([
[0, 0],
[width, 0],
[0, height]
]);
}
}
module isoscelese_triangle(width, height, center=false)
{
if (center)
{
polygon([
[-width/2, -height/2],
[0, height/2],
[width/2, -height/2]
]);
}
else
{
polygon([
[0, 0],
[width, 0],
[width/2, height]
]);
}
}