# Question about drawing arcs?

**URL:** <https://psychtoolbox.discourse.group/t/question-about-drawing-arcs/1349>\
**Category:** Uncategorized\
**Created:** [September 25, 2003, 7:16pm UTC](https://psychtoolbox.discourse.group/t/question-about-drawing-arcs/1349 "2003-09-25T19:16:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Allen\_Ingling](https://avatars.discourse-cdn.com/v4/letter/a/a183cd/32.png) [@Allen\_Ingling](https://psychtoolbox.discourse.group/u/Allen_Ingling)\
**Post date:** [September 25, 2003, 7:16pm UTC](https://psychtoolbox.discourse.group/t/question-about-drawing-arcs/1349/1 "2003-09-25T19:16:45Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ingling7](https://avatars.discourse-cdn.com/v4/letter/i/e79b87/32.png) [@ingling7](https://psychtoolbox.discourse.group/u/ingling7)\
**Post date:** [September 29, 2003, 8:42pm UTC](https://psychtoolbox.discourse.group/t/question-about-drawing-arcs/1349/2 "2003-09-29T20:42:16Z")

</div>

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://us.click.yahoo.com/IMai8D/UYQGAA/cIoLAA/BEfwlB/TM)  
> \> ---------------------------------------------------------------------   
> \> ~-\>  
> \>  
> \> [http://psychtoolbox.org](http://psychtoolbox.org)  
> \> POST a message to: [psychtoolbox@yahoogroups.com](mailto:psychtoolbox@yahoogroups.com)  
> \> UNSUBSCRIBE by sending a blank message to:  
> \> [psychtoolbox-unsubscribe@yahoogroups.com](mailto:psychtoolbox-unsubscribe@yahoogroups.com)  
> \>  
> \> Your use of Yahoo! Groups is subject to   
> \> [http://docs.yahoo.com/info/terms/](http://docs.yahoo.com/info/terms/)  
> \>  
> \>
