You are here

function pImage::getAngle in Visitors 7

Same name and namespace in other branches
  1. 7.2 pChart/class/pImage.class.php \pImage::getAngle()

File

pChart/class/pImage.class.php, line 184

Class

pImage

Code

function getAngle($X1, $Y1, $X2, $Y2) {
  $Opposite = $Y2 - $Y1;
  $Adjacent = $X2 - $X1;
  $Angle = rad2deg(atan2($Opposite, $Adjacent));
  if ($Angle > 0) {
    return $Angle;
  }
  else {
    return 360 - abs($Angle);
  }
}