mirror of
https://github.com/revarbat/BOSL2.git
synced 2025-01-16 13:50:23 +01:00
Fixed function scale() for scalar scaling.
This commit is contained in:
parent
6242ec6dd9
commit
f927ac6c10
@ -386,9 +386,10 @@ module zrot(a=0, cp=undef)
|
|||||||
|
|
||||||
// Function&Module: scale()
|
// Function&Module: scale()
|
||||||
// Usage: As Module
|
// Usage: As Module
|
||||||
|
// scale(SCALAR) ...
|
||||||
// scale([X,Y,Z]) ...
|
// scale([X,Y,Z]) ...
|
||||||
// Usage: Scale Points
|
// Usage: Scale Points
|
||||||
// pts = scale(a, pts);
|
// pts = scale(a, p);
|
||||||
// Usage: Get Scaling Matrix
|
// Usage: Get Scaling Matrix
|
||||||
// mat = scale(a);
|
// mat = scale(a);
|
||||||
// Description:
|
// Description:
|
||||||
@ -397,14 +398,16 @@ module zrot(a=0, cp=undef)
|
|||||||
// scaling factors in `a`. When called as a function with a list of points in the `p` argument,
|
// scaling factors in `a`. When called as a function with a list of points in the `p` argument,
|
||||||
// returns the list of points, with each one scaled by the [X,Y,Z] scaling factors in `a`.
|
// returns the list of points, with each one scaled by the [X,Y,Z] scaling factors in `a`.
|
||||||
// Arguments:
|
// Arguments:
|
||||||
// a = The [X,Y,Z] scaling factors.
|
// a = The [X,Y,Z] scaling factors, or a scalar value for uniform scaling across all axes. Default: 1
|
||||||
// p = If called as a function, the point or list of points to scale.
|
// p = If called as a function, the point or list of points to scale.
|
||||||
// Example(NORENDER):
|
// Example(NORENDER):
|
||||||
// pt1 = scale([2,3,4], p=[3,1,4]); // Returns: [6,3,16]
|
// pt1 = scale(3, p=[3,1,4]); // Returns: [9,3,12]
|
||||||
|
// pt2 = scale([2,3,4], p=[3,1,4]); // Returns: [6,3,16]
|
||||||
// pt3 = scale([2,3,4], p=[[1,2,3],[4,5,6]]); // Returns: [[2,6,12], [8,15,24]]
|
// pt3 = scale([2,3,4], p=[[1,2,3],[4,5,6]]); // Returns: [[2,6,12], [8,15,24]]
|
||||||
// mat2d = scale([2,3]); // Returns: [[2,0,0],[0,3,0],[0,0,1]]
|
// mat2d = scale([2,3]); // Returns: [[2,0,0],[0,3,0],[0,0,1]]
|
||||||
// mat3d = scale([2,3,4]); // Returns: [[2,0,0,0],[0,3,0,0],[0,0,4,0],[0,0,0,1]]
|
// mat3d = scale([2,3,4]); // Returns: [[2,0,0,0],[0,3,0,0],[0,0,4,0],[0,0,0,1]]
|
||||||
function scale(a=[1,1,1], p=undef) =
|
function scale(a=1, p=undef) =
|
||||||
|
let(a = is_num(a)? [a,a,a] : a)
|
||||||
is_undef(p)? (
|
is_undef(p)? (
|
||||||
len(a)==2? affine2d_scale(a) : affine3d_scale(point3d(a))
|
len(a)==2? affine2d_scale(a) : affine3d_scale(point3d(a))
|
||||||
) : (
|
) : (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user