# Inversely ellipses

**URL:** <https://discourse.processing.org/t/inversely-ellipses/12621>\
**Category:** Coding Questions\
**Created:** [July 9, 2019, 10:29am UTC](https://discourse.processing.org/t/inversely-ellipses/12621 "2019-07-09T10:29:55Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![maakin](https://avatars.discourse-cdn.com/v4/letter/m/4af34b/32.png) [@maakin](https://discourse.processing.org/u/maakin)\
**Post date:** [July 9, 2019, 10:29am UTC](https://discourse.processing.org/t/inversely-ellipses/12621/1 "2019-07-09T10:29:55Z")

</div>

How to draw ellipses like this ( using for or while)

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/f/ff34de61cd1d7dba3d42d5420e484c9dad2a82a6.jpeg)

---

<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:** [July 9, 2019, 10:42am UTC](https://discourse.processing.org/t/inversely-ellipses/12621/2 "2019-07-09T10:42:51Z")

</div>

Let’s say you use a for loop

```auto
for(.....) {

}

```

Inside the for loop is one ellipse command with `ellipse(x,y,6,6);`

define x and y before setup (): `float x,y;`

Now how do you need to change x and y inside the for loop to get the result you want?

**Please post your entire code.** Then we can help you further.

Thank you.

Regards,

Chrisir

---

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [July 9, 2019, 11:40am UTC](https://discourse.processing.org/t/inversely-ellipses/12621/3 "2019-07-09T11:40:23Z")

</div>

The math:  
What is the equation to a straight line?  
The axes are not well labelled; is that a point at (4,3) and (13, 17)?  
They do look equally spaced but not a well defined origin.

The plot:  
Processing references are helpful.  
[https://processing.org/reference/](https://processing.org/reference/)  
[https://processing.org/tutorials/](https://processing.org/tutorials/)

As a new programmer or new to Processing I encourage you to look at references and tutorials to glean some insight and understanding, think about it and then write code yourself from scratch.

🙂

---

<div class="post-metadata">

**Author:** ![maakin](https://avatars.discourse-cdn.com/v4/letter/m/4af34b/32.png) [@maakin](https://discourse.processing.org/u/maakin)\
**Post date:** [July 9, 2019, 3:22pm UTC](https://discourse.processing.org/t/inversely-ellipses/12621/5 "2019-07-09T15:22:57Z")

</div>

how to draw many ellipse in proportional(using for or while)  
i aslo can draw like this

```auto
void setup(){
  size(300,300);

for (int i = 10;i <300;i = i+70){
  ellipse(i,100,15,15);}
}

```

---

<div class="post-metadata">

**Author:** ![maakin](https://avatars.discourse-cdn.com/v4/letter/m/4af34b/32.png) [@maakin](https://discourse.processing.org/u/maakin)\
**Post date:** [July 9, 2019, 3:27pm UTC](https://discourse.processing.org/t/inversely-ellipses/12621/6 "2019-07-09T15:27:20Z")

</div>

these ellipse can make proportional  
please help

```auto
void setup(){
  size(300,300);

for (int i = 10;i <300;i = i+70){
  ellipse(i,100,15,15);}
}

```

---

<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:** [July 9, 2019, 3:30pm UTC](https://discourse.processing.org/t/inversely-ellipses/12621/7 "2019-07-09T15:30:24Z")

</div>

If you kindly look at my post and follow my advice

---

<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:** [July 9, 2019, 3:31pm UTC](https://discourse.processing.org/t/inversely-ellipses/12621/8 "2019-07-09T15:31:49Z")

</div>

> [@maakin](#):
>
> for (int i = 10;i \<300;i = i+70){

or say … i\<10; i = i + 1) {

and manage the rest with x and y as shown

---

<div class="post-metadata">

**Author:** ![maakin](https://avatars.discourse-cdn.com/v4/letter/m/4af34b/32.png) [@maakin](https://discourse.processing.org/u/maakin)\
**Post date:** [July 9, 2019, 3:51pm UTC](https://discourse.processing.org/t/inversely-ellipses/12621/9 "2019-07-09T15:51:02Z")

</div>

dear sir  
i am very new  
and i tried to manage x,y, but still not success

---

<div class="post-metadata">

**Author:** ![maakin](https://avatars.discourse-cdn.com/v4/letter/m/4af34b/32.png) [@maakin](https://discourse.processing.org/u/maakin)\
**Post date:** [July 9, 2019, 3:52pm UTC](https://discourse.processing.org/t/inversely-ellipses/12621/10 "2019-07-09T15:52:19Z")

</div>

only i can draw horizontal an vertical…but i want proportional  
thank you for helping

---

<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:** [July 9, 2019, 6:16pm UTC](https://discourse.processing.org/t/inversely-ellipses/12621/11 "2019-07-09T18:16:49Z")

</div>

Change x AND y

See my first post

Then show your entire code

---

<div class="post-metadata">

**Author:** ![maakin](https://avatars.discourse-cdn.com/v4/letter/m/4af34b/32.png) [@maakin](https://discourse.processing.org/u/maakin)\
**Post date:** [July 9, 2019, 6:42pm UTC](https://discourse.processing.org/t/inversely-ellipses/12621/12 "2019-07-09T18:42:47Z")

</div>

Yes I get it… thank you very much @Chrisir  
@glv 🙂

---

<div class="post-metadata">

**Author:** ![maakin](https://avatars.discourse-cdn.com/v4/letter/m/4af34b/32.png) [@maakin](https://discourse.processing.org/u/maakin)\
**Post date:** [July 9, 2019, 6:48pm UTC](https://discourse.processing.org/t/inversely-ellipses/12621/13 "2019-07-09T18:48:51Z")

</div>

how to put numbers this graph

```auto
void setup(){
  size(600,600);
  background(190);
  for(int i = 30 ;i <580;i=i+20){
    line(i,30,i,570);
    line(30,i,570,i);
   
    
  }
  strokeWeight(2);
    line(30,570,570,570);
    line(30,30,30,570);}
  void draw(){
    textSize(24);
    text("Y",10,35);
    text("x",570,590);
    noStroke();
    fill(200,0,0);
    ellipse(570,570,10,10);
    ellipse(30,30,10,10);
  }

```

---

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [July 10, 2019, 12:05am UTC](https://discourse.processing.org/t/inversely-ellipses/12621/14 "2019-07-10T00:05:31Z")

</div>

pls first you need to learn how to post code here at the forum:  
from the post editor use the

```auto
</> code tag

```

looks like:

```  
type or paste code here  
```

please repair above code this way, and only PASTE good formatted code only:  
in IDE use [ctrl][t] for this.

* * *

> [@maakin](#):
>
> how to put numbers this graph

what is the question here?  
are you talking about the numbers for the X and Y axis?

---

<div class="post-metadata">

**Author:** ![maakin](https://avatars.discourse-cdn.com/v4/letter/m/4af34b/32.png) [@maakin](https://discourse.processing.org/u/maakin)\
**Post date:** [July 10, 2019, 2:37am UTC](https://discourse.processing.org/t/inversely-ellipses/12621/15 "2019-07-10T02:37:56Z")

</div>

Ya I want write X and Y number

---

<div class="post-metadata">

**Author:** ![maakin](https://avatars.discourse-cdn.com/v4/letter/m/4af34b/32.png) [@maakin](https://discourse.processing.org/u/maakin)\
**Post date:** [July 10, 2019, 2:41am UTC](https://discourse.processing.org/t/inversely-ellipses/12621/16 "2019-07-10T02:41:16Z")

</div>

Thank you very much for helping  
Now see the code

```auto
void setup(){
  size(600,600);
  background(190);
  for(int i = 30 ;i <580;i=i+20){
    line(i,30,i,570);
    line(30,i,570,i);
   
    
  }
  strokeWeight(2);
    line(30,570,570,570);
    line(30,30,30,570);}
  void draw(){
    textSize(24);
    text("Y",10,35);
    text("x",570,590);
    noStroke();
    fill(200,0,0);
    ellipse(570,570,10,10);
    ellipse(30,30,10,10);
  }

```

---

<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:** [July 10, 2019, 7:03am UTC](https://discourse.processing.org/t/inversely-ellipses/12621/17 "2019-07-10T07:03:07Z")

</div>

Start draw () with a call of background - see reference.

In the tutorials read the first three text tutorials. Skip the videos for now

Do all drawings in draw().

For the ellipses use a for loop as I described. Write ellipse only once in the for loop - not like you have it now.

Make 2 other for loops in draw to write the numbers at the lines

---

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [July 10, 2019, 11:18am UTC](https://discourse.processing.org/t/inversely-ellipses/12621/18 "2019-07-10T11:18:21Z")

</div>

sorry, but why you post the code 2 times, and why you

- 
  - not format it in processing

- 
  - not format it here as code

as i told you?

it should look like:

```auto
int off = 30, dgrid = 20, scale = 2*dgrid;

void setup() {
  size(600, 600);
}

void axis() {
  textSize(15);
  stroke(255);
  strokeWeight(1);
  for (int i = off; i <= width - off; i += dgrid) {
    line(i, off, i, width - off);
    line(off, i, height - off, i);
  }
  fill(200, 0, 0);
  stroke(200, 0, 0);
  text("X", 580, off-4);
  text("-Y", 10, 595);
  for ( int k = 0; k <= (width - 2*off)/scale; k++ ) {
    line(off + k*scale, off, off + k*scale, off -2);
    text( k, off-4 + k*scale, off -4 );
    line( off, off + k*scale, off-2, off + k*scale);
    text( k, 10, off+4 + k*scale);
  }
}

void circles() {
  int d = 30, x0 = 20, dx = 4*x0 ;
  stroke(200,200,0); //noStroke();
  noFill(); //fill(200, 200, 0);
  for ( int l = x0; l < width-off-d; l +=dx ) ellipse(off + l, off + l, d, d);
}

void draw() {
  background(0);
  axis();
  circles();
}

```

---

<div class="post-metadata">

**Author:** ![maakin](https://avatars.discourse-cdn.com/v4/letter/m/4af34b/32.png) [@maakin](https://discourse.processing.org/u/maakin)\
**Post date:** [July 10, 2019, 1:07pm UTC](https://discourse.processing.org/t/inversely-ellipses/12621/19 "2019-07-10T13:07:03Z")

</div>

wow nice thank you so much  
how to change that ellipse 13y to 13x

---

<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:** [July 10, 2019, 1:25pm UTC](https://discourse.processing.org/t/inversely-ellipses/12621/20 "2019-07-10T13:25:41Z")

</div>

What do you mean?

Chrisir

---

<div class="post-metadata">

**Author:** ![maakin](https://avatars.discourse-cdn.com/v4/letter/m/4af34b/32.png) [@maakin](https://discourse.processing.org/u/maakin)\
**Post date:** [July 10, 2019, 2:57pm UTC](https://discourse.processing.org/t/inversely-ellipses/12621/21 "2019-07-10T14:57:14Z")

</div>

I mean who can draw ellipses like that  
Using(

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/5/502c7188dc2b97c46d6f66c05de4ce17578b49b0.jpeg) for)

[Next page](https://discourse.processing.org/t/inversely-ellipses/12621.md?page=2)
