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

**URL:** https://discourse.processing.org/t/how-can-i-make-an-ellipse-with-vertical-lines-coming-out-of-its-upper-circumference-towards-the-top-of-the-page/39839
**Category:** Beginners
**Created:** [November 23, 2022, 6:11pm UTC](https://discourse.processing.org/t/how-can-i-make-an-ellipse-with-vertical-lines-coming-out-of-its-upper-circumference-towards-the-top-of-the-page/39839 "2022-11-23T18:11:05Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![chaotic.rabbit](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chaotic.rabbit/32/14034_2.png) [@chaotic.rabbit](https://discourse.processing.org/u/chaotic.rabbit)
#### Post date: [November 23, 2022, 6:11pm UTC](https://discourse.processing.org/t/how-can-i-make-an-ellipse-with-vertical-lines-coming-out-of-its-upper-circumference-towards-the-top-of-the-page/39839/1 "2022-11-23T18:11:05Z")

</div>

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

---

<div class="post-metadata">

### Author: ![mnse](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/mnse/32/16520_2.png) [@mnse](https://discourse.processing.org/u/mnse)
#### Post date: [November 23, 2022, 6:59pm UTC](https://discourse.processing.org/t/how-can-i-make-an-ellipse-with-vertical-lines-coming-out-of-its-upper-circumference-towards-the-top-of-the-page/39839/2 "2022-11-23T18:59:54Z")

</div>

Hi @chaotic.rabbit

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 …  
[https://processing.org/tutorials/trig](https://processing.org/tutorials/trig)

[![](https://img.youtube.com/vi/znOBmOrtz_M/hqdefault.jpg "3.2: Trigonometry and Polar Coordinates - The Nature of Code") ](https://www.youtube.com/watch?v=znOBmOrtz_M)

Cheers  
— mnse

---

<div class="post-metadata">

### Author: ![JoseMY](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/josemy/32/2016_2.png) [@JoseMY](https://discourse.processing.org/u/JoseMY)
#### Post date: [May 1, 2023, 4:59pm UTC](https://discourse.processing.org/t/how-can-i-make-an-ellipse-with-vertical-lines-coming-out-of-its-upper-circumference-towards-the-top-of-the-page/39839/3 "2023-05-01T16:59:29Z")

</div>

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

R_R-X_X=Y_Y  
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.

---

<div class="post-metadata">

### Author: ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)
#### Post date: [May 2, 2023, 5:13pm UTC](https://discourse.processing.org/t/how-can-i-make-an-ellipse-with-vertical-lines-coming-out-of-its-upper-circumference-towards-the-top-of-the-page/39839/4 "2023-05-02T17:13:55Z")

</div>

here is an example with trig

```auto
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);
}

```
