Updates getPointsBetween

This commit is contained in:
Steve Ruiz 2021-06-24 13:56:25 +01:00
parent 062dbafc36
commit cbc26f2e06
3 changed files with 43 additions and 10 deletions

View file

@ -5,6 +5,15 @@ import vec from 'utils/vec'
* ## Utils
*/
export default class Utils {
static getPointsBetween(a: number[], b: number[], steps = 6): number[][] {
return Array.from(Array(steps))
.map((_, i) => {
const t = i / steps
return t * t * t
})
.map((t) => [...vec.lrp(a, b, t), (1 - t) / 2])
}
static getRayRayIntersection(
p0: number[],
n0: number[],