• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

two rectangle objects intersecting even when they are not

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I'm having an issue where I always get two rectangle objects intersecting even when they are not. I'm lost in my own code.


 
Sheriff
Posts: 28417
102
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't understand what "get two rectangle objects intersecting" means. The code you posted doesn't have any rectangle objects in it and it doesn't have a method for determining whether something is intersecting something else. So are you asking about that code? If so, which part of it?
 
Patty Lebowski
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Paul Clapham wrote:I don't understand what "get two rectangle objects intersecting" means. The code you posted doesn't have any rectangle objects in it and it doesn't have a method for determining whether something is intersecting something else. So are you asking about that code? If so, which part of it?



I'm sorry, I should have explained it better. I'm trying to create a lock in the sense that a user clicks on the screen in four different places. To do this I'm having every time the user clicks create a "rectangle" (a circle shape on screen), storing it, and then have the user click a second time creating circles and seeing if all four circles line up properly and intersect the previous set password. The issue is that they always come back as the correct intersecting shape password, even when they are not intersecting.  I've been testing different things, one of them being:  if(ellipse.contains(e.getPoint())), to see what I'm clicking on. The results always return back the Rectangle2D class name when printed out, meaning that there are rectangles that I'm not seeing or something else is messed up.

I could have probably avoided this mess if I could figure out how to make a single user click radius larger, and then comparing that range in two arrays. But I couldn't figure that out either.
 
Marshal
Posts: 80780
489
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I had a look at your code yesterday and there is lots to say about it, I am afraid. I think you will end up having to start from scratch, but please continue by telling is what you are trying to do. What is a lock? How do you get it from four little circles? I ran your code and the little instructions window was not at all clear. I couldn't tell what I was supposed to do from it.
 
Paul Clapham
Sheriff
Posts: 28417
102
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I sort of understand that, only there's a lot I don't understand. For example how clicking the screen twice can create four circles... but anyway here's what I see.

When the user clicks the screen you get a mouse pressed event. You then create a circle (named "ellipse", which is a bit distracting) whose centre is where the mouse click occurs and whose radius is 30. Later in the event processing you ask whether the user clicked in that circle. Which of course they did because you created the circle to be a circle around where the user clicked.

So that isn't what you want to do. However I don't know what you should do instead. It seems to me like there's already a password somewhere which somehow has some circles associated with it, and you want to see whether the user clicked in one of those circles. But I don't see any circles anywhere else in your program which you could use.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic