Results 1 to 8 of 8

Thread: MATHS HELP!

  1. #1
    K_I_Z_A's Avatar
    Join Date
    Apr 2004
    Location
    Darwin brus
    Posts
    1,463
    Liked
    5 times
    Points: 14,403, Level: 52
    Points: 14,403, Level: 52
    Achievements:
    Veteran (6+ years registered)

    MATHS HELP!

    HEY ALL

    so i have a maths problem and i need to figure out a formula. im sure its easy but its escaping me atm

    so i have a picture and i need to make sure it doesnt go outside a box

    the picture can be magnified up to 3x
    and the x and y coordinates can be changed

    at 1x magnification the max the x coordinate can be is 700

    but if i change it to 2x or 3x magnification at 700 it goes outside the box

    i need a formula that when i change the magnification to 2x or 3x it needs to make the x coordinate smaller by a percentage or a ratio or something...

    my code at the moment looks like this (user inputs are xbox (x coordinate) ybox (y coordinate) magbox (magnification)

    DrawWings(paper, xBox, yBox, magBox)

    my first thought was to do this

    DrawWings(paper, (xBox / magBox), (yBox / magBox), magBox)
    but that didnt work obviously... the / being the divide by sign.... i think im gonna end up kicking myself when i know the answer

  2. #2
    K_I_Z_A's Avatar
    Join Date
    Apr 2004
    Location
    Darwin brus
    Posts
    1,463
    Liked
    5 times
    Points: 14,403, Level: 52
    Points: 14,403, Level: 52
    Achievements:
    Veteran (6+ years registered)
    And if it helps it only fits at 3x mag if the x coord is 1

  3. #3
    The Beast of Gevaudan Aegis's Avatar
    Join Date
    Mar 2006
    Location
    Darwin, NT
    Posts
    7,225
    Liked
    224 times
    Points: 43,157, Level: 91
    Points: 43,157, Level: 91
    Achievements:
    First Class Tagger (tags posts a lot)Album Owner (has created a picture album)Hyperactive!Socialite (3+ friends)Loved (50+ liked posts)Veteran (6+ years registered)
    Awards:
    Caffeinated (very active)
    IF statements ftw.

    below is some code from an image resizing function i wrote in one of our sites - effectively does what you're after where args.height and args.width are the max values allowed. info.width and info.height are the existing dimensions of the image.

    Code:
    Please Login or Register to see this snippet
    my suggestion would be something like that, but put ANOTHER if statement around it which is based on the mag level, and use that to set the args.height and args.width.

    Obviously this is not the language you're working in, but the logic should be piss easy to follow.

  4. #4
    K_I_Z_A's Avatar
    Join Date
    Apr 2004
    Location
    Darwin brus
    Posts
    1,463
    Liked
    5 times
    Points: 14,403, Level: 52
    Points: 14,403, Level: 52
    Achievements:
    Veteran (6+ years registered)
    hey thanks for that but im up to week 6 of visual basic and its the first programming i have ever done in my life so what you put up there is like chinese to me...

  5. #5
    Old school Joshuayu101's Avatar
    Join Date
    Oct 2006
    Location
    Darwin, NT
    Posts
    1,244
    Liked
    69 times
    Points: 9,238, Level: 41
    Points: 9,238, Level: 41
    Achievements:
    Socialite (3+ friends)3+ years registeredSecond Class Tagger (tags posts a bit)Loved (50+ liked posts)
    Quote Originally Posted by K_I_Z_A View Post
    hey thanks for that but im up to week 6 of visual basic and its the first programming i have ever done in my life so what you put up there is like chinese to me...
    I'll have a look at mine and help ya out on the weekend
    Google+
    https://profiles.google.com/u/0/114089744053911277263

  6. #6
    K_I_Z_A's Avatar
    Join Date
    Apr 2004
    Location
    Darwin brus
    Posts
    1,463
    Liked
    5 times
    Points: 14,403, Level: 52
    Points: 14,403, Level: 52
    Achievements:
    Veteran (6+ years registered)
    cool thanks

  7. #7
    K_I_Z_A's Avatar
    Join Date
    Apr 2004
    Location
    Darwin brus
    Posts
    1,463
    Liked
    5 times
    Points: 14,403, Level: 52
    Points: 14,403, Level: 52
    Achievements:
    Veteran (6+ years registered)
    DrawEyes(paper, CInt(xBox / magBox ^ magBox), CInt((yBox / magBox ^ magBox)), magBox)

    got it

  8. #8
    Resident Brookie23's Avatar
    Join Date
    Mar 2005
    Location
    Darwin, NT
    Posts
    584
    Liked
    2 times
    Points: 10,927, Level: 45
    Points: 10,927, Level: 45
    Achievements:
    Veteran (6+ years registered)First Class Tagger (tags posts a lot)Album Owner (has created a picture album)Socialite (3+ friends)
    Awards:
    OCD Indexer (master post tagger)
    This could have been represented by a simple algebraic formula, but shit, all those visual basic variables make it so much more complicated than it needs to be!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)