Difference between revisions of "Talk:Bresenham's Line Algorithm"

From RogueBasin
Jump to navigation Jump to search
(reply)
 
Line 19: Line 19:


What is the license for code present on this page?
What is the license for code present on this page?
:See [[RogueBasin:Copyrights]] and the discussions it links to. In short, it's unclear.-[[User:Muscles|Muscles]] ([[User talk:Muscles|talk]]) 04:13, 6 August 2016 (CEST)

Latest revision as of 02:13, 6 August 2016

Here's the shorter variant of function bla in Haskell:

import Data.Tuple
bla :: (Int, Int) -> (Int, Int) -> [(Int, Int)]
bla (x0, y0) (x1, y1) =
  let (dx, dy) = (x1 - x0, y1 - y0)
      (q, p, sw) | abs dx > abs dy = (dx, dy, id)
                 | otherwise       = (dy, dx, swap)
      step b (x, y) = (x + signum q, y + signum p * b)
      walk w xy = xy : walk (tail w) (sw . step (head w) . sw $ xy)
  in walk (balancedWord (abs p) (abs q) 0) (x0, y0)

Terms of usage (license)

What is the license for code present on this page?

See RogueBasin:Copyrights and the discussions it links to. In short, it's unclear.-Muscles (talk) 04:13, 6 August 2016 (CEST)