Bugfix: random misalignment of the 3D Honeycomb pattern

This commit is contained in:
Alessandro Ranellucci 2014-12-29 14:42:41 +01:00
parent d38503bf44
commit 67d7658c59

View File

@ -19,12 +19,14 @@ sub fill_surface {
my $distance = scale($self->spacing) / $params{density};
# align bounding box to a multiple of our honeycomb grid
# align bounding box to a multiple of our honeycomb grid module
# (a module is 2*$distance since one $distance half-module is
# growing while the other $distance half-module is shrinking)
{
my $min = $bb->min_point;
$min->translate(
-($bb->x_min % $distance),
-($bb->y_min % $distance),
-($bb->x_min % (2*$distance)),
-($bb->y_min % (2*$distance)),
);
$bb->merge_point($min);
}