10 Replies - 2246 Views - Last Post: 30 January 2009 - 08:27 PM Rate Topic: -----

#1 boomf16   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 27-January 09

How can i draw red line around the object

Post icon  Posted 29 January 2009 - 01:30 AM

if i got

x= 1
y=1
r= sqrt2

how can i draw red lines around the object


thank you
Is This A Good Question/Topic? 0
  • +

Replies To: How can i draw red line around the object

#2 ayman_mastermind   User is offline

  • human.setType("geek");
  • member icon

Reputation: 127
  • View blog
  • Posts: 1,860
  • Joined: 12-December 08

Re: How can i draw red line around the object

Posted 29 January 2009 - 01:45 AM

hello boomf16 can you please a little descriptive about what your problem is? thanks... you mean drawing a red square or rectangle around an object?
Was This Post Helpful? 0
  • +
  • -

#3 boomf16   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 27-January 09

Re: How can i draw red line around the object

Posted 29 January 2009 - 01:52 AM

i'm soryy
if i want to draw red cycle around the object How can i do
Was This Post Helpful? 0
  • +
  • -

#4 ayman_mastermind   User is offline

  • human.setType("geek");
  • member icon

Reputation: 127
  • View blog
  • Posts: 1,860
  • Joined: 12-December 08

Re: How can i draw red line around the object

Posted 29 January 2009 - 01:54 AM

Quote

i'm soryy
if i want to draw red cycle around the object How can i do

what kind of object? a button for example?...

This post has been edited by ayman_mastermind: 29 January 2009 - 01:54 AM

Was This Post Helpful? 0
  • +
  • -

#5 boomf16   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 27-January 09

Re: How can i draw red line around the object

Posted 29 January 2009 - 02:11 AM

the object is circle has r=sqrt2, x=1,y=1

and i have one question about my code i don't understand my image after i run code it not draw cycle around circlr if you ready to help with my code please give me your e-mail i will send my code to you for check because now i'm and my friend got possible and don'have enough of time. i'm just learn about java. thank for your help
Was This Post Helpful? 0
  • +
  • -

#6 pbl   User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8381
  • View blog
  • Posts: 31,956
  • Joined: 06-March 08

Re: How can i draw red line around the object

Posted 29 January 2009 - 05:14 PM

View Postboomf16, on 29 Jan, 2009 - 01:11 AM, said:

the object is circle has r=sqrt2, x=1,y=1

and i have one question about my code i don't understand my image after i run code it not draw cycle around circlr if you ready to help with my code please give me your e-mail i will send my code to you for check because now i'm and my friend got possible and don'have enough of time. i'm just learn about java. thank for your help

A Java object is a concept represented by a serie of bytes in computer memory. You cannot draw a circle around that :D

Seriously can you be clearer ? And why don't you post your code ?
Was This Post Helpful? 0
  • +
  • -

#7 boomf16   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 27-January 09

Re: How can i draw red line around the object

Posted 29 January 2009 - 10:23 PM

I ever run follow this code I think it must show the line too. but it cannot show i don' understand so i will try to know how to draw the cycle if you have new way please tell me.


// draw circle at x y
		private void drawCircle(int pix, int xCenter, int yCenter) {
			pix = 100; // 250
			int x, y, r2;	
			int radius = r;	
			r2 = r * r;

			setPixel(pix, xCenter, yCenter + radius);

			setPixel(pix, xCenter, yCenter - radius);

			setPixel(pix, xCenter + radius, yCenter);

			setPixel(pix, xCenter - radius, yCenter);

			y = radius;
			x = 1;
			y = (int) (Math.sqrt(r2 - 1) + 0.5);

			while (x < y) {
												setPixel(pix, xCenter + x, yCenter + y);

			setPixel(pix, xCenter + x, yCenter - y);

			setPixel(pix, xCenter - x, yCenter + y);

			setPixel(pix, xCenter - x, yCenter - y);

			setPixel(pix, xCenter + y, yCenter + x);

			setPixel(pix, xCenter + y, yCenter - x);

			setPixel(pix, xCenter - y, yCenter + x);

			setPixel(pix, xCenter - y, yCenter - x);

			x += 1;

			y = (int) (Math.sqrt(r2 - x*x) + 0.5);
												  }

		if (x == y) {
	
			setPixel(pix, xCenter + x, yCenter + y);

			setPixel(pix, xCenter + x, yCenter - y);

			setPixel(pix, xCenter - x, yCenter + y);

			setPixel(pix, xCenter - x, yCenter - y);

					  }
		}


Was This Post Helpful? 0
  • +
  • -

#8 pbl   User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8381
  • View blog
  • Posts: 31,956
  • Joined: 06-March 08

Re: How can i draw red line around the object

Posted 29 January 2009 - 10:27 PM

don't see your code doing any drawing
what does setPixel() do ?
Was This Post Helpful? 0
  • +
  • -

#9 boomf16   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 27-January 09

Re: How can i draw red line around the object

Post icon  Posted 30 January 2009 - 12:39 AM

I want algorithm of circle hough transform in java code who ever get it or who can write the algoritm in java code please tell me


thank you
Was This Post Helpful? 0
  • +
  • -

#10 ayman_mastermind   User is offline

  • human.setType("geek");
  • member icon

Reputation: 127
  • View blog
  • Posts: 1,860
  • Joined: 12-December 08

Re: How can i draw red line around the object

Posted 30 January 2009 - 05:06 AM

Dream.In.Code has a policy by which we prefer to see a good faith effort on your part before providing source code for homework assignments. Please post the code you have written in an effort to resolve the problem, and our members would be happy to provide some guidance. Be sure to include a description of any errors you are encountering as well.

Please post like this: :code:

Thank you for helping us helping you.
And by the way, always remember that google is your freind to find stuff in such cases... goog luck :)
Was This Post Helpful? 0
  • +
  • -

#11 pbl   User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8381
  • View blog
  • Posts: 31,956
  • Joined: 06-March 08

Re: How can i draw red line around the object

Posted 30 January 2009 - 08:27 PM

Please avoid double posts :angry:
Topics merged
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1