Skip to content

Commit

Permalink
linker fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Geary-Layne committed Dec 13, 2023
1 parent f67338a commit a2713fd
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions python/idsse_common/idsse/common/vectaster.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from shapely import Geometry, LinearRing, LineString, Point, Polygon, from_wkt

from idsse.common.grid_proj import GridProj, RoundingMethod
from idsse.common.utils import round_half_away as round
from idsse.common.utils import round_half_away as round_

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -297,6 +297,7 @@ def _pixels_for_linestring(
return pixels


# pylint: disable=invalid-name
def _pixels_for_line_seg(
pnt1: Tuple[float, float],
pnt2: Tuple[float, float],
Expand Down Expand Up @@ -325,22 +326,23 @@ def _pixels_for_line_seg(
if dx != 0 and -1 <= slope <= 1:
intercept = y1 - slope * x1
dx = 1 if x2 > x1 else -1
while (x1 != x2):
while x1 != x2:
x1 += dx
y1 = round(slope * x1 + intercept)
y1 = round_(slope * x1 + intercept)
pixels.append((int(x1), y1))
else:
slope = float(dx) / float(dy) if dy else 0
intercept = x1 - slope * y1
dy = 1 if y2 > y1 else -1
while (y1 != y2):
while y1 != y2:
y1 += dy
x1 = round(slope * y1 + intercept)
x1 = round_(slope * y1 + intercept)
pixels.append((x1, int(y1)))

return pixels


# pylint: disable=too-many-locals
def _pixels_for_polygon(
polygon_boundary: LinearRing
) -> List[Pixel]:
Expand Down Expand Up @@ -389,7 +391,7 @@ def _round_x_y(x, y, rounding: Union[str, RoundingMethod]) -> Pixel:
rounding = RoundingMethod[rounding.upper()]

if rounding is RoundingMethod.ROUND:
return (round(x), round(y))
return (round_(x), round_(y))
if rounding is RoundingMethod.FLOOR:
return (floor(x), floor(y))
return (int(x), int(y))

0 comments on commit a2713fd

Please sign in to comment.