Skip to content

Commit

Permalink
CHANGED: Added multi-wirl self-intersections to ZBuffer
Browse files Browse the repository at this point in the history
  • Loading branch information
nkh committed Nov 22, 2023
1 parent 8b11c4a commit 9158ea4
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions lib/App/Asciio/ZBuffer.pm
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@ my $t0 = Time::HiRes::gettimeofday();

for my $element (@elements)
{
my $coordinates = $self->get_coordinates($element) ;
my $glyphs = $self->get_glyphs($element) ;

while (my ($coordinate, $char) = each $coordinates->%*)
for my $glyph ($glyphs->@*)
{
my ($coordinate, $char) = $glyph->@* ;

if($self->{KEEP_INTERSECTIONS} && exists $self->{coordinates}{$coordinate})
{
unshift $self->{intersecting_elements}{$coordinate}->@*, $self->{coordinates}{$coordinate}
Expand All @@ -50,10 +52,10 @@ for my $element (@elements)

# ------------------------------------------------------------------------------

sub get_coordinates
sub get_glyphs
{
my ($self, $element) = @_ ;
my %coordinates ;
my @glyphs ;

for my $strip (@{$element->get_stripes})
{
Expand All @@ -67,7 +69,7 @@ for my $strip (@{$element->get_stripes})
{
my $Y = $element->{Y} + $strip->{Y_OFFSET} + $line_index ;
my $X = $element->{X} + $strip->{X_OFFSET} + $character_index ;
$coordinates{"$Y;$X"} = $char ;
push @glyphs, [ "$Y;$X", $char] ;

$character_index++ ;
}
Expand All @@ -76,7 +78,7 @@ for my $strip (@{$element->get_stripes})
}
}

return \%coordinates ;
return \@glyphs ;
}

# ------------------------------------------------------------------------------
Expand Down

0 comments on commit 9158ea4

Please sign in to comment.