{"id":"ethancurtiss/catrom","name":"catrom","scope":"ethancurtiss","platform":"roblox","description":"Mirrored from the Wally registry.","version":"0.5.0","latest":"0.5.0","versions":["0.4.0","0.4.1","0.4.2","0.5.0"],"license":"MIT","licenseRating":"safe","licenseCaveats":["License identified from the packaged LICENSE file; the manifest declared none."],"licenseVerified":true,"dependencies":{},"integrity":"e695e715909f233e618ff397237e382702bf2e9172ec57d7e56c848428cf3bf9","likes":0,"downloads":0,"install":"forest install ethancurtiss/catrom","url":"https://forest.dev/p/roblox/ethancurtiss/catrom","files":"https://api.forest.dev/ai/package/roblox/ethancurtiss/catrom/files","readme":"<div align=\"center\">\r\n\t<img src=\"https://github.com/EthanCurtiss/CatRom/blob/master/docs/logo-light.svg#gh-light-mode-only\" height=\"180\" alt=\"CatRom logo\"/>\r\n\t<img src=\"https://github.com/EthanCurtiss/CatRom/blob/master/docs/logo-dark.svg#gh-dark-mode-only\" height=\"180\" alt=\"CatRom logo\"/>\r\n\t<hr/>\r\n</div>\r\n\r\nCreates [Catmull-Rom splines](https://en.wikipedia.org/wiki/Centripetal_Catmull%E2%80%93Rom_spline).\r\n\r\nThe Catmull-Rom spline (CatRom) is a cousin of the popular Bézier curve, with the key difference that CatRoms are guaranteed to pass through their control points. This allows them to chain together predictably and intuitively.\r\n\r\n<img src=\"docs/tube.png\" height=\"300\"/>\r\n\r\n## How to use\r\nThe CatRom constructor takes 3 arguments:\r\n1. `points`: An array of Vector2s, Vector3s, or CFrames.\r\n2. `alpha` [optional]: A number (usually) in [0, 1] that determines the \"parameterization\" of the spline; defaults to 0.5.\r\n3. `tension` [optional]: A number (usually) in [0, 1] that determines how loose the spline is; defaults to 0.\r\n\r\nThe default `alpha` of 0.5 is the only way to avoid cusps and loops, as shown [in this paper](http://www.cemyuksel.com/research/catmullrom_param/).\r\n\r\n## API\r\n***Note:*** *For each `Solve` method, there exists a `SolveUniform` counterpart that spaces the input(s) uniformly along the curve. Be aware that the uniform methods are slower to compute.*\r\n```lua\r\nCatRom.new(points: array, alpha: number?, tension: number?)\r\n```\r\n```lua\r\nCatRom:SolvePosition(t: number)\r\n```\r\n```lua\r\nCatRom:SolveCFrame(t: number)\r\n```\r\n```lua\r\nCatRom:SolveRotCFrame(t: number)\r\n```\r\n```lua\r\nCatRom:SolveVelocity(t: number)\r\n```\r\n```lua\r\nCatRom:SolveAcceleration(t: number)\r\n```\r\n```lua\r\nCatRom:SolveTangent(t: number)\r\n```\r\n```lua\r\nCatRom:SolveNormal(t: number)\r\n```\r\n```lua\r\nCatRom:SolveBinormal(t: number)\r\n```\r\n```lua\r\nCatRom:SolveCurvature(t: number)\r\n```\r\n```lua\r\nCatRom:SolveLength(a: number?, b: number?)\r\n```\r\n```lua\r\nCatRom:PrecomputeArcLengthParams(numIntervals: number?)\r\n```\r\n\r\n## Performance Tips\r\n### 1. `Uniform` methods\r\nIf you are calling many `Uniform` methods, you should call `PrecomputeArcLengthParams()` immediately after construction. This will make your `Uniform` calls less accurate but cheaper to compute. The accuracy can be further tuned using the `numIntervals` argument; lower is faster and less accurate, higher is slower and more accurate (defaults to 16).\r\n\r\n### 2. Repeated inputs\r\nIf you are calling many methods on the *same* input like so:\r\n```lua\r\nlocal t -- number in [0, 1]\r\nlocal catRom -- a CatRom object\r\ncatRom:SolvePosition(t)\r\ncatRom:SolveVelocity(t)\r\ncatRom:SolveTangent(t)\r\n```\r\nthen it is faster to instead do\r\n```lua\r\nlocal t -- number in [0, 1]\r\nlocal catRom -- a CatRom object\r\nlocal spline, splineT = catRom:GetSplineFromT(t)\r\nspline:SolvePosition(splineT)\r\nspline:SolveVelocity(splineT)\r\nspline:SolveTangent(splineT)\r\n```","readmeTruncated":false}