Processing test(I would need it solutions)


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

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

void setup() {
size(800, 400);

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) 

    if (d < 0) 
        d = d + dy; 

        d += (dy - dx); 


void mousePressed() {

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


? 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

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