# Just a bit lost

**URL:** https://discourse.processing.org/t/just-a-bit-lost/34179
**Category:** Coding Questions
**Tags:** homework
**Created:** [December 18, 2021, 9:30am UTC](https://discourse.processing.org/t/just-a-bit-lost/34179 "2021-12-18T09:30:20Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Jamii](https://avatars.discourse-cdn.com/v4/letter/j/dec6dc/32.png) [@Jamii](https://discourse.processing.org/u/Jamii)
#### Post date: [December 18, 2021, 9:30am UTC](https://discourse.processing.org/t/just-a-bit-lost/34179/1 "2021-12-18T09:30:20Z")

</div>

I’ve been working on this for god knows how long, but I’m just not that sure how to make this better. Thoughts or comments? I couldn’t figure out how to make the lines not touch each other, so it constantly looks so messy.

_it’s also really long for no reason_

```auto

import processing.pdf.*;

void setup() {
  //background setup
  size (900, 900);
  background(128,128,118);
  
  beginRecord(PDF, "##.pdf");
    do_work();
  
  endRecord();
}

void draw() {}
  
void do_work() {
  // clear & prepare canvas 
  background(128,128,118); 
  
  //the final boundary wall
 beginShape();
  noFill();
  vertex(60,5);
  vertex(890,25);
  vertex(890,850);
  vertex(780,890);
  vertex(60,890);
  vertex(10,890);
  vertex(5,750);
  endShape(CLOSE);
  
  //starting angle point of main lines
  stroke(0);
  strokeWeight(1);
  myLine( 32 );
  myLine( 64 );
  myLine( 96 );
  myLine( 132 );
  myLine( 164 );
  myLine( 196 );
  myLine( 228 );
  myLine( 264 );
  myLine( 296 );
  myLine( 320 );
  myLine( 352 );
  
  myLine2( 48 );
  myLine2( 80 );
  myLine2( 112 );
  myLine2( 144 );
  myLine2( 176 );
  myLine2( 208 );
  myLine2( 240 );
  myLine2( 272 );
  myLine2( 304 );
  myLine2( 336 );
  myLine2( 368 );

 noLoop();
}

void myLine(float angle) {
  
  float angle2=radians(angle);

  float xCenter=cos(angle2) * 20 + width/2;
  float yCenter=sin(angle2) * 20 + height/2;

  float r1 = random(10, 300); 
  float x=cos(angle2) * r1 + xCenter;
  float y=sin(angle2) * r1 + yCenter;

//main lines coming from the middle
  line(xCenter, yCenter, x, y);

  pushMatrix();
  translate(x, y); 
  float angle3 = give90orminus90(); 
  rotate(radians(angle+angle3)); 
  float r2=random(75, 100); 
  line(0, 0, 40, 0);

  translate(40, 0); 
  rotate(radians(-angle3));
  line(0, 0, 80, 0);

  translate(80, 0); 
  rotate(radians(give90orminus90() ));
  line(0, 0, 150, 0); 
  
  translate(150, 0); 
  rotate(radians(-angle3));
  line(0, 0, (random(100)), 0);  
  
  translate(100, 0); 
  rotate(radians(-angle3));
  line(0, 0, (random(40, 100)), 0); 
  
  //lines spourting out 
  for (int aa = 0; aa<1; aa = aa + 11) {
    translate(10,0);
    rotate(radians(give90orminus90() ));
    line(0, 0, 10, 0);
           
    translate(10,0);
    rotate(radians(-angle3));
    line(0, 0,40, 0);
  }
  
  for (int a = 0; a<1; a = a + 11) {
      translate(40,0);
      rotate(radians(give90orminus90() ));
      line(0, 0, 10, 0);
         
      translate(10,0);
      rotate(radians(-angle3));
      line(0, 0,40, 0);
      
      for (int b = 0; b<1; b = b + 11) {
        translate(5,0);
        rotate(radians(give90orminus90() ));
        line(0, 0, 150, 0);
           
        translate(150,0);
        rotate(radians(-angle3));
        line(0, 0,50, 0);
        
        translate(50,0);
        rotate(radians(-angle3));
        line(0, 0,20, 0);
      }
  }
  
  for (int aa = 0; aa<1; aa = aa + 11) {
    translate(20,0);
    rotate(radians(give90orminus90() ));
    line(0, 0, 10, 0);
           
    translate(10,0);
    rotate(radians(-angle3));
    line(0, 0,40, 0);
    
    for (int bb = 0; bb<1; bb = bb + 11) {
      translate(5,0);
      rotate(radians(give90orminus90() ));
      line(0, 0, 150, 0);
           
      translate(150,0);
      rotate(radians(-angle3));
      line(0, 0,50, 0);
          
      translate(50,0);
      rotate(radians(-angle3));
      line(0, 0,20, 0);
    }
    
    for (int aaa = 0; aaa<1; aaa = aaa + 11) {
      translate(20,0);
      rotate(radians(give90orminus90() ));
      line(0, 0, 10, 0);
             
      translate(10,0);
      rotate(radians(-angle3));
      line(0, 0,40, 0);
      
      
      for (int bbb = 0; bbb<1; bbb = bbb + 11) {
        translate(5,0);
        rotate(radians(give90orminus90() ));
        line(0, 0, 200, 0);
               
        translate(150,0);
        rotate(radians(-angle3));
        line(0, 0,50, 0);
            
        translate(50,0);
        rotate(radians(-angle3));
        line(0, 0,20, 0);
      }
    }
  }
  popMatrix();
}

void myLine2(float angle2) {
  
  float angle22=radians(angle2);

  float xCenter2=cos(angle22) * 100 + width/2;
  float yCenter2=sin(angle22) * 100 + height/2;

  float r12 = random(10, 300); 
  float x2=cos(angle22) * r12 + xCenter2;
  float y2=sin(angle22) * r12 + yCenter2;

//main lines coming from the middle
  line(xCenter2, yCenter2, x2, y2);

  pushMatrix();
  translate(x2, y2); 
  float angle32 = give90orminus90(); 
  rotate(radians(angle2+angle32)); 
  float r22=random(75, 100); 
  line(0, 0, 40, 0);

  translate(40, 0); 
  rotate(radians(-angle32));
  line(0, 0, 80, 0);

  translate(80, 0); 
  rotate(radians(give90orminus90() ));
  line(0, 0, 150, 0); 
  
  translate(150, 0); 
  rotate(radians(-angle32));
  line(0, 0, (random(100)), 0);  
  
  translate(100, 0); 
  rotate(radians(-angle32));
  line(0, 0, (random(40, 100)), 0); 
  
  //lines spourting out 
  for (int aa2 = 0; aa2<1; aa2 = aa2 + 11) {
    translate(10,0);
    rotate(radians(give90orminus90() ));
    line(0, 0, 10, 0);
           
    translate(10,0);
    rotate(radians(-angle32));
    line(0, 0,40, 0);
  }
  
  for (int a2 = 0; a2<1; a2 = a2 + 11) {
      translate(40,0);
      rotate(radians(give90orminus90() ));
      line(0, 0, 10, 0);
         
      translate(10,0);
      rotate(radians(-angle32));
      line(0, 0,40, 0);
      
      for (int b2 = 0; b2<1; b2 = b2 + 11) {
        translate(5,0);
        rotate(radians(give90orminus90() ));
        line(0, 0, 150, 0);
           
        translate(150,0);
        rotate(radians(-angle32));
        line(0, 0,50, 0);
        
        translate(50,0);
        rotate(radians(-angle32));
        line(0, 0,20, 0);
      }
  }
  
  for (int aa2 = 0; aa2<1; aa2 = aa2 + 11) {
    translate(20,0);
    rotate(radians(give90orminus90() ));
    line(0, 0, 10, 0);
           
    translate(10,0);
    rotate(radians(-angle32));
    line(0, 0,40, 0);
    
    for (int bb2 = 0; bb2<1; bb2 = bb2 + 11) {
      translate(5,0);
      rotate(radians(give90orminus90() ));
      line(0, 0, 150, 0);
           
      translate(150,0);
      rotate(radians(-angle32));
      line(0, 0,50, 0);
          
      translate(50,0);
      rotate(radians(-angle32));
      line(0, 0,20, 0);
    }
  }
  popMatrix();
}

float give90orminus90() {
  if (random(100)<50)
    return random(60,100);
  else return random(-60,-100);
} 

```

---

<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: [December 18, 2021, 10:41am UTC](https://discourse.processing.org/t/just-a-bit-lost/34179/2 "2021-12-18T10:41:10Z")

</div>

@Jamii,

When you submit this homework and post in this forum be sure to reference the sources of code.

You used some of this code in your homework assignment:

> [@Little stuck on a concept](https://discourse.processing.org/t/little-stuck-on-a-concept/34173/3):
>
> example but still a long way to go hit any key to redraw // ----------------------------------------------------- void setup() { size (1400, 800); background(0); } void draw() { // clear & prepare canvas background(0); stroke(255); myLine( 13 ); myLine( 83 ); myLine( 223 ); myLine( 293 ); myLine( 323 ); noLoop(); } void keyPressed() { redraw(); } void myLine(float angle) { // float angle=50; float angle2=radians(angle); float xCenter=cos(angle2) \* ra…

`:)`

---

<div class="post-metadata">

### Author: ![Jamii](https://avatars.discourse-cdn.com/v4/letter/j/dec6dc/32.png) [@Jamii](https://discourse.processing.org/u/Jamii)
#### Post date: [December 18, 2021, 11:11am UTC](https://discourse.processing.org/t/just-a-bit-lost/34179/3 "2021-12-18T11:11:27Z")

</div>

should i link ? or use a username?

---

<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 18, 2021, 1:19pm UTC](https://discourse.processing.org/t/just-a-bit-lost/34179/4 "2021-12-18T13:19:00Z")

</div>

here in the forum just link back to the old thread

for your homework you don’t have to mention me

---

<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: [December 18, 2021, 2:03pm UTC](https://discourse.processing.org/t/just-a-bit-lost/34179/5 "2021-12-18T14:03:57Z")

</div>

> [@Chrisir](#):
>
> for your homework you don’t have to mention me

@Jamii,

You should be following the policies of your academic institute and it is in your best interest to do so.

The Processing Forum [Homework Policy](https://discourse.processing.org/faq#homework) also supports this and states:

> Students are responsible for following the policies of their school, class, and instructor. Post as if your instructor is reading.

Focus on your homework.

`:)`
