User Tag List

Results 1 to 4 of 4

Thread: Math Help Please! Nearest point on a line to another point.

  1. #1
    Clicker Fusion 2.5 MacFusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export ModuleInstall Creator Pro
    Christian_Wheel's Avatar
    Join Date
    Mar 2010
    Location
    Los Angeles
    Posts
    371
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Math Help Please! Nearest point on a line to another point.

    Hi all,

    Working on a fun little Fusion project. I have an imaginary line in my frame that's represented by two points (four invisible counters - X1, Y1, X2, Y2).

    Now I have a third point, say the mouse cursor.

    I need to find the point along the line represented by those counters that is nearest to that point (the mouse cursor).

    Anyone have a formula or algorithm for this? In another programming language I'd be using Vector functions.

  2. #2
    Clicker Fusion 2.5 Developer

    Join Date
    Jul 2008
    Location
    UK
    Posts
    1,393
    Mentioned
    16 Post(s)
    Tagged
    0 Thread(s)
    So use vector functions?
    You don't need a ready made function to calculate a dot product for you: a · b = (ax × bx) + (ay × by)
    But since I happen to have an example lying around already... PointClosestToLine.mfa

  3. #3
    Clicker Fusion 2.5 DeveloperHTML5 Export Module

    Join Date
    Jun 2006
    Posts
    1,469
    Mentioned
    10 Post(s)
    Tagged
    0 Thread(s)
    The formula you want is "Perpendicular Distance from a Point to a Line"

    Here is a link: https://www.intmath.com/plane-analyt...point-line.php

  4. #4
    Clicker Fusion 2.5 MacFusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export ModuleInstall Creator Pro
    Christian_Wheel's Avatar
    Join Date
    Mar 2010
    Location
    Los Angeles
    Posts
    371
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Thank you guys both so much. MuddyMole, that example is phenomenal and exactly what I am looking for. The fact that you had that lying around is absolutely amazing! Thanks again for your help.

Similar Threads

  1. Replies: 10
    Last Post: 2nd April 2018, 02:03 PM
  2. Point to Nearest Target Video Tutorial
    By Almightyzentaco in forum Guides, Tutorials, Examples, Widgets
    Replies: 0
    Last Post: 11th March 2018, 10:51 PM
  3. point chaud de l'active picture ???? Hot point under android
    By Rached MILADI in forum Android Export Module 2.5
    Replies: 6
    Last Post: 11th January 2017, 02:12 PM
  4. Help! - Moving from Point A to Point B - arched.
    By Conno in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 23rd April 2008, 07:15 PM
  5. Smoothly from Point A, too Point B?
    By izac in forum Multimedia Fusion 2 - Technical Support
    Replies: 14
    Last Post: 4th April 2008, 04:46 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
  •