Results 1 to 2 of 2
  1. #1
    nidhirastogi is offline Member
    Join Date
    Jul 2008
    Posts
    16
    Rep Power
    0

    Default In which circle is the Point lying?

    I have a 10x10 grid of circles(similar) in which lies a random point.
    I need to display in which circle is the point. The attributes of the circle and point are : id(int) and position(Point2D).
    Could some one help me with this please?

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,403
    Rep Power
    25

    Default

    Write a class for the circle (x,y,r). Add a method contains() that takes a point (x,Y) and computes if that point is in the circle.
    The logic would be a bit of trig. Or use Pythagorian's rule to see if the distance from the center to the point is less than the radius.
    Make a list of all the circles and call each circle to see which one contains the point.

Similar Threads

  1. Point System
    By Zosden in forum Suggestions & Feedback
    Replies: 2
    Last Post: 02-14-2009, 12:45 PM
  2. Replies: 0
    Last Post: 12-19-2007, 11:47 AM
  3. How to read the MAC of an Access Point
    By goodjonx in forum Networking
    Replies: 2
    Last Post: 12-19-2007, 11:31 AM
  4. is it bug? or am i missing a point?
    By blowguy in forum Threads and Synchronization
    Replies: 1
    Last Post: 11-20-2007, 06:19 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •