mirror of
https://github.com/revarbat/BOSL2.git
synced 2025-01-16 21:58:27 +01:00
Fixed edge case orient_and_align() with 0 height.
This commit is contained in:
parent
10f7d5118f
commit
6180771cf1
@ -153,7 +153,9 @@ function find_anchor(anchor, h, size, size2=undef, shift=[0,0], anchors=[], geom
|
|||||||
botpt = point3d(vmul(size/2,xyal))+DOWN*h/2,
|
botpt = point3d(vmul(size/2,xyal))+DOWN*h/2,
|
||||||
toppt = point3d(vmul(size2/2,xyal)+shift)+UP*h/2,
|
toppt = point3d(vmul(size2/2,xyal)+shift)+UP*h/2,
|
||||||
pos = lerp(botpt, toppt, (anchor.z+1)/2),
|
pos = lerp(botpt, toppt, (anchor.z+1)/2),
|
||||||
sidevec = two_d? point3d(xyal) : rotate_points3d([point3d(xyal)], from=UP, to=toppt-botpt)[0],
|
sidevec = two_d? point3d(xyal) :
|
||||||
|
approx(norm(xyal),0)? [0,0,0] :
|
||||||
|
rotate_points3d([point3d(xyal)], from=UP, to=toppt-botpt)[0],
|
||||||
vec = (
|
vec = (
|
||||||
two_d? sidevec :
|
two_d? sidevec :
|
||||||
anchor==CENTER? UP :
|
anchor==CENTER? UP :
|
||||||
|
@ -135,6 +135,8 @@ function rotate_points3d(pts, a=0, v=undef, cp=[0,0,0], from=undef, to=undef, re
|
|||||||
let (
|
let (
|
||||||
mrot = reverse? (
|
mrot = reverse? (
|
||||||
!is_undef(from)? (
|
!is_undef(from)? (
|
||||||
|
assert(norm(from)>0, "The from argument cannot equal [0,0] or [0,0,0]")
|
||||||
|
assert(norm(to)>0, "The to argument cannot equal [0,0] or [0,0,0]")
|
||||||
let (
|
let (
|
||||||
ang = vector_angle(from, to),
|
ang = vector_angle(from, to),
|
||||||
v = vector_axis(from, to)
|
v = vector_axis(from, to)
|
||||||
@ -149,6 +151,8 @@ function rotate_points3d(pts, a=0, v=undef, cp=[0,0,0], from=undef, to=undef, re
|
|||||||
)
|
)
|
||||||
) : (
|
) : (
|
||||||
!is_undef(from)? (
|
!is_undef(from)? (
|
||||||
|
assert(norm(from)>0, "The from argument cannot equal [0,0] or [0,0,0]")
|
||||||
|
assert(norm(to)>0, "The to argument cannot equal [0,0] or [0,0,0]")
|
||||||
let (
|
let (
|
||||||
from = from / norm(from),
|
from = from / norm(from),
|
||||||
to = to / norm(from),
|
to = to / norm(from),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user