[comp.sys.amiga.tech] Problems with clipping

rmal@cernvax.UUCP (richard lucock) (06/11/90)

I have a program to draw a set of vectors to a window, with an option
to zoom in towards the origin. The vectors are scaled so that at x1.0
magnification, they just fit into the window.  When zooming, I don't
bother to clip the vectors myself, since this should be done by the amiga
routines.  For the first few 'zoom steps', I have no problems.  However, I
find that when the vectors get very long (eg coordinates of +/-20000)
funny things happen - the lines are draw outside the window area, wrap
around the screen (off at the top, on again at the bottom) etc.

I have checked that the coordinate *are* still within the range of the
variable types required by the drawing routines.

The data I am using at the moment is such that the *start* point of all
vectors *is* in the window area, at all times, for all zoom factors.

I have tried this both with the Move()/Draw() routines, and with the
DrawBorder() routine to draw IntuiBorder structures. I get the same
problem in both cases.

Since I am drawing to a window, via its RastPort, and windows use the layers
library, I would have thought that nothing should appear outside the
window area. Is this a known problem ? Is there some work around for it
(other than doing my own clipping) ?

Thanks,
	Richard

jesup@cbmvax.commodore.com (Randell Jesup) (06/12/90)

In article <1959@cernvax.UUCP> rmal@cernvax.UUCP (richard lucock) writes:
>routines.  For the first few 'zoom steps', I have no problems.  However, I
>find that when the vectors get very long (eg coordinates of +/-20000)
>funny things happen - the lines are draw outside the window area, wrap
>around the screen (off at the top, on again at the bottom) etc.
>
>I have checked that the coordinate *are* still within the range of the
>variable types required by the drawing routines.

	graphics and maybe layers have trouble dealing with positions
that are more 16 or 32K from 0,0.  The problem is that somethings are
manipulated in WORDs (such as pixel positions).

	Only solution at this point is to do your own clipping to
+-32K (or +-16K to be safer).  I advise using midpointing until it fits,
then hand it off to graphics.

-- 
Randell Jesup, Keeper of AmigaDos, Commodore Engineering.
{uunet|rutgers}!cbmvax!jesup, jesup@cbmvax.cbm.commodore.com  BIX: rjesup  
Common phrase heard at Amiga Devcon '89: "It's in there!"