[R] to draw a smooth arc

Jim Lemon jim at bitwrit.com.au
Wed May 2 12:16:51 CEST 2007


(Ted Harding) wrote:
> This thread prompts me to ask about something I've
> been pondering for a while, as to whether there's an
> implementation somewhere ticked away in the R resources.
> 
> So far, people have been responding to the original query
> in terms of increasing the numbers of points, and joining
> these by lines.
> 
> However, if you're using PostScript output, you can draw
> really smooth curves by exploiting PS's "curveto" operator.
> This draws a cubic-curve segment in the following way:
> 
> ...
> Anyway. The Question: is there a general function for the
> above kind of smooth curve-drawing?
> 
Hi Ted,
My experience with this some years ago was in anti-aliasing visual 
stimuli presented on a PC monitor. The intended line was calculated 
pixel by pixel and the each pixel that the line touched was assigned a 
value based on a sawtooth function. The peak of the function was always 
exactly on the intended line and the luminance of the pixel was a linear 
function of the distance of its center along a perpendicular to the 
line. We used the width of a pixel as the lateral extent of the function 
with adequate success. The lines appeared smooth until the viewer could 
resolve the individual pixels. Wider lines used a trapezoidal 
distribution of luminance with the same slope on the limbs. I must note 
that we did not have to create our stimuli in real time, and this method 
might be too slow. However, I am fairly certain that if the function 
knew about the characteristics of the output device, one could base a 
curveto function on this.

Jim



More information about the R-help mailing list