Add a foreach_add helper function

This commit is contained in:
Arthur Moore 2024-10-05 14:49:06 -04:00
parent fa51cd0e7e
commit 1ee99f9c6f

View file

@ -173,6 +173,17 @@ function affine_scale(vector) = [
[0, 0, 0, 1]
];
/**
* @brief Add something to each element in a list.
* @param list The list whos elements will be modified.
* @param to_add
* @returns a list with `to_add` added to each element in the list.
*/
function foreach_add(list, to_add) =
assert(is_list(list))
assert(!is_undef(to_add))
[for (item = list) item + to_add];
/**
* @brief Create a rectangle with rounded corners by sweeping a 2d object along a path.
* @Details Centered on origin.