1
0
mirror of https://github.com/nophead/NopSCADlib.git synced 2025-08-17 20:53:00 +02:00

Update maths.scad

This commit is contained in:
Alex Verschoot
2025-03-02 23:01:20 +01:00
committed by GitHub
parent dc683ed701
commit 6467de5fac

View File

@@ -192,11 +192,6 @@ function path_length(path, i = 0, length = 0) = //! Calculated the length along
i >= len(path) - 1 ? length i >= len(path) - 1 ? length
: path_length(path, i + 1, length + norm(path[i + 1] - path[i])); : path_length(path, i + 1, length + norm(path[i + 1] - path[i]));
function rotate_vector_2d(v, angle) = [
v[0] * cos(angle) - v[1] * sin(angle),
v[0] * sin(angle) + v[1] * cos(angle)
];
function rotate_vector_2d(v, angle) = [ function rotate_vector_2d(v, angle) = [
v[0] * cos(angle) - v[1] * sin(angle), v[0] * cos(angle) - v[1] * sin(angle),
v[0] * sin(angle) + v[1] * cos(angle) v[0] * sin(angle) + v[1] * cos(angle)
@@ -219,4 +214,4 @@ function rotate_vector_3d(v, axis, angle) = let(
mat[0][0]*v[0] + mat[0][1]*v[1] + mat[0][2]*v[2], mat[0][0]*v[0] + mat[0][1]*v[1] + mat[0][2]*v[2],
mat[1][0]*v[0] + mat[1][1]*v[1] + mat[1][2]*v[2], mat[1][0]*v[0] + mat[1][1]*v[1] + mat[1][2]*v[2],
mat[2][0]*v[0] + mat[2][1]*v[1] + mat[2][2]*v[2] mat[2][0]*v[0] + mat[2][1]*v[1] + mat[2][2]*v[2]
]; ];