Fix path_normals to handle 2d and better error message.

Improve error message for bogus endcaps to stroke() and
running unit() on a zero vector
This commit is contained in:
Adrian Mariano
2021-02-24 16:56:21 -05:00
parent 029cbb8997
commit 1627c3409d
3 changed files with 26 additions and 15 deletions

View File

@@ -108,7 +108,8 @@ module stroke(
cap=="tail"? [[0,0], [w/2,l2], [w/2,l2-l], [0,-l], [-w/2,l2-l], [-w/2,l2]] :
cap=="tail2"? [[w/2,0], [w/2,-l], [0,-l-l2], [-w/2,-l], [-w/2,0]] :
is_path(cap)? cap :
[]
is_undef(cap)? [] :
assert(false, str("Invalid endcap: ",cap))
) * linewidth;
assert(is_bool(closed));