# Processing test(I would need it solutions)

**URL:** <https://discourse.processing.org/t/processing-test-i-would-need-it-solutions/11154>\
**Category:** Coding Questions\
**Tags:** homework\
**Created:** [May 12, 2019, 7:07am UTC](https://discourse.processing.org/t/processing-test-i-would-need-it-solutions/11154 "2019-05-12T07:07:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![derecH](https://avatars.discourse-cdn.com/v4/letter/d/57b2e6/32.png) [@derecH](https://discourse.processing.org/u/derecH)\
**Post date:** [May 12, 2019, 7:07am UTC](https://discourse.processing.org/t/processing-test-i-would-need-it-solutions/11154/1 "2019-05-12T07:07:23Z")

</div>

During the course, the graphical functions of the language are displayed only for the graphical functions of the language  
point () function and color adjustment functions can be used.  
• Our applications should have the following structure:  
setup {}  
draw {}  
own-section drawing {}  
other, their functions {}  
mousepressed {}  
keyPressed {}  
• Store and load the model points using the Table object and loadTable () function.  
About the tasks to be done

1. **The Section Drawing Function (Incremental Algorithm or Midpoint Algorithm)**  
• waiting for 2 point coordinates as input parameter  
• Draws the same section on the dotted point coordinates  
• Draws a point with a single point on the same point

2. **Rectangle Cutting Function (Cohen-Sutherland Algorithm)**  
• expects 4 point coordinates as input parameters, the first two of which are a section  
the second two give the opposite vertices of a rectangle, the rectangle of the cutter. THE  
function to produce the endpoints of the section resulting from the cut  
• Cut to point-to-point coordinates - for both section and cutting rectangle  
the same result

3. **Konvex polygon filling function (Scan-line algorithm)**  
• Scanning a graphic window fills a drawn closed convex broken line with the line color

4. Create an application in Processing, which can be any number by calling function 1  
draws a section in such a way that the endpoints that define the section can be given by mouse click!  
• The graphics window should be 640x480

5. Based on the application of Task 4, create a program in Processing language of any size

- but not larger than the quarter screen - cut rectangle using the cursor keys  
makes it mobile! The endpoints that define the sections can be added by mouse click  
it! The sections you specify during the run are displayed according to the current position of the cut!  
• The graphics window should be 640x480  
• Do not show the cutting rectangle

---

<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:** [May 12, 2019, 7:11am UTC](https://discourse.processing.org/t/processing-test-i-would-need-it-solutions/11154/2 "2019-05-12T07:11:56Z")

</div>

why you post your home work here?  
we will / can not / do it for you.

if you have questions regarding commands

- show your code ( correctly formatted by \</\> )  
( as moderator show you already at your last posting )
- describe the command / error / problem what occurred

---

<div class="post-metadata">

**Author:** ![derecH](https://avatars.discourse-cdn.com/v4/letter/d/57b2e6/32.png) [@derecH](https://discourse.processing.org/u/derecH)\
**Post date:** [May 12, 2019, 8:22am UTC](https://discourse.processing.org/t/processing-test-i-would-need-it-solutions/11154/3 "2019-05-12T08:22:29Z")

</div>

```auto
void setup() {
  size(800, 400);
  noLoop();
  smooth();
}

void draw() {
  
}
static void midPoint(int X1, int Y1, 
                     int X2, int Y2) 
{  
    int dx = X2 - X1; 
    int dy = Y2 - Y1; 
  
    int d = dy - (dx/2); 
    int x = X1, y = Y1; 

    while (x < X2) 
    { 
        x++; 
 
        if (d < 0) 
            d = d + dy; 
   
        else
        { 
            d += (dy - dx); 
            y++; 
        }   
    } 
} 

void mousePressed() {
  redraw();
}

public static void main (String[] args) 
{ 
    int X1 = 2, Y1 = 2, X2 = 8, Y2 = 5; 
    midPoint(X1, Y1, X2, Y2); 
} 

```

I don’t understand the draw{ ???} part

---

<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:** [May 12, 2019, 8:34am UTC](https://discourse.processing.org/t/processing-test-i-would-need-it-solutions/11154/4 "2019-05-12T08:34:21Z")

</div>

? sorry, but some things are very wrong here,

-a- you not formatted your code, as i told you.  
( until you repair it no help )

-b- the posted test /homework questions are not beginner level,

but the code your posted now add your question about  
your empty

```auto
void draw () {}

```

what will leave you with a empty canvas

show that

- you not even have started with processing basics.
- just copy some internet code together ( like on my request / idea for code )

i recommend you spend a night watching beginner video tutorial to get the first idea,  
hope you are a fast learner.

* * *

please understand that we have been ordered not to  
do the homework for students  
as teachers claimed we help cheating

* * *
