User Tag List

Results 1 to 6 of 6

Thread: Mirror a value within a range

  1. #1
    Clicker Multimedia Fusion 2 DeveloperiOS Export Module
    Nifflas's Avatar
    Join Date
    Jul 2006
    Posts
    2,613
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Mirror a value within a range

    With euclidean modulo now working, I find myself having to mirror a value between a minimum and maximum value. Sort of like what abs(5) does with negative values, but more complicated. It would look like this on a graph:



    Can be both an extension or c++ code, I'm going to add it to an extension.

  2. #2
    Clicker Multimedia Fusion 2
    SEELE's Avatar
    Join Date
    Jul 2007
    Location
    Terra australis incognito
    Posts
    1,916
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Mirror a value within a range

    It sure does involve both MOD and ABS...

    output=minimum+Abs((input mod maximum)-(maximum/2.0))

    (remember abs in C++ is math.abs )

    Heres an example mfa..


  3. #3
    Clicker Multimedia Fusion 2 DeveloperiOS Export Module
    Nifflas's Avatar
    Join Date
    Jul 2006
    Posts
    2,613
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Mirror a value within a range

    Thanks! It uses a lot simpler maths than anything I'd have come up with! Awesome and thank you a lot!

  4. #4
    Clicker Multimedia Fusion 2 DeveloperiOS Export Module
    Nifflas's Avatar
    Join Date
    Jul 2006
    Posts
    2,613
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Mirror a value within a range

    It still didn't behave fully as I intended, so I changed the maths until I got it to work. Thanks a lot for the starting point though, otherwise I'd have been quite clueless.

    Here's what I came up with:

    mimimum+Abs(((0-x+maximum) mod ((minimum-maximum)*2))-(minimum-maximum))

    Drawn in a graph it looks like this:

  5. #5
    Clicker Fusion 2.5 DeveloperSWF Export ModuleUnicode Add-on
    Looki's Avatar
    Join Date
    Aug 2006
    Location
    Karlsruhe, Germany
    Posts
    3,739
    Mentioned
    4 Post(s)
    Tagged
    1 Thread(s)

    Re: Mirror a value within a range

    SEELE, you're a genius, but it's still just abs in C

    *hides in shame with his method that used if conditions and didn't work for negative numbers*

  6. #6
    Clicker Multimedia Fusion 2
    SEELE's Avatar
    Join Date
    Jul 2007
    Location
    Terra australis incognito
    Posts
    1,916
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Mirror a value within a range

    hehe Looki

    Your right ofcoarse! i was thinking of LUA :blush:

Similar Threads

  1. Replies: 18
    Last Post: 25th November 2011, 12:48 PM
  2. [Request] - Realtime Mirror Object
    By Nico in forum Extension Development
    Replies: 12
    Last Post: 9th October 2009, 10:52 PM
  3. Suggestion - Mirror effect in MMF2
    By Snakesoft in forum Multimedia Fusion 2 - Technical Support
    Replies: 15
    Last Post: 18th July 2006, 02:57 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
  •