ellipse(coordsx[0], coordsy[0], 5, 5); // ellipses to start with
ellipse(coordsx[1], coordsy[1], 5, 5);
ellipse(coordsx[2], coordsy[2], 5, 5);
ellipse(coordsx[3], coordsy[3], 5, 5);
cam.endHUD();
if (i == 4) { //
cam.beginHUD();
beginShape(QUADS);
vertex(coordsx[0], coordsy[0], 0); /// bottom face for 2d view
vertex(coordsx[1], coordsy[1], 0);
vertex(coordsx[2], coordsy[2], 0);
vertex(coordsx[3], coordsy[3], 0);
endShape(CLOSE);
cam.endHUD();
}
}
if (kameraaktiv == 1) { //
background (200, 200, 200);
// image(bild, 0, 0);
beginShape(QUADS);
vertex(coordsx[0], coordsy[0], 1); // bottom face
vertex(coordsx[1], coordsy[1], 1);
vertex(coordsx[2], coordsy[2], 1);
vertex(coordsx[3], coordsy[3], 1);
vertex(coordsx[0], coordsy[0], 1); // face 1
vertex(coordsx[1], coordsy[1], 1);
vertex(coordsx[1], coordsy[1], Hoehe);
vertex(coordsx[0], coordsy[0], Hoehe);
vertex(coordsx[2], coordsy[2], 1); // face 2
vertex(coordsx[3], coordsy[3], 1);
vertex(coordsx[3], coordsy[3], Hoehe);
vertex(coordsx[2], coordsy[2], Hoehe);
vertex(coordsx[1], coordsy[1], 1); // face 3
vertex(coordsx[2], coordsy[2], 1);
vertex(coordsx[2], coordsy[2], Hoehe);
vertex(coordsx[1], coordsy[1], Hoehe);
vertex(coordsx[0], coordsy[0], 1); // face 4
vertex(coordsx[3], coordsy[3], 1);
vertex(coordsx[3], coordsy[3], Hoehe);
vertex(coordsx[0], coordsy[0], Hoehe);
vertex(coordsx[0], coordsy[0], Hoehe); // top face
vertex(coordsx[1], coordsy[1], Hoehe);
vertex(coordsx[2], coordsy[2], Hoehe);
vertex(coordsx[3], coordsy[3], Hoehe);
endShape(CLOSE);
}
}
i don't know how i can make it so u can draw multiple shapes. as is now u can only draw one.
do i have to use classes in connection with arrays? every 4th point creates a new shape? can someone pls show me an example how to do that? help much appreciated
I want to make a program that works like a simple version of
sketchup: u draw lines by setting the start and endpoint of a line with your mouse and draw continuous lines by adding more and more points.
polygonal shapes get filled (become a plane) when the shape is closed (e.g. the endpoint of the last line connects with the startpoint of the first line).
in a next step u can extract a volume out of this plane by setting it's height (u "pull" the shape in z axis and creata a volume).
how do i program this? i know i can use arrays somehow to store the points of the lines. but i'm clueless how to do the rest. is there a function that draws polygonal shapes with given x and y coordinates? and is there somehow a function to convert a 2d shape to a 3d volume? maybe just by working in 3D in the first place and adding the z axis values later?