# How can i make an ellipse with vertical lines coming out of its upper circumference towards the top of the page?

i want to make 5 lines to come out of the top part of the ellipse and touch the top of the page

You can use trigonometry… Means drawing the ellipse using trigonometric functions. This will give you access to specific circle/ellipse points which you can use as an anchor for your lines…

Give it a try …

Cheers
— mnse

3 Likes

If you are using circles instead of ellipses, you can use Pitagoras Theorem (usually learnt before trigonometry).

A vertical line on X touches the circumference of radius R placed at 0,0 when

RR-XX=YY
So:
Y=sqrt(R
R+X*X)

if the circle is at (cx,cy), you have to replace X with (X-cx) and Y with (Y-cy).

I used that on the nineties to draw a yin-yang in assembler without math coprocessor (my 286 had a coprocessor, but I did not understand how to use it).
Also, remember processing has a dist() function you can use if you dont want to use square roots and math.

here is an example with trig

``````size(900, 900);

float R = 300;

for (float i= 0; i <= 360; i+=7) {

float x = cos(radians(i)) * R+width/2;
float y = sin(radians(i)) * R+height/2;

ellipse (x, y, 7, 7);
}

``````