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