USAGE:
First, instantiate class:
$sample_class = new IntersectionPointsOf2Circles($circle1_center_x, $circle1_center_y, $radius_of_circle1, $circle2_center_x, $circle2_center_y, $radius_of_circle2);
It is possible to change circles later by calling setCircle1() and setCircle2 methods.
$sample_class->setCircle1($circle1_center_x, $circle1_center_y, $radius_of_circle1);
$sample_class->setCircle2($circle2_center_x, $circle2_center_y, $radius_of_circle2);
You can check if two circles are same with getIfTheCirclesAreSame() method.
$result = $sample_class->getIfTheCirclesAreSame(); //if the result is "true" then there are infinite points.
Call getPoints() methot to get intersection points as array
Returned array format:
array(
array('x' => "x coordinate of the point",
'y' => "y coordinate of the point"
), ...)
Note: if 2 circles are same or there is no intersection points, getPoints() method will return an empty array.
You can get distance between two circles centers using getDistance() method
$distance = $sample_class->getDistance(); |