First of all, let me say that I am absolutely brutal in mathematics, please bear with me.
I am trying to calculate the angle between two points on a circle, with two points being the distance the user has dragged for a certain amount of time.
This is what I still have:
intervalId = setInterval(function(){
if(p1x != undefined){
p2x = Xpos;
}
if(p1y != undefined){
p2y = Ypos;
}
if( p1x != p2x || p1y != p2y ){
p1a = p1x - wheelMiddleVer;
p1b = p1y - wheelMiddleHor;
a = Math.sqrt((p1a * p1a) + (p1b * p1b));
p2a = p2x - wheelMiddleVer;
p2b = p2y - wheelMiddleHor;
b = Math.sqrt((p2a * p2a) + (p2b * p2b));
u = p1x - p2x;
v = p1y - p2y;
c = Math.sqrt((u * u) + (v * v));
}
p1x = Xpos;
p1y = Ypos;
}, 1000);
I am not sure how to finish it. I tried to use the formula cos A = (b ^ 2 + c ^ 2 - a ^ 2) / 2bc, but this did not work for me. I will appreciate your contribution to this. If I can make the question clearer, let me know.
styke source
share