mirror of
https://github.com/BelfrySCAD/BOSL2.git
synced 2025-12-08 03:41:55 +00:00
Added vquant(), vquantup(), vquantdn()
This commit is contained in:
parent
55ff7f3a93
commit
668b6de199
1 changed files with 33 additions and 0 deletions
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…
Reference in a new issue