User Tools

Site Tools


base:approximation_to_distance

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revisionBoth sides next revision
base:approximation_to_distance [2020-02-09 14:39] – created djmipsbase:approximation_to_distance [2020-02-09 14:43] djmips
Line 7: Line 7:
  
  
 +The formula is d = max(|xd|, |yd|) + 1/2 × min(|xd|, |yd|) where xd = (x1-x2) and yd = (y1-y2)
  
-Note that for 6502 we can take the approximation even further by noting the coefficient for max is close to one and the coefficient for min is close enough to 1/2 to use that as a faster calculation that's acceptable for a lot of game use.+Note that for 6502 we will use a shift right to calculate the multiply by 1/2.
  
 <code> <code>
base/approximation_to_distance.txt · Last modified: 2020-02-11 01:45 by djmips