Fixed orient() for 2D dir=

This commit is contained in:
Garth Minette 2021-12-26 18:39:10 -08:00
parent 9213421863
commit c4aa61fc20

View file

@ -429,7 +429,9 @@ module orient(dir, anchor, spin) {
assert(is_vector(dir));
spin = default(spin, 0);
assert(is_finite(spin));
rot(spin, from=UP, to=dir) children();
two_d = _attach_geom_2d($parent_geom);
fromvec = two_d? BACK : UP;
rot(spin, from=fromvec, to=dir) children();
} else {
assert(dir==undef, "Only one of dir= or anchor= may be given to orient()");
assert($parent_geom != undef, "No parent to orient from!");