User Tag List

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 12

Thread: Pixel distance

  1. #1
    Clicker Fusion 2.5 DeveloperiOS Export ModuleXNA Export ModuleInstall Creator Pro

    Join Date
    Jul 2006
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Pixel distance

    Hello
    I have seen a formula that counts the distance between two pixels, (x,y) and another (x,y). I know that you can use the angle calculator to do that, but I don't whant to use it in this game. In other words, I'd be very glad if someone knew this magical mathematical formula. (-:

    P.S. It was long

  2. #2
    No Products Registered

    Join Date
    Aug 2006
    Location
    Westcountry, UK
    Posts
    862
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Pixel distance

    Here is a distance formula divised by Stuckboy:[:"blue"]

    \/¯((X1-X2)²+(Y1-Y2)²)[/]

  3. #3
    Forum Moderator Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export Module
    Sphax's Avatar
    Join Date
    Jun 2006
    Location
    Paris, France
    Posts
    4,454
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Pixel distance

    Do you know Pythagore ?
    You learn that at school...

    The formula is : sqrt( (x2-x1)^2 + (y2-y1)^2 )

  4. #4
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)

    Join Date
    Jun 2006
    Location
    Australia
    Posts
    682
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Pixel distance

    it's pythagoras, not hard.
    squareroot of: X difference squared plus Y difference squared

    Edit: I'm too slow by a minute

  5. #5
    No Products Registered

    Join Date
    Aug 2006
    Location
    Westcountry, UK
    Posts
    862
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Pixel distance

    []Do you know Pythagore ?
    You learn that at school...[/]
    haven't got that far <img src="/center/images/graemlins/wink.gif" alt="" />

  6. #6
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)

    Join Date
    Jun 2006
    Location
    Australia
    Posts
    682
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Pixel distance

    you must be about... 13 then, or younger

  7. #7
    No Products Registered

    Join Date
    Jun 2006
    Posts
    220
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Pixel distance

    Basically you need to think about the two points being part of a right angled triangle.

    Pythagoras' formula is basically:

    (X-Difference)x(X-Difference) + (Y-Difference)x(Y-Difference) = (Distance)x(Distance)

    Or basically X squared + Y squared = distance squared

    Then just get a square root of the result, and you should have your distance. I've never really used it though - there are extensions out there which just do it for you :P

    Take a look at: http://upload.wikimedia.org/wikipedi...agoras_abc.png

  8. #8
    No Products Registered

    Join Date
    Aug 2006
    Location
    Westcountry, UK
    Posts
    862
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Pixel distance

    (only joking lol)

    pythag is very useful <img src="/center/images/graemlins/smile.gif" alt="" />

  9. #9
    Forum Moderator Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export Module
    Sphax's Avatar
    Join Date
    Jun 2006
    Location
    Paris, France
    Posts
    4,454
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Pixel distance

    One council ( <img src="/center/images/graemlins/wink.gif" alt="" />) : Do not use extensions when they are not necessary. <img src="/center/images/graemlins/tongue.gif" alt="" />

  10. #10
    No Products Registered

    Join Date
    Jul 2006
    Location
    Texas
    Posts
    1,225
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Pixel distance

    In MMF2 what you would need to have typed out is:
    Sqr(((X( "Object 1" ) - X( "Object 2" )) Pow 2 )+ ((Y( "Object 1" ) - Y( "Object 2" ) Pow 2)))

    Why hasn't anybody figured out the 'pow' operator yet???

Page 1 of 2 1 2 LastLast

Similar Threads

  1. Get size in pixel of a string (or convert string length to pixel)
    By iOSC in forum Multimedia Fusion 2 - Technical Support
    Replies: 6
    Last Post: 21st March 2013, 06:30 PM
  2. How would you move an object in straight line pixel by pixel from location to another
    By Tsun in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 22nd December 2012, 10:38 PM
  3. Beta 11: Moving buttons Pixel by Pixel
    By Kisguri in forum iOS Export Module Version 2.0
    Replies: 2
    Last Post: 16th January 2011, 08:54 AM
  4. Jump from walls pixel by pixel?
    By Carlos182 in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 29th September 2009, 05:15 AM
  5. Sub-Pixel Positioning Pixel Shader
    By LazyCoder in forum Hardware Accelerated Runtime
    Replies: 15
    Last Post: 16th March 2008, 11:24 AM

Posting Permissions

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