please, if you can check this code.I want to draw ellipse\rect if i click on icon, but when i pressed button on my mouse i draw a line on ellipse\rect
boolean [] button1;
boolean [] button2;
int i, n,u;
void setup()
{
background(250);
thx u for help, but look if you pressed rect you draw rect, when you pressed circle you dwar circle but when i pressed rect and them pressed circle draw both rect+circle i tried to fix this but i dont know how, when i pressed circler (ICON) and then rect(icon) i want turn off circle and drawing rect
but i have 2 questions and thats all)
if (mousePressed==true)
{
fill(255, 0, 0);
rect(mouseX, mouseY, 1, 1);
point(pmouseX, pmouseY);
strokeWeight(8);
if (zz>0&&zz>0&&!keyPressed)
line(zz, zzz, mouseX, mouseY );
distTotal2=distTotal2 + (dist( zz, zzz, mouseX, mouseY )/100) ;
zz=mouseX;
zzz=mouseY;
}
when i use this code i draw and count line but first points with cordination (35;35) give me first dist 35 + another point (8;8) will be 35 + distance before 2 point i dont want count first point i tried do it with for(); but it didnt work
here i have code which build some figure, and now i want to count square if this figure i tried to multiply 1 side on other side (but it didnt wokr) and i think can be other figure circle or triangle
I know russian ukrainian and polish languages and i started lerniang elglish 1 year ago.I want to draw rect\circle or something else and count area of the figure
nono look this code you can draw some line, with this line you can build some figure i want to draw rect or triangle with this lines and count area of figure
Answers
or someone know how connect 2 points by line like on that page
Here is my old code http://www.openprocessing.org/sketch/111878
look that, i want only 1 line behind two points, but in my code there are a lot of lines from each point. Can you check my code?
when you use background you clear the canvas
click mouse then
if (mousePressed==true)
also ok
if (mousePressed)
But after drawing line i want to save it on the board.I want to draw a square with lines
and if it possible connect points like on that page http://hello.processing.org if they are near
here
you wrote
to achieve this: you have to store the points in an ArrayList and make a check which points are near and then connect
maybe look for it in www.openprocessing.org
http://www.openprocessing.org/sketch/8168
thank you very much for help, i study processing only few days so you save my time :D
how to draw line from point which i chose????
when you click the mouse and click again elsewhere you have a line.
That's the point you chose: where you click.
with this new version if you hold a key on the keyBoard, you don't draw lines
thus you can draw e.g. two independent rectangles using the mouse
another one question, how can i delet line or point or another one figure.Can you help me with this ?
when you hold q on the keyboard you delete canvas with the mouse (press mousebutton)
and the last question)) how can i count how many pixels in the line (i want to know Cables length)
use dist() and add all dists of one bus
see reference for dist()
i dont know how to do it where should i use dist()?
here ...
with dist() you give two points and get the distance between them
line as well gets two points as parameters
how can i print "distTotal" on monitor?
text()
i tried to do it, but it print only word "distTotal"
Without the " "
here... line 28 following ...
please, if you can check this code.I want to draw ellipse\rect if i click on icon, but when i pressed button on my mouse i draw a line on ellipse\rect boolean [] button1; boolean [] button2; int i, n,u; void setup() { background(250);
here
no i think that you didnt understand me, i want draw 1 ellipse\rect when i mousePressed but know i draw a lot of ellipse\rect ( on 1 line )
here
thx u for help, but look if you pressed rect you draw rect, when you pressed circle you dwar circle but when i pressed rect and them pressed circle draw both rect+circle i tried to fix this but i dont know how, when i pressed circler (ICON) and then rect(icon) i want turn off circle and drawing rect
Here, I have commented the modifications
im for perseverance but look at this code, here when i pressed key i use background(250); and delete all at window but when i againe draw line
i connect with last point which i drew defore background(250);
when using background also say
this is checked by the if-clause in line 12; no line is made when zz is ==-1
thx
yeah
just use zz=-1;
don't use z=-1;
Also:
after the if-line (line 12) please insert { and
insert } before zz=mouseX; (line 15)
but i have 2 questions and thats all) if (mousePressed==true) { fill(255, 0, 0); rect(mouseX, mouseY, 1, 1); point(pmouseX, pmouseY); strokeWeight(8); if (zz>0&&zz>0&&!keyPressed) line(zz, zzz, mouseX, mouseY ); distTotal2=distTotal2 + (dist( zz, zzz, mouseX, mouseY )/100) ; zz=mouseX; zzz=mouseY; } when i use this code i draw and count line but first points with cordination (35;35) give me first dist 35 + another point (8;8) will be 35 + distance before 2 point i dont want count first point i tried do it with for(); but it didnt work
How to post code
when you post your code:
in the editor hit ctrl-t to auto format
copy it
paste it in the browser
leave 2 empty lines before and 1 empty line after it
mark the code (without the 2 empty lines)
press C in the small command bar.
Also:
after the if-line (line 12) please insert { and
insert } before zz=mouseX; (line 15)
im sorry but i dont understand (
insert an opening bracket {
and a closing bracket
so that the excuted part of the if clause is not one line but two lines
And the main problem which i cant solve
here i have code which build some figure, and now i want to count square if this figure i tried to multiply 1 side on other side (but it didnt wokr) and i think can be other figure circle or triangle
is english your 1st language?
please use more empty lines, like I do
I don't understand "now i want to count square if this figure"
ok, can you show your entire code please?
Do you want that the program can tell you whether you just draw a square, a triangle or a circle?
I know russian ukrainian and polish languages and i started lerniang elglish 1 year ago.I want to draw rect\circle or something else and count area of the figure
No offense
Do you want to measure the size of the area enclosed by the rect?
How many pixels there are in it?
look i draw some figure ( circle, rect, triangle) and count are of this figure which i drew.
please post your entire code...
here... based on an old version...
nono look this code you can draw some line, with this line you can build some figure i want to draw rect or triangle with this lines and count area of figure
post your entire code