diff --git a/tests/test_vectors.scad b/tests/test_vectors.scad index 2e00705..1aa7a91 100644 --- a/tests/test_vectors.scad +++ b/tests/test_vectors.scad @@ -41,8 +41,9 @@ test_vceil(); module test_vmul() { - assert(vmul([3,4,5], [8,7,6]) == [24,28,30]); - assert(vmul([1,2,3], [4,5,6]) == [4,10,18]); + assert_equal(vmul([3,4,5], [8,7,6]), [24,28,30]); + assert_equal(vmul([1,2,3], [4,5,6]), [4,10,18]); + assert_equal(vmul([[1,2,3],[4,5,6],[7,8,9]], [[4,5,6],[3,2,1],[5,9,3]]), [32,28,134]); } test_vmul(); diff --git a/vectors.scad b/vectors.scad index 3b83eda..f63fca1 100644 --- a/vectors.scad +++ b/vectors.scad @@ -59,16 +59,15 @@ function vang(v) = // Function: vmul() // Description: -// Element-wise vector multiplication. Multiplies each element of vector `v1` by -// the corresponding element of vector `v2`. The vectors should have the same dimension. -// Returns a vector of the products. +// Element-wise multiplication. Multiplies each element of `v1` by the corresponding element of `v2`. +// Both `v1` and `v2` must be the same length. Returns a vector of the products. // Arguments: // v1 = The first vector. // v2 = The second vector. // Example: // vmul([3,4,5], [8,7,6]); // Returns [24, 28, 30] function vmul(v1, v2) = - assert( is_vector(v1) && is_vector(v2,len(v1)), "Incompatible vectors") + assert( is_list(v1) && is_list(v2) && len(v1)==len(v2), "Incompatible input") [for (i = [0:1:len(v1)-1]) v1[i]*v2[i]]; diff --git a/version.scad b/version.scad index 9d80cf4..f496c36 100644 --- a/version.scad +++ b/version.scad @@ -8,7 +8,7 @@ ////////////////////////////////////////////////////////////////////// -BOSL_VERSION = [2,0,434]; +BOSL_VERSION = [2,0,435]; // Section: BOSL Library Version Functions