# Make a nice Church Window

**URL:** <https://discourse.processing.org/t/make-a-nice-church-window/43022>\
**Category:** Gallery\
**Created:** [October 21, 2023, 12:34pm UTC](https://discourse.processing.org/t/make-a-nice-church-window/43022 "2023-10-21T12:34:45Z")\
**Posts on this page:** 1\
**Page:** 1

<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:** [October 21, 2023, 12:34pm UTC](https://discourse.processing.org/t/make-a-nice-church-window/43022/1 "2023-10-21T12:34:45Z")

</div>

small drawing program with a robot arm with a pen at its end.

a lot of experiments possible:

- the 2 radii
- and the 2 speeds with which the angles change
- color…

```auto

// A robot arm rotates with a pen at its end.
// Hold mouse to hide arm.

// Arm part 1 from middle of the screen to x1,y1, rotating.
// Arm part 2 from x1,y1 to x2,y2, rotating around x1,y1.
// pen is at x2,y2.
//

float x1, y1,
  x2, y2,
  angle1, angle2;

float angle1Speed = 0.025;
float angle2Speed = 0.0521;

float rad1 = 100; // good is 100 with 60 // or 100 with 50
float rad2 = 60;

float x2old, y2old;

ArrayList<PVector> list = new ArrayList();

// ---------------------------------------------------------------

void setup() {
  size(800, 600);
} // func

void draw() {
  background(255);

  calcData();

  if (!mousePressed) {
    // the robot arm
    showLines();
    showPoints();
  }

  // store pen drawing and display it
  list.add(new PVector(x2, y2));
  stroke(255, 0, 0);
  for (PVector pv : list) {
    rect(pv.x, pv.y, 4, 4);
  }
  //
} // func

//--------------------------------------------------------------------

void calcData() {

  x1 = width/2 + rad1 * cos(angle1);
  y1 = height/2 + rad1 * sin(angle1);

  angle1 += angle1Speed;

  x2old=x2;
  y2old=y2;

  x2 = x1 + rad2 * cos(angle2);
  y2 = y1 + rad2 * sin(angle2);

  angle2 += angle2Speed;
  // angle2Speed +=0.0001;
}

void showLines() {
  stroke(0, 255, 0);
  line(width/2, height/2,
    x1, y1);
  line(x1, y1,
    x2, y2);
}

void showPoints() {
  stroke(0, 255, 0);
  rect(width/2, height/2, 4, 4);
  rect(x1, y1, 4, 4);
  rect(x2, y2, 4, 4);
}

```

![wef](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/3X/f/c/fcf2eeb6b539ca69b0810581da9f3dae94f6fabe.jpeg)
