# Diagonal drawer

**URL:** https://discourse.processing.org/t/diagonal-drawer/26286
**Category:** Gallery
**Created:** [December 15, 2020, 9:57pm UTC](https://discourse.processing.org/t/diagonal-drawer/26286 "2020-12-15T21:57:45Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![CodeMasterX](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/codemasterx/32/2942_2.png) [@CodeMasterX](https://discourse.processing.org/u/CodeMasterX)
#### Post date: [December 15, 2020, 9:57pm UTC](https://discourse.processing.org/t/diagonal-drawer/26286/1 "2020-12-15T21:57:45Z")

</div>

It draws all diagonals of an n-sided polygon. Idk why it would be useful but have fun!

```auto
int n = 10, r = 200,cx = 300, cy = 300;
void setup() {
  size(600,600);
}

void draw() {
  background(0);
  stroke(255);
  for(int i = 0; i < n; i++) {
    for(int j = 0; j < n; j++) {
      line( cx + cos(TWO_PI/n*i)*r, cy + sin(TWO_PI/n*i)*r, cx + cos(TWO_PI/n*j) * r, cy + sin(TWO_PI/n*j)*r);
    }
  }
}

```

and an optimized version:

```auto
int n = 20, r = 200, cx = 300, cy = 300;
size(600, 600);
background(0);
stroke(255);
for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) {
  line( cx + cos(TWO_PI/n*i)*r, cy + sin(TWO_PI/n*i)*r, cx + cos(TWO_PI/n*j) * r, cy + sin(TWO_PI/n*j)*r);
}

```

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/c/cf4b39790886bf0376c08d69e4479902b1bcd778.png)

---

<div class="post-metadata">

### Author: ![CodeMasterX](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/codemasterx/32/2942_2.png) [@CodeMasterX](https://discourse.processing.org/u/CodeMasterX)
#### Post date: [December 15, 2020, 9:58pm UTC](https://discourse.processing.org/t/diagonal-drawer/26286/2 "2020-12-15T21:58:29Z")

</div>

by the rate I’m creating posts it would be considered spam : P

---

<div class="post-metadata">

### Author: ![josephh](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/josephh/32/210_2.png) [@josephh](https://discourse.processing.org/u/josephh)
#### Post date: [December 15, 2020, 10:33pm UTC](https://discourse.processing.org/t/diagonal-drawer/26286/3 "2020-12-15T22:33:54Z")

</div>

Ahah yeah you are too fast for us 😁

What about making a repository of your sketches then sharing it one the forum with a single link? (rather than creating a lot of posts) For that you can use GitLab, GitHub, BitBucket, or create your own website!

---

<div class="post-metadata">

### Author: ![CodeMasterX](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/codemasterx/32/2942_2.png) [@CodeMasterX](https://discourse.processing.org/u/CodeMasterX)
#### Post date: [December 15, 2020, 10:39pm UTC](https://discourse.processing.org/t/diagonal-drawer/26286/4 "2020-12-15T22:39:59Z")

</div>

sorry about that. I just really got into programming again and yeah… What do you recommend? I personally don’t like github because I have no idea how to use it. Well if you recommend github I’ll just look into it.

I am not a fan of paid things so I don’t feel comfortable hosting my own website. And It’s a lot of hassle to set it up and run it.

---

<div class="post-metadata">

### Author: ![josephh](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/josephh/32/210_2.png) [@josephh](https://discourse.processing.org/u/josephh)
#### Post date: [December 15, 2020, 10:50pm UTC](https://discourse.processing.org/t/diagonal-drawer/26286/5 "2020-12-15T22:50:15Z")

</div>

> [@CodeMasterX](#):
>
> And It’s a lot of hassle to set it up and run it.

Ahah that’s the fun part of system administration and web development (which is also interesting if you’re really into programming). 🤗

If it’s your thing, GitHub and other source control technologies are an important step in software development. I am not a big fan of GitHub itself (the platform) but a lot of open source projects are hosted here. It could be a nice way to organize your work.

But again GitHub is not the only platform for hosting your code, remember that!

---

<div class="post-metadata">

### Author: ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)
#### Post date: [December 15, 2020, 10:52pm UTC](https://discourse.processing.org/t/diagonal-drawer/26286/6 "2020-12-15T22:52:57Z")

</div>

> [@CodeMasterX](#):
>
> … don’t like GitHub because I have no idea how to use it.

> [@Upload files that are not images](https://discourse.processing.org/t/upload-files-that-are-not-images/5933/3):
>
> For code w/ data assets, just create a GitHub repo for it: octopus[Help.GitHub.com/articles/create-a-repo/](http://Help.GitHub.com/articles/create-a-repo/) After that, you can drag & drop your code’s root folder into your repo: file_folder[Help.GitHub.com/articles/adding-a-file-to-a-repository/](http://Help.GitHub.com/articles/adding-a-file-to-a-repository/) Here’s a repo example for a sketch containing lotsa data assets: card_file_box

> [@Searching for coding help in Processing3](https://discourse.processing.org/t/searching-for-coding-help-in-processing3/1851/7):
>
> For a sketch w/ assets, like images, audios, videos, fonts, etc., you can create a repo for it at [GitHub.com](http://GitHub.com): [Create a repo - GitHub Docs](https://Help.GitHub.com/articles/create-a-repo/) And then drag & drop your whole sketch folder into it:

---

<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: [December 15, 2020, 10:59pm UTC](https://discourse.processing.org/t/diagonal-drawer/26286/7 "2020-12-15T22:59:21Z")

</div>

Or just use [www.openprocessing.org](http://www.openprocessing.org)
