Anonymous user
Talk:Xiaolin Wu's line algorithm: Difference between revisions
→REXX comment: FPART query. -- ~~~~
(→REXX comment: FPART query. -- ~~~~) |
|||
Line 58:
But, in the sort of context where this line algorithm would be useful that I have seen, screen coordinates are always have been non-negative integers, so in practice this kind of ambiguity should not matter. --[[User:Rdm|Rdm]] 15:52, 4 June 2012 (UTC)
: Yuppers, that's when the trouble starts. Still, an error is an error (even if only by omission or via ambiguousness), and it's especially troublesome when the pseudo-code in the Wikipedia entry doesn't mention the limitations. After I adjusted the IPART to FLOOR, it seems to work, but without others trying negative
:: Ok, but I am not sure how to tell if "floor is the required definition for 'integer part'" is the right way to characterize this issue. I took my implementation and modified the draw point routine so that it adds 100 to the coordinate before rendering to the screen. This gives me a coordinate range for my algorithm which can include negative coordinates. Then, I took my original coordinate range and subtracted 100 from every value. Then, I ran the code -- I did not see any visual artifacts resulting from this set of changes. When I look at my code, I see that I used floor to implement "integer part", but I do not know if I see no visual artifacts because I "just happened to use the right definition for integer part" or whether it's because the visual effect of this issue is too small to notice. I am also wondering whether the issue might really be that the code which extracts the fractional part has to be consistent with the code that extracts the integer part. --[[User:Rdm|Rdm]] 16:34, 4 June 2012 (UTC)
::: Concerning another issue: FPART. When handling negative coödinates, I was wondering if FPART is doing what it's supposed to do, but I couldn't find a good definition of FPART (with regarding to negative numbers). For non-negative numbers, the simple definition of FPART (even if wrong), still gives the correct answer. FPART of 6.78 is +0.78. But what about -8.91 ? Is the fractional part +0.91 or -0.91 ? --- I'm still trying to locate a good definition for it --- I hope the definition isn't tied (or restricted to) any particular computer language. Perhaps someone could find a complete/good definition of FPART in their appropriate language reference documentation. -- [[User:Gerard Schildberger|Gerard Schildberger]] 16:46, 4 June 2012 (UTC)
|