PHP Classes

PHP Weighted Voronoi Diagram: Render an additively weighted voronoi diagram

Recommend this page to a friend!
  Info   Example   Screenshots   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 145 All time: 9,143 This week: 524Up
Version License PHP version Categories
awvd 0.1BSD License4Algorithms, Graphics, Geography
Description 

Author

This package can render an additively weighted Voronoi diagram.

There is a package that takes a set of points of builds a Voronoi tree.

Another class renders the additively weighted diagram from the points defined by the Voronoi tree.

Innovation Award
PHP Programming Innovation award nominee
October 2014
Number 8


Prize: One year server license IP to country, region, city, latitude, longitude, ZIP code, time zone, area code database
Voronoi diagrams are used to present regions on a plane defined by points that are close to each other.

This class that can render the additively weighted variation of a Voronoi diagram.

Manuel Lemos
Picture of Chi H.
  Performance   Level  
Name: Chi H. <contact>
Classes: 28 packages by
Country: France France
Age: 39
All time rank: 33922 in France France
Week rank: 192 Up13 in France France Up
Innovation award
Innovation award
Nominee: 22x

Winner: 3x

Example

<?php

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

// example 1
$set=array();
$tree=array(145,136,103,141,305,209,127,65,502,80,310,942,206,316,300,259,222,651,3,305,698,355,387,324,175,133,503,232,386,247,118,289,857,42,341,225,65,149,964,324,208,714,386,77,107);
for (
$i=0,$end=count($tree);$i<$end;$i+=3)
{
// $set[]=array($tree[$i],$tree[$i+1],$tree[$i+2]);
}
$tri=new voronoi();
$set=$tri->main();
list(
$tree,$size)=$tri->buildtree($set);

$nearest=new nearestneighbor();
//$p=new Point(12,322);
$p=new Point(60,60);
//$p=new Point(26,229);
$find=$nearest->main($tri,$tree,$p);
$nearest->show($tri,$find,0,$p);

//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,331);
//for ($i=0,$end=count($tree);$i<$end;$i+=2)
//{
// $set[]=array($tree[$i],$tree[$i+1]);
//}
//$tri=new voronoi();
//list($tree,$size)=$tri->buildtree($set);

//$nearest=new nearestneighbor();
//$p=new Point(12,322);
//$p=new Point(160,160);
//$p=new Point(326,229);
//$p=new Point(188,298);

//$find=$nearest->main($tri,$tree,$p);
//$nearest->show($tri,$find,0,$p);

// experimental point-in-polygon
//=$nearest->polytest($tri,0,$p);
//$find=$nearest->polytest($tri,$size-4,$p);
?>


Screenshots (1)  
  • screenshot.png
  Files folder image Files (3)  
File Role Description
Accessible without login Plain text file example.php Example example class
Plain text file main.php Class main class

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:145
This week:0
All time:9,143
This week:524Up