# Drawing lines around the edge of an arc/ellipse

Hey, I’m wondering if there’s an efficient method of drawing lines around the edge of an arc or ellipse (please excuse the terrible example drawing).

I got excited when I came across this post, which refers to an “addArcSegment” – which apparently “draws a path of straight lines around the edge of the circle spaced 0.05 radians apart.”

However, this discussion is from 2004, and the method doesn’t seem to exist anymore.

I wonder if it was replaced by something?

I can conceive of some ways to do it with rotation transforms but hoping there’s a quicker way!

Thanks!

Why not just draw the lines yourself?

Pseudocode:

``````x1 = centerX + cos(angleInRadians) * innerSize;
y1 = centerY + sin(angleInRadians) * innerSize;
x2 = centerX + cos(angleInRadians) * outerSize;
y2 = centerY + sin(angleInRadians) * outerSize;
drawLine(x1, y1, x2, y2);
``````

Very nice! I remember when I knew some trig… time to revise.

Somebody else suggested using the “fromStartAndAngle” method in Line, and also “withShortenedStart”:

`auto line = juce::Line<float>::fromStartAndAngle (centre, radius + markerLength, angle);`
`line = line.withShortenedStart ( radius );`

…then draw it in a loop. I like both methods!