<?php
/*
Images
© Charles Chandler
http://qdl.scs-inc.us/?top=12811
*/
/*
http://127.0.0.1/SCS/Other/QuickDisclosure/2ndParty/Images/Charles/Plasmas/GIF_Build.php
*/
function SortByZ($pt1, $pt2) {
if ($pt1['z'] == $pt2['z']) { return 0; }
elseif ($pt1['z'] < $pt2['z']) { return -1; }
else { return 1; }
}
include('Functions.php');
define('max32bitSignedInt', pow(2, 31));
$minX = max32bitSignedInt;
$minY = max32bitSignedInt;
$maxX = -max32bitSignedInt;
$maxY = -max32bitSignedInt;
$showAxes = 'yz';
$showAxes = 'xz';
$showAxes = 'xy';
echo '$showAxes: '.$showAxes.'<br />';
foreach(DirList('Points') as $file) {
$img = ImageCreateFromGIF('Blank.gif');
$red = ImageColorAllocate($img, 255, 0, 0);
$blue = ImageColorAllocate($img, 0, 0, 255);
include('Points/'.$file);
usort($points, 'SortByZ');
foreach($points as $pt) {
$minX = min($minX, $pt['x']); $maxX = max($maxX, $pt['x']);
$minY = min($minY, $pt['y']); $maxY = max($maxY, $pt['y']);
// Shift the numbers into the positive range for all
// of them, and multiple by 10, for a 840x720 image.
$color = ($pt['r']) ? $blue : $red;
if ($showAxes == 'xy') {
$x = ($pt['x'] + 42) * 10;
$y = ($pt['y'] + 36) * 10;
ImageSetPixel($img, $x, $y, $color);
}
elseif ($showAxes == 'xz') {
$x = ($pt['x'] + 42) * 10;
$z = ($pt['z'] + 36) * 10;
ImageSetPixel($img, $x, $z, $color);
}
elseif ($showAxes == 'yz') {
$y = ($pt['y'] + 41) * 10;
$z = ($pt['z'] + 36) * 10;
ImageSetPixel($img, $y, $z, $color);
}
}
ImageGIF($img, 'Images/'.$showAxes.StripOneTailer($file, '.php').'.gif');
echo '$minX: '.$minX.'<br />';
echo '$maxX: '.$maxX.'<br />';
echo '$minY: '.$minY.'<br />';
echo '$maxY: '.$maxY.'<br />';
}
?>
|