Skip to content

Instantly share code, notes, and snippets.

@dmgctrlr
Created April 27, 2016 16:09
Show Gist options
  • Save dmgctrlr/7dcf8b9f942c2f964546e78816480ef6 to your computer and use it in GitHub Desktop.
Save dmgctrlr/7dcf8b9f942c2f964546e78816480ef6 to your computer and use it in GitHub Desktop.
<?php
$places = array(
0 =>
array(
0 => '-112.121262',
1 => '33.416515',
),
1 =>
array(
0 => '-112.064830',
1 => '33.419762',
),
2 =>
array(
0 => '-112.050127',
1 => '33.706717',
),
3 =>
array(
0 => '-112.105545',
1 => '33.688492',
),
4 =>
array(
0 => '-111.945614',
1 => '33.290901',
),
5 =>
array(
0 => '-111.663908',
1 => '33.342023',
),
6 =>
array(
0 => '-111.993568',
1 => '33.424774',
),
7 =>
array(
0 => '-111.787722',
1 => '33.504458',
),
8 =>
array(
0 => '-111.857654',
1 => '33.442678',
),
);
$bbox = new stdClass();
$bbox->xl = -114;
$bbox->xr = -110;
$bbox->yt = 31;
$bbox->yb = 34;
$sites = [];
foreach( $places as $place )
{
$point = new Nurbs_Point( $place[0], $place[1] );
$sites[] = $point;
}
// Compute the diagram
$voronoi = new Voronoi();
$diagram = $voronoi->compute( $sites, $bbox );
print_r( $diagram );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment