1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-01-17 22:28:16 +01:00

fix 2D to 3D bugs

This commit is contained in:
Justin Lin 2021-10-01 09:54:47 +08:00
parent fa0e77ebaf
commit 71b6203d9c

View File

@ -42,12 +42,12 @@ module along_with(points, angles, twist = 0, scale = 1.0, method = "AXIS_ANGLE")
[0, 0, 0, 1]
];
function axis_angle_local_ang_vects(j) =
function axis_angle_local_ang_vects(j, pts) =
[
for(i = j; i > 0; i = i - 1)
let(
vt0 = points[i] - points[i - 1],
vt1 = points[i + 1] - points[i],
vt0 = pts[i] - pts[i - 1],
vt1 = pts[i + 1] - pts[i],
a = acos((vt0 * vt1) / (norm(vt0) * norm(vt1))),
v = cross(vt0, vt1)
)
@ -153,8 +153,9 @@ module along_with(points, angles, twist = 0, scale = 1.0, method = "AXIS_ANGLE")
}
}
else {
pts3D = [for(p = points) __to3d(p)];
cumu_rot_matrice = axis_angle_cumulated_rot_matrice(0, [
for(ang_vect = axis_angle_local_ang_vects(leng_points - 2))
for(ang_vect = axis_angle_local_ang_vects(leng_points - 2, pts3D))
m_rotation(ang_vect[0], ang_vect[1])
]);