# Función circle() en Processing 3

**URL:** https://discourse.processing.org/t/funcion-circle-en-processing-3/15815
**Category:** Español
**Created:** [November 25, 2019, 9:08pm UTC](https://discourse.processing.org/t/funcion-circle-en-processing-3/15815 "2019-11-25T21:08:06Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![humano](https://avatars.discourse-cdn.com/v4/letter/h/dbc845/32.png) [@humano](https://discourse.processing.org/u/humano)
#### Post date: [November 25, 2019, 9:08pm UTC](https://discourse.processing.org/t/funcion-circle-en-processing-3/15815/1 "2019-11-25T21:08:06Z")

</div>

¡Hola!

Estoy usando Processing 3.5.3 y no me reconoce la función circle (), pero no quiero usar ellipse() porque necesito que el programa funcione en pantallas de muy diferentes formatos, sin que los círculos se deformen. ¿Cómo puedo hacerlo? Veo que tampoco funciona polygon() en esta versión.

---

<div class="post-metadata">

### Author: ![Lexyth](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/lexyth/32/7403_2.png) [@Lexyth](https://discourse.processing.org/u/Lexyth)
#### Post date: [November 25, 2019, 11:59pm UTC](https://discourse.processing.org/t/funcion-circle-en-processing-3/15815/2 "2019-11-25T23:59:06Z")

</div>

Since when would ellipse deforme circles according to screen format? Ellipse draws the circle according to the given variables, so just don‘t use width/height to calculate these variables, or account for it and remap the values before drawing the ellipse…

---

<div class="post-metadata">

### Author: ![humano](https://avatars.discourse-cdn.com/v4/letter/h/dbc845/32.png) [@humano](https://discourse.processing.org/u/humano)
#### Post date: [November 26, 2019, 1:44am UTC](https://discourse.processing.org/t/funcion-circle-en-processing-3/15815/3 "2019-11-26T01:44:54Z")

</div>

la ellipse se deforma porque trabajo con valores relativos para su posición y tamaño. Si el formato es 18:9, width/ tiene que ser la mitad que height/, pero si el formato pasa a ser 4:3 la ellipse se deforma. Mi pregunta es si circle() y polygon() ya no funcionan en Processing 3 y cómo se pueden sustituir.

---

<div class="post-metadata">

### Author: ![Lexyth](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/lexyth/32/7403_2.png) [@Lexyth](https://discourse.processing.org/u/Lexyth)
#### Post date: [November 26, 2019, 10:41am UTC](https://discourse.processing.org/t/funcion-circle-en-processing-3/15815/4 "2019-11-26T10:41:03Z")

</div>

Ah ok, so you do use values relative to the screen… then the Solution is to remap the value to your screen width and height ratios

```auto
float widthHeightRatio = width/height;
float heightWidthRatio = height/width;
ellipse( x, y, w * widthHeightRatio, h * heightWidthRatio);
//or the inverse
ellipse(x, y, w * heightWidthRatio, h * widthHeightRatio);

```

You could also make this into a method and call it circle(). Then you have a exactly what you‘re looking for 😉

---

<div class="post-metadata">

### Author: ![humano](https://avatars.discourse-cdn.com/v4/letter/h/dbc845/32.png) [@humano](https://discourse.processing.org/u/humano)
#### Post date: [November 26, 2019, 12:57pm UTC](https://discourse.processing.org/t/funcion-circle-en-processing-3/15815/5 "2019-11-26T12:57:33Z")

</div>

muchas gracias. Porque entonces, la función circle() ya no existe, ¿verdad?

---

<div class="post-metadata">

### Author: ![Lexyth](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/lexyth/32/7403_2.png) [@Lexyth](https://discourse.processing.org/u/Lexyth)
#### Post date: [November 26, 2019, 1:05pm UTC](https://discourse.processing.org/t/funcion-circle-en-processing-3/15815/6 "2019-11-26T13:05:08Z")

</div>

There is a circle function, but it does not account for the screen ratio.

---

<div class="post-metadata">

### Author: ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)
#### Post date: [December 7, 2019, 5:55am UTC](https://discourse.processing.org/t/funcion-circle-en-processing-3/15815/7 "2019-12-07T05:55:26Z")

</div>

> [@humano](#):
>
> la función circle() ya no existe, ¿verdad?

Esto no está correcto.

`circle()` fue agregado en 3.5 y todo después. Si no tiene `circle()`, entonces está utilizando 3.4 o anterior.

Segunda confusión: solo use la misma variable dos veces en `ellipse()` para obtener exactamente el mismo resultado que `circle()`.

Si tienes un boceto en 3.5:

`circle(x, y, width/2);`

Si tiene un boceto en 3.4, esto hace lo mismo \* exacto \*:

`elipse(x, y, width/2, width/2);`

---

<div class="post-metadata">

### Author: ![humano](https://avatars.discourse-cdn.com/v4/letter/h/dbc845/32.png) [@humano](https://discourse.processing.org/u/humano)
#### Post date: [December 9, 2019, 9:52pm UTC](https://discourse.processing.org/t/funcion-circle-en-processing-3/15815/8 "2019-12-09T21:52:51Z")

</div>

perfecto, ¡muchas gracias!
