User Tag List

Results 1 to 7 of 7

Thread: Calculating Angles (math problem I suspect)

  1. #1
    No Products Registered

    Join Date
    Dec 2008
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Calculating Angles (math problem I suspect)

    First off all, Hello everyone!

    I'm using MMF2Dev Demo and I'm trying to calculate the angle of a specific object (Point1) relative to an anchor object (Anchor) using trigonometry.

    You should get the angle from this calculation: TAN(x) = Point1X - AnchorX / Point1Y - AnchorY

    Or my expression: Tan((X( "Point1" )-X( "Anchor" ))/(Y( "Anchor" )-Y( "Point1" )))

    I can't get the right angle out of this, do you spot any immediate errors?

    Thanks for your time
    ~B

    Here's my file: http://www.gigasize.com/get.php?d=jwxl0ck108d

  2. #2
    No Products Registered

    Join Date
    Mar 2007
    Location
    Sydney, Australia
    Posts
    1,369
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Calculating Angles (math problem I suspect)

    Can you use Advanced Direction Calculator extension? That has functions to calculate angle and distance between 2 points.

  3. #3
    Clicker Multimedia Fusion 2 Developer

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

    Re: Calculating Angles (math problem I suspect)

    yeah the advanced direction calculator has this feature by default - and much more! Make sure to check it out

  4. #4
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export Module
    Ryan's Avatar
    Join Date
    Nov 2008
    Location
    Australia
    Posts
    1,279
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Calculating Angles (math problem I suspect)

    For future reference,
    To get the angle by itself you need to move Tan to the other side of the equation. It's Tan to the power of negative 1, or 1/tan.

    Tan (angle) = opp / adj

    angle = 1/Tan(Xa - Xb / Ya - Yb)

  5. #5
    No Products Registered

    Join Date
    Dec 2008
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Calculating Angles (math problem I suspect)

    Nice guys, really appriciate this!

    Thanks for the correction, Ryan Basic 8th grade maths and I can't manage my head around it... PFF!

  6. #6
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Jun 2006
    Location
    Darlington, UK
    Posts
    3,298
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Calculating Angles (math problem I suspect)

    Wrong again.

    You want atan. Tan-1() is different to Tan()-1.

    IIRC newer builds of MMF have atan2, which takes seperate x and y instead of x/y as the parameter(s), and so gives the correct result for x=0 or y=0.

  7. #7
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export Module
    Ryan's Avatar
    Join Date
    Nov 2008
    Location
    Australia
    Posts
    1,279
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Calculating Angles (math problem I suspect)

    Yeah, Dynasoft is completely right.

    I realised a couple of hours after posting that my logic in 1/tan was wrong. I was trying to remember the name for atan, but assumed 1/tan would have the same effect.

Similar Threads

  1. Graphing a Line Problem (Math)
    By Kid_Roleplay in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 19th September 2012, 06:02 AM
  2. Replies: 4
    Last Post: 2nd July 2012, 08:05 PM
  3. Math Challenge - no actual problem
    By Verd0uX in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 25th June 2009, 04:36 PM
  4. Quick math problem? Me being stupid i think!
    By Gibbon in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 20th June 2008, 12:55 PM
  5. Is there ANY way of doing this? i suspect not...
    By Gibbon in forum Multimedia Fusion 2 - Technical Support
    Replies: 11
    Last Post: 6th January 2007, 10:43 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
  •