Releases: kjerandp/curve-interpolator
Release 3.3.1
Release 3.3.0
Breaking changes
- The legacy features have now been removed from this package. This includes the CurveInterpolator2D class and the old curve functions
Changes
- Added implementation of getFrenetFrames() for 2d curves for completeness sake. In the 2d case, only the tangents and normals (90 degrees count-clockwise rotation of tangent) will be returned (no binormals).
- Removed legacy code
Release 3.2.0
- Added function getFrenetFrames to CurveInterpolator. This function calculates the tangents, normals and binormals for given a number of segments for a 3d curve. The implementation is an adapted copy from the implementation of the same thing found in the curve class in THREE.js and I included it in this library because its so useful. Creds to the devs @ THREE.js (https://github.com/mrdoob/three.js).
- Some internal housekeeping
Release 3.1.1
- Fixed issue #30
Release 3.1.0
A complete re-write of the library for a better developer experience, improved performance and of course, some new features.
New features:
- get curvature at any point or time along the curve
- get nearest position on curve from a given point
- get normal and tangent at any point or time
- convenience functions added to get position or time at knot points
- convenience functions added for mapping between position (u) and time (t)
- convenience functions added for mapping between length and normalized length/position (u)
- convenience functions added for iterating over a range of the curve (map, reduce and forEach)
- numerical integral method now used as default for calculating length and mapping between time and position (if arcDivisions option = 0 or not provided)
- improved performance and accuracy
Some existing functions are still available, but marked as deprecated and put into the legacy folder in the source code. These will be removed from the library shortly.
As this is a rewrite of the library from the ground up, there are a a few breaking changes to be aware of:
- CurveInterpolator.getT is now named CurveInterpolator.getTimeFromPosition
- CurveInterpolator.lookup is now named CurveInterpolator.getIntersects
- CurveInterpolator.lookupPositions is now named CurveInterpolator.getIntersectsAsPositions
If you used any of the old core functions, like getPointAtT , getTangentAtT etc. you should now instantiate and use the CurveInterpolator class. The reason for this is to allow caching of coefficients and other pre-calculated values. The CurveInterpolator has functions such as CurveInterpolator.getPointAtTime and CurveInterpolator.getTangentAtTime etc. that serves the same purpose.
Please report an issue if you find a bug, have issues migrating to the new version or just have questions. Hope you find this library useful!
Take a look at the new demo at ObservableHQ: https://observablehq.com/@kjerandp/curve-interpolator-demo
Release 3.0.1
Fixed issue where calculating arc lengths would fail when input points contained adjacent duplicates
Release 3.0.0
What's Changed
- Update core to use Barry and Goldman's pyramidal formulation to allow for non-uniform knot sequences. This introduces the new parameter alpha (0-1) to control the distribution of t where 0 = uniform, 0.5 = centripetal and 1 = chordal. The alpha parameter is particular useful if the control points are irregular to avoid loops and cusps. This introduce breaking changes to the exported core functions, where the chord sequence now is a required parameter. The chord sequence can be obtained by calling calcChordSequence, which accepts the four control points for a spline and an alpha value. The main CurveInterpolator class does not have any breaking changes, but now accepts a value for alpha in the options. (https://en.wikipedia.org/wiki/Centripetal_Catmull%E2%80%93Rom_spline)
- Change to how control points are extrapolated at beginning and end segments of curves.
Release 2.0.8
Fixes issue #8
Release 2.0.7
- Fixed typescript definition reference, ref PR #7
Release 2.0.6
Extrapolation of input points, when less than 4 control points was provided, cause some undesired behaviour. After recent changes in the core, this wasn't needed anymore, so removing it completely proved to be a complete fix for issue #5, instead of the workaround in 2.0.5.