Hi,
I started building this little tool for myself. The idea is that the draggable vertexes help me to draw shapes quickly. I would also like to see the coordinates of each vertex and the cursor. How can I display them near the actual vertex-points with "hovering" numbers? Also, how can I create new vertices with double-click?
Quote:float x = 250;
float y = 250;
float x2;
float y2;
float x3 = 100;
float y3 = 150;
void setup() {
size(500,500);
}
void draw() {
background(150);
rectMode(CENTER);
fill(255);
line(x,y,x2,y2);
line(x,y,x3,y3);
ellipse(x, y, 15, 15);
ellipse(x2,y2,15,15);
ellipse(x3,y3,15,15);
float d = dist(x,y,mouseX,mouseY);
float d2 = dist(x2,y2,mouseX, mouseY);
float d3 = dist(x3,y3,mouseX,mouseY);
noFill();
beginShape();
vertex(x,y);
vertex(x2,y2);
vertex(x3,y3);
endShape();
if(d<20 && mousePressed) {
x = mouseX;
y = mouseY;
}
if(d2<20 && mousePressed) {
x2 = mouseX;
y2 = mouseY;
}
if(d3<20 && mousePressed) {
x3 = mouseX;
y3 = mouseY;
}
smooth();
}