Fixed 2D attachments issue That rotated shapes vertically.

This commit is contained in:
Revar Desmera 2020-01-15 14:18:11 -08:00
parent 62e8e517fd
commit 9d84c33af6
4 changed files with 10 additions and 6 deletions

View file

@ -275,8 +275,8 @@ module orient_and_anchor(
hidden = any([for (tag=tags) in_list(tag, h_tags)]);
if ($attach_to != undef) {
anch = find_anchor($attach_to, size.z, size, size2=size2, shift=shift, offset=offset, anchors=anchors, geometry=geometry, two_d=two_d);
ang = vector_angle(anch[2], DOWN);
axis = vector_axis(anch[2], DOWN);
ang = vector_angle(anch[2], two_d? BACK : DOWN);
axis = two_d? UP : vector_axis(anch[2], DOWN);
ang2 = (anch[2]==UP || anch[2]==DOWN)? 0 : 180-anch[3];
axis2 = rotate_points3d([axis],[0,0,ang2])[0];
$attach_to = undef;

View file

@ -136,7 +136,7 @@ function circle(r, d, realign=false, circum=false, anchor=CENTER, spin=0) =
// Section: Primitive Shapes
// Section: Primitive 3D Shapes
// Module: cube()

View file

@ -781,8 +781,12 @@ function trapezoid(h, w1, w2, anchor=CENTER, spin=0) =
module trapezoid(h, w1, w2, anchor=CENTER, spin=0)
polygon(trapezoid(h=h, w1=w1, w2=w2, anchor=anchor, spin=spin));
module trapezoid(h, w1, w2, anchor=CENTER, spin=0) {
orient_and_anchor([w1,h,0], size2=[w2,h], UP, anchor, spin=spin, two_d=true, chain=true) {
polygon(trapezoid(h=h, w1=w1, w2=w2));
children();
}
}
// Function&Module: teardrop2d()

View file

@ -8,7 +8,7 @@
//////////////////////////////////////////////////////////////////////
BOSL_VERSION = [2,0,86];
BOSL_VERSION = [2,0,87];
// Section: BOSL Library Version Functions