# How do I create regular spirograph curves around an asymmetrical shape

**URL:** https://discourse.processing.org/t/how-do-i-create-regular-spirograph-curves-around-an-asymmetrical-shape/5501
**Category:** Coding Questions
**Created:** [November 13, 2018, 3:20pm UTC](https://discourse.processing.org/t/how-do-i-create-regular-spirograph-curves-around-an-asymmetrical-shape/5501 "2018-11-13T15:20:02Z")
**Posts on this page:** 1
**Showing post:** 10

<div class="post-metadata">

### Author: ![kfrajer](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kfrajer/32/196_2.png) [@kfrajer](https://discourse.processing.org/u/kfrajer)
#### Post date: [November 14, 2018, 2:10am UTC](https://discourse.processing.org/t/how-do-i-create-regular-spirograph-curves-around-an-asymmetrical-shape/5501/10 "2018-11-14T02:10:56Z")

</div>

> [@Rah](#):
>
> plus make the curves round instead of squared.

This below is my attempt to address your question. I also did some minor changes. [This](https://processing.org/reference/curveVertex_.html) could come handy. I also think these links could be relevant to your question:

> [Additive Wave / Examples / Processing.org](https://processing.org/examples/additivewave.html)  
> [https://forum.processing.org/two/discussion/21356/how-to-draw-waves-like-those-in-the-pictures](https://forum.processing.org/two/discussion/21356/how-to-draw-waves-like-those-in-the-pictures)  
> [Wave displaced circle - #5 by josephh](https://discourse.processing.org/t/wave-displaced-circle/808/5)

Your question is an interesting challenge. I might give it a try this weekend if you are still looking for help.

@kll Your demo produces interesting patterns 🙋‍♂️

Kf

```java
int d=2, r=1;
float x=0, y=0, t;

void setup() {
  size(800, 800);
  surface.setTitle("Use mouseX mouseY and mouse wheel");
  
  stroke(0);
  strokeWeight(1.5);
}

void draw() {
  background(255);  
  translate(width/2, height/2);
  
  float R=mouseX/10;
  float O=mouseY/2;
  
  beginShape();
  for ( int i=0; i<360; i++) {
    t = radians(i);
    x = (x/50+y/50000)*(R+r)*cos(t) - (r+O)*cos(((R+r)/r)*t);
    y = (R+r)*sin(t) - (r+O)*sin(((R+r)/r)*t);
    curveVertex(x,y);
  }
  endShape();
}

void mouseWheel(MouseEvent event) {
  r += event.getCount();
  if ( r <= 10 ) r = 10;
  println("r: “+r+” R: “+R+” O: "+0);
}

```

---

_[View the full topic](https://discourse.processing.org/t/how-do-i-create-regular-spirograph-curves-around-an-asymmetrical-shape/5501)._
