Login   Register  
PHP Classes
elePHPant
Icontem

File: usage.txt

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Ovunc Tukenmez  >  PHP Circles Intersection  >  usage.txt  >  Download  
File: usage.txt
Role: Documentation
Content type: text/plain
Description: documentation
Class: PHP Circles Intersection
Find the intersection points between two circles
Author: By
Last change:
Date: 2013-11-10 05:02
Size: 1,084 bytes
 

Contents

Class file image Download
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();