3 ms·
Wouldn't the exception be for lines whose slope is irrational? (i.e. that can't be represented by a ratio of integers), so the repeating pattern is analogous to
by 6ren 14y ago
Wouldn't the exception be for lines whose slope is irrational? (i.e. that can't be represented by a ratio of integers), so the repeating pattern is analogous to the repeating pattern in a decimal representation of a rational number.
- textminer 14y agoHow does a computer distinguish an irrational number from a good, (necessarily rational) floating-point approximation of one?
- mjcohenw 14y agoThe algorithm only works with points with integer coordinates, so the slope is always rational.
- FredBrach 14y agoI think you have the last words because line drawing algorithms become irrelevant if you use a Floating Point Unit. just: { x++ and y+=slope } or { y++ and x+= 1./slope } Then slopes are always rational in line drawing algorithms.
- ralph 14y agoIf y and slope are floating point in the first block then might not y end at other than the desired endpoint because of accumulative error?
- deleted 14y ago[deleted]
- deleted 14y ago[deleted]