mirror of
https://github.com/revarbat/BOSL2.git
synced 2025-01-16 21:58:27 +01:00
Added vquant(), vquantup(), vquantdn()
This commit is contained in:
parent
55ff7f3a93
commit
668b6de199
33
vectors.scad
33
vectors.scad
@ -49,6 +49,39 @@ function vabs(v) = [for (x=v) abs(x)];
|
||||
function normalize(v) = v/norm(v);
|
||||
|
||||
|
||||
// Function: vquant()
|
||||
// Usage:
|
||||
// vquant(v,m)
|
||||
// Description:
|
||||
// Quantizes each scalar in the vector `v` to an integer multiple of `m`, rounding to the nearest multiple.
|
||||
// Arguments:
|
||||
// v = The vector to quantize.
|
||||
// m = The multiple to quantize to.
|
||||
function vquant(v,m) = [for (x=v) quant(x,m)];
|
||||
|
||||
|
||||
// Function: vquantdn()
|
||||
// Usage:
|
||||
// vquantdn(v,m)
|
||||
// Description:
|
||||
// Quantizes each scalar in the vector `v` to an integer multiple of `m`, rounding down to the nearest multiple.
|
||||
// Arguments:
|
||||
// v = The vector to quantize.
|
||||
// m = The multiple to quantize to.
|
||||
function vquantdn(v,m) = [for (x=v) quantdn(x,m)];
|
||||
|
||||
|
||||
// Function: vquantup()
|
||||
// Usage:
|
||||
// vquantup(v,m)
|
||||
// Description:
|
||||
// Quantizes each scalar in the vector `v` to an integer multiple of `m`, rounding up to the nearest multiple.
|
||||
// Arguments:
|
||||
// v = The vector to quantize.
|
||||
// m = The multiple to quantize to.
|
||||
function vquantup(v,m) = [for (x=v) quantup(x,m)];
|
||||
|
||||
|
||||
// Function: vector_angle()
|
||||
// Usage:
|
||||
// vector_angle(v1,v2);
|
||||
|
Loading…
x
Reference in New Issue
Block a user