dmnsgn / frenet-serret-frames

Compute Frenet-Serret frames for a path of 3D points and tangents.
https://dmnsgn.github.io/frenet-serret-frames/
MIT License
25 stars 3 forks source link

clamp causes closed path frames not meet #10

Closed vorg closed 1 year ago

vorg commented 1 year ago

Do we know why clamp is here? https://github.com/dmnsgn/frenet-serret-frames/blob/main/index.js#L110

let theta = Math.acos(clamp(vec3.dot(firstNormal, lastNormal), 0, 1));
theta /= frames.length - 1;

Screenshot 2023-07-10 at 10 59 01

Removing clamp fixes the issue.

dmnsgn commented 1 year ago

It should actually be clamp between -1 and 1. Will fix in the next version.

dmnsgn commented 1 year ago

Fixed in v3.0.0