#### Howdy, Stranger!

We are about to switch to a new forum software. Until then we have removed the registration on this forum.

# How to draw a circle with a dotted line?

edited April 2018

In the processing language, how to draw a circle and lines with a dotted line? Can it be achieved? like this? :)

Tagged:

Demo below. Typically, you provide your attempt or you describe what part you are struggling.

Kf

``````final float N=100;
float da=TWO_PI/N;
PVector centroid =new PVector(width/2,height/2);

size(400,500);

fill(255,0,0);
for(float a=0;a<TWO_PI;a+=da){
}
``````
• Is there any other way? For example, set a function to make straight lines at intervals every other period?

You can write your own function

Based on the code above

N is the number of steps

• edited April 2018 Answer ✓

If you want a library for dashed lines on a wide variety of shapes, try Dashed Lines for Processing:

For lines, the Processing reference also has an example of using lerp to draw dotted lines.

This method can be used radially as well for r rather than x,y.