apply tweak

This commit is contained in:
Adrian Mariano 2021-12-29 18:01:23 -05:00
parent 1d72c91454
commit 6e2929ff9b

View file

@ -1380,10 +1380,9 @@ function _apply(transform,points) =
assert(datadim==2 || datadim==3,"Data must be 2D or 3D") assert(datadim==2 || datadim==3,"Data must be 2D or 3D")
let( let(
scale = len(transform)==tdim ? 1 : transform[tdim][tdim], scale = len(transform)==tdim ? 1 : transform[tdim][tdim],
matrix = [for(i=[0:1:tdim]) [for(j=[0:1:datadim-1]) transform[j][i]/scale]] matrix = [for(i=[0:1:tdim]) [for(j=[0:1:datadim-1]) transform[j][i]]] / scale
) )
tdim==datadim tdim==datadim ? [for(p=points) concat(p,1)] * matrix
? [for(p=points) concat(p,1)] * matrix
: tdim == 3 && datadim == 2 ? : tdim == 3 && datadim == 2 ?
assert(is_2d_transform(transform), str("Transforms is 3D and acts on Z, but points are 2D")) assert(is_2d_transform(transform), str("Transforms is 3D and acts on Z, but points are 2D"))
[for(p=points) concat(p,[0,1])]*matrix [for(p=points) concat(p,[0,1])]*matrix