Question about drawing arcs?

I'm trying to draw some shapes using DrawLine and FrameArc functions of Screen.
Simple shapes such as half circle(closed). However, I often cannot make the ends of
lines and arcs meet. For example, for the half closed circle, my code is like this:

Screen(win,'FrameArc',color, x-r,y-r,x+r,y+r,2,2);
Screen(win,'DrawLine',color,x-r,y+r,x+r,y+r,2,2);

The line is not exactly aligned with the arc, and the discrepnecy seems to depend on
where I draw the shape. I wonder if there's a bug in FrameArc that makes imperfect
calculations. Has anybody met such problems?

--
yang
On Thursday, September 25, 2003, at 03:16 PM, ftm_yang wrote:

> I'm trying to draw some shapes using DrawLine and FrameArc functions
> of Screen.
> Simple shapes such as half circle(closed). However, I often cannot
> make the ends of
> lines and arcs meet. For example, for the half closed circle, my code
> is like this:
>
> Screen(win,'FrameArc',color, x-r,y-r,x+r,y+r,2,2);
> Screen(win,'DrawLine',color,x-r,y+r,x+r,y+r,2,2);
>
> The line is not exactly aligned with the arc, and the discrepnecy
> seems to depend on
> where I draw the shape. I wonder if there's a bug in FrameArc that
> makes imperfect
> calculations. Has anybody met such problems?


Dear Yang,

Does this happen with line widths of 1 pixel or only with line widths
of greater than one pixel ? If the line width is greater than one
pixel, then perhaps the problem is that the lines are not being
thickened in the same directions. Also, for line thicknesses greater
than one pixel smooth junctures will be problematic; Thick lines are
rendered as filled rectangles and the corners of one rectangle can
stick out past the edge of the other rectangle at the juncture when the
rectangles to not meet at 90 degrees.

If you do see sloppy junctures with line thickness of one pixel, then
is the error always some fixed number of pixels or in some fixed
direction ? The better that you can characterize the error, the easier
for us to identify the cause.

To draw arcs and lines the Psychtoolbox calls a system graphics
library, DirectX/GDI on Windows and QuickDraw on Mac. If the system's
own drawing commands make no guarantees about the alignment of
endpoints then neither can the Psychtoolbox. Alternatively, if these
graphics libraries do correctly align endpoints and the Psychtoolbox
makes some error in passing along the arguments, then 1) if you can
characterize the error then you can adjust for it when making
Psychtoolbox calls. 2) if you tell us what it is then we fix the mex
files.

Also, windows or Mac ?

best,

Allen




On Thursday, September 25, 2003, at 03:16 PM, ftm_yang wrote:

> I'm trying to draw some shapes using DrawLine and FrameArc functions
> of Screen.
> Simple shapes such as half circle(closed). However, I often cannot
> make the ends of
> lines and arcs meet. For example, for the half closed circle, my code
> is like this:
>
> Screen(win,'FrameArc',color, x-r,y-r,x+r,y+r,2,2);
> Screen(win,'DrawLine',color,x-r,y+r,x+r,y+r,2,2);
>
> The line is not exactly aligned with the arc, and the discrepnecy
> seems to depend on
> where I draw the shape. I wonder if there's a bug in FrameArc that
> makes imperfect
> calculations. Has anybody met such problems?
>
> --
> yang
>
>
>
> ------------------------ Yahoo! Groups Sponsor
> ---------------------~-->
> KnowledgeStorm has over 22,000 B2B technology solutions. The most
> comprehensive IT buyers' information available. Research, compare,
> decide. E-Commerce | Application Dev | Accounting-Finance | Healthcare
> | Project Mgt | Sales-Marketing | More
> http://us.click.yahoo.com/IMai8D/UYQGAA/cIoLAA/BEfwlB/TM
> ---------------------------------------------------------------------
> ~->
>
> http://psychtoolbox.org
> POST a message to: psychtoolbox@yahoogroups.com
> UNSUBSCRIBE by sending a blank message to:
> psychtoolbox-unsubscribe@yahoogroups.com
>
> Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/
>
>