Skip to content

Commit

Permalink
#12 Fixed bug with interpolation/extrapolation calculating distance i…
Browse files Browse the repository at this point in the history
…ncorrectly
  • Loading branch information
benjamminf committed Dec 2, 2017
1 parent 52d388f commit bf5474d
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions src/Warp.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,12 @@ export default class Warp

function deltaFunction(points)
{
const delta = euclideanDistance(points.slice(0, 2))
const linearPoints = [
points[0].slice(0, 2),
points[points.length - 1].slice(0, 2),
]

const delta = euclideanDistance(linearPoints)
didWork = didWork || (delta > threshold)

return delta
Expand All @@ -72,7 +77,12 @@ export default class Warp

function deltaFunction(points)
{
const delta = euclideanDistance(points.slice(0, 2))
const linearPoints = [
points[0].slice(0, 2),
points[points.length - 1].slice(0, 2),
]

const delta = euclideanDistance(linearPoints)
didWork = didWork || (delta <= threshold)

return delta
Expand All @@ -92,7 +102,12 @@ export default class Warp

function deltaFunction(points)
{
const delta = euclideanDistance(points.slice(0, 2))
const linearPoints = [
points[0].slice(0, 2),
points[points.length - 1].slice(0, 2),
]

const delta = euclideanDistance(linearPoints)
didWork = didWork || (delta > threshold)

return delta
Expand Down Expand Up @@ -122,7 +137,12 @@ export default class Warp

function deltaFunction(points)
{
const delta = euclideanDistance(points.slice(0, 2))
const linearPoints = [
points[0].slice(0, 2),
points[points.length - 1].slice(0, 2),
]

const delta = euclideanDistance(linearPoints)
didWork = didWork || (delta <= threshold)

return delta
Expand Down

0 comments on commit bf5474d

Please sign in to comment.