Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
ecurtiss committed Apr 2, 2022
1 parent 5a1c066 commit 886282f
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,29 @@ CatRom:SolveCurvature(t: number)
```lua
CatRom:SolveLength(a: number?, b: number?)
```
```lua
CatRom:PrecomputeArcLengthParams(numIntervals: number?)
```

## Performance Tips
### 1. `Uniform` methods
If 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).

### 2. Repeated inputs
If you are calling many methods on the *same* input like so:
```lua
local t -- number in [0, 1]
local catRom -- a CatRom object
catRom:SolvePosition(t)
catRom:SolveVelocity(t)
catRom:SolveTangent(t)
```
then it is faster to instead do
```lua
local t -- number in [0, 1]
local catRom -- a CatRom object
local spline, splineT = catRom:GetSplineFromT(t)
spline:SolvePosition(splineT)
spline:SolveVelocity(splineT)
spline:SolveTangent(splineT)
```

0 comments on commit 886282f

Please sign in to comment.