dinhmenh_gp
0 Follower1 Following
“Vũ, 11:27 CH
getRotate: function(startPoint, endPoint){
var degrees = 0;
if( startPoint.hasOwnProperty('x') ){
if(startPoint.x == endPoint.x || startPoint.y == endPoint.y)
return 0;
degrees = Math.asin( (endPoint.x - startPoint.x) / startPoint.distanceTo(endPoint) );
if(endPoint.y > startPoint.y)
degrees = Math.PI - degrees;
}else{
if( startPoint.lat == endPoint.lat || startPoint.lng == endPoint.lng )
return 0;
var comparePoint = new L.LatLng(endPoint.lat, startPoint.lng);
degrees = Math.asin( comparePoint.distanceTo(endPoint) / endPoint.distanceTo(startPoint) );
if(endPoint.lat > startPoint.lat){
if(endPoint.lng > startPoint.lng)
degrees = Math.PI + degrees;
else
degrees = Math.PI/2 + degrees;
}else{
if(endPoint.lng > startPoint.lng)
degrees = 2*Math.PI - degrees;
}
degrees += Math.PI;
}
return degrees;
},”
Chém gió tại:
#gaming laptop#bảo dưỡng xe