Documentation / Snap / distanceSquaredBetween
distanceSquaredBetween() 
ts
function distanceSquaredBetween<Animating, Point>(point, currentState): number;Defined in: ../../extensions/src/snap.ts:266
Measures the squared euclidean distance between the point and the currentState across the features in the point.
Type Parameters 
Animating 
Animating extends Animatable<unknown>
Point 
Point extends PartialRecursiveAnimatable<Animating>
Parameters 
point 
Point
An arbitrary point ex. if Animating = {x: number, y: number, z: number} then point could be {x: number, y: number}
currentState 
Animatable<Animating>
Returns 
number
The squared euclidean distance between the point and the currentState across the features in the point.
Example 
ts
const anim = createAnimation({x: 0, y: 0, z: 0}, getLinearInterp(1))
const point = {x: 1, y: 1}
const distSquared = distanceSquaredBetween(point, getStateTree(anim)) // 2