Login   Register  
PHP Classes
elePHPant
Icontem

File: example

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Chi Hoang  >  PHP Voronoi Diagram  >  example  >  Download  
File: example
Role: Example script
Content type: text/plain
Description: example
Class: PHP Voronoi Diagram
Generate a voronoi diagram for a set of points
Author: By
Last change: Fix error reporting (division by zero)
Date: 6 months ago
Size: 790 bytes
 

Contents

Class file image Download
<?php

/***************************************************************
* Copyright notice
*
* (c) 2010-2013 Chi Hoang (info@chihoang.de)
*  All rights reserved
*
***************************************************************/
require_once("voronoi.php");
 
// Turn off all error reporting
error_reporting(0);

// example 1
$triangle=new voronoi();
$triangle->main();

$vis=new visualize("/tmp/",$triangle);
$vis->genimage();
      
//example2
$set=array();
$tree=array(172,31,238,106,233,397,118,206,58,28,268,382,10,380,342,26,67,371,380,14,382,200,24,200,194,190,10,88,276);
for (
$i=0,$end=count($tree);$i<$end;$i+=2)
{
    
$set[]=array($tree[$i],$tree[$i+1]);    
}
$triangle->main($set);
 
$vis=new visualize("/tmp/",$triangle);
$vis->genimage(); 

?>