Algorithm-ClusterPoints
view release on metacpan or search on metacpan
example/draw.pl view on Meta::CPAN
# Minimum: 21.097507
# Maximum: 24.912207
# Mean: 22.474358
# Standard Deviation: 0.974835
my ($n, $pixels, $out) = @ARGV;
$pixels ||= 1024;
$n ||= 100000;
$out ||= 'image.png';
open my $fh, '>', $out
or die "unable to open $out: $!";
my $xmin = 21.097507;
my $xmax = 24.912207;
my $ymin = 10.318842;
my $ymax = 14.124424;
my $dx = $xmax - $xmin;
example/draw.pl view on Meta::CPAN
my @colors = map { $im->colorAllocate(map int(256 * rand), 0..2) } 0..128;
for (@clusters) {
my $color = $colors[@colors*rand];
for (@$_) {
my ($x, $y) = $clp->point_coords($_);
$im->setPixel($x * $scale, $y * $scale, $color);
}
}
print $fh $im->png;
example/draw2.pl view on Meta::CPAN
# Minimum: 21.097507
# Maximum: 24.912207
# Mean: 22.474358
# Standard Deviation: 0.974835
my ($n, $pixels, $out) = @ARGV;
$pixels ||= 1024;
$n ||= 100000;
$out ||= 'image2.png';
open my $fh, '>', $out
or die "unable to open $out: $!";
my $xmin = 21.097507;
my $xmax = 24.912207;
my $ymin = 10.318842;
my $ymax = 14.124424;
my $dx = $xmax - $xmin;
example/draw2.pl view on Meta::CPAN
my @colors = map { $im->colorAllocate(map int(256 * rand), 0..2) } 0..128;
for (@clusters) {
my $color = $colors[@colors*rand];
for (@$_) {
my ($x, $y) = $clp->point_coords($_);
$im->setPixel($x * $scale, $y * $scale, $color);
}
}
print $fh $im->png;
( run in 0.804 second using v1.01-cache-2.11-cpan-df04353d9ac )