You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The field-of-view algorithm traces out a circle and scans lines to the center point. The problem is that this can miss points adjacent to the boundary that should be within the field-of-view.
#55 provides an alternate version of the Bresenham circle that jumps either in x or y (not both) to include these interior points in the set of locations to scan from, and makes some corresponding changes to tests. I did not want to replace the classic Bresenham algorithm, but it doesn't appear to be used elsewhere in the library so it might make sense to remove it and only use the new version.
The text was updated successfully, but these errors were encountered:
For instance, the upper left quadrant for the FOV with range 5 appears to be (where X are the visible squares):
XXX
X XX
X XXX
X XXXX
XXXXXX
XXXXX@
The blank squares inside should be within the view radius, but happen to not quite be included in any of the lines scanned from the edge to the center.
The suggested solution I linked is to change the circle traced out from this (now the edge is marked with # for emphasis):
###
# XX
# XXX
# XXXX
#XXXXX
#XXXX@
to this:
###
##XX
##XXX
##XXXX
#XXXXX
#XXXX@
so now these points are included in the visible range.
The field-of-view algorithm traces out a circle and scans lines to the center point. The problem is that this can miss points adjacent to the boundary that should be within the field-of-view.
#55 provides an alternate version of the Bresenham circle that jumps either in x or y (not both) to include these interior points in the set of locations to scan from, and makes some corresponding changes to tests. I did not want to replace the classic Bresenham algorithm, but it doesn't appear to be used elsewhere in the library so it might make sense to remove it and only use the new version.
The text was updated successfully, but these errors were encountered: