Interp fix math
This commit is contained in:
@@ -78,8 +78,8 @@ function placeNearToNearestNeighbour(node, minNode, sample, sampleCache, radius)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var angle = binarySearch(lowBound, highBound, minNode.x, minNode.y, radius, node, sample, sampleCache);
|
let angle = binarySearch(lowBound, highBound, minNode.x, minNode.y, radius, node, sample, realDistances);
|
||||||
var newPoint = centerPoint(angle, radius, minNode.x, minNode.y);
|
let newPoint = centerPoint(angle, radius, minNode.x, minNode.y);
|
||||||
|
|
||||||
// console.log(newPoint);
|
// console.log(newPoint);
|
||||||
node.x = newPoint.x;
|
node.x = newPoint.x;
|
||||||
@@ -94,10 +94,11 @@ function placeNearToNearestNeighbour(node, minNode, sample, sampleCache, radius)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// With a circle radius r, and center at (h,k),
|
||||||
function centerPoint(angle, radius, posX, posY) {
|
// Find the coordinate of a point at angle degree
|
||||||
var x = posX + Math.cos(toRadians(angle) * radius);
|
function pointOnCircle(h, k, angle, r) {
|
||||||
var y = posY + Math.sin(toRadians(angle) * radius);
|
let x = h + r*Math.cos(toRadians(angle));
|
||||||
|
let y = k + r*Math.sin(toRadians(angle));
|
||||||
|
|
||||||
return {
|
return {
|
||||||
x: x,
|
x: x,
|
||||||
|
|||||||
Reference in New Issue
Block a user