Jump to content
Sign in to follow this  
BrettF

Math Help...

Recommended Posts

BrettF

Hi. Say I have an image that looks like:

See that pink dot? I want to work out what circle it is in. Does anyone have any math equations that could help me? It would be greatly appreciated :P

Share this post


Link to post
Share on other sites
AquilaChill

not shure about math functions, but you could do a simple pixelsearch to find the pink & then get the color around it with

PixelGetColor($foundx-3,$foundy-3)oÝ÷ ÚþÞÚºÚ"µÍÌÍÜ[ØÛÛÜI][ÝÙXÈÜ^[YHÙH[É][ÝÂÌÍÙ[[ÏT^[ÙXÚ
    ÌÍÖK ÌÍÖLK    ÌÍÖ  ÌÍÖL ÌÍÜ[ØÛÛÜBÌÍÞIÌÍÙ[[ÖÌBÌÍÞOIÌÍÙ[[ÖÌWB    ÌÍÞIÌÍÞ
ÌB ÌÍÞOIÌÍÞJÌB  ÌÍÜ^ÛÛÜT^[Ù]ÛÛÜ   ÌÍÞ  ÌÍÞJB[[  ÌÍÜ^ÛÛÜÉÝÉÌÍÜ[ØÛÛÜ

if you wanted to check down right of it

.. or something

hope you get the point, unless i don't understand what you want.


people are anoying, am i? ;) v2.95

Share this post


Link to post
Share on other sites
BrettF

not shure about math functions, but you could do a simple pixelsearch to find the pink & then get the color around it with

PixelGetColor($foundx-3,$foundy-3)oÝ÷ ÚþÞÚºÚ"µÍÌÍÜ[ØÛÛÜI][ÝÙXÈÜ^[YHÙH[É][ÝÂÌÍÙ[[ÏT^[ÙXÚ
    ÌÍÖK ÌÍÖLK    ÌÍÖ  ÌÍÖL ÌÍÜ[ØÛÛÜBÌÍÞIÌÍÙ[[ÖÌBÌÍÞOIÌÍÙ[[ÖÌWB    ÌÍÞIÌÍÞ
ÌB ÌÍÞOIÌÍÞJÌB  ÌÍÜ^ÛÛÜT^[Ù]ÛÛÜ   ÌÍÞ  ÌÍÞJB[[  ÌÍÜ^ÛÛÜÉÝÉÌÍÜ[ØÛÛÜ

if you wanted to check down right of it

.. or something

hope you get the point, unless i don't understand what you want.

Yes. That was my other alternative, cept I'm pretty sure there is a way with pi or something... :P

Share this post


Link to post
Share on other sites
Nahuel

That's a very interesting geometry problem :P

Here's my solution:

*Assuming that the radius of the big circle is 50 and that each ring's width is the same (50/6), we can write the inequations for each one of the rings like this:

Circle 1

(X-50)^2 + (Y-50)^2 <= (50/6)^2

Circle 2

(X-50)^2 + (Y-50)^2 <= (2*50/6)^2

Circle 3

(X-50)^2 + (Y-50)^2 <= (3*50/6)^2

Circle 4

(X-50)^2 + (Y-50)^2 <= (4*50/6)^2

Circle 5

(X-50)^2 + (Y-50)^2 <= (5*50/6)^2

Circle 6

(X-50)^2 + (Y-50)^2 <= (50)^2

What you need to do is start checking from the first equation to see if the coordinates of the dot you have solve the inequation.. Start from circle one, continue with 2, then 3, etc... Notice that if you check with the circle 6 inequation, it'll always solve it. If the coordinates you have don't solve any of them, then the dot is outside the circle.

Unfortunately, I assumed wrong because their width is not the same. So, using my equations will tell you that, in the example, the pink dot is in the circle 4. This could be fixed if I knew the exact width of each one of them OR if you draw it so they are all the same ;)

Check this out.

$X=70
$Y=70

For $i=1 To 6 
    $Res=(($X - 50)^2 + ($Y-50)^2) <= ($i*50/6)^2
    If $Res Then ExitLoop
Next

If $Res Then
    MsgBox(0,"","The dot is in circle number: " & $i)
Else
    MsgBox(0,"","The dot seems to be outside the board")
EndIf
Edited by Nahuel

Share this post


Link to post
Share on other sites
BrettF
Nahuel

I'm glad I helped :P I think I know what it's for ;) Cool idea.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×