Results 1 to 3 of 3

Thread: Sin Cos - Nonesence

  1. #1
    Join Date
    Oct 2006
    Location
    finland, helsinki
    Posts
    2,501
    Mentioned
    3 Post(s)
    Quoted
    2 Post(s)

    Default Sin Cos - Nonesence

    Well since i really suck in math and i have a problem..

    I have a coordinate which is inside MMX1, MMY1, MMX2, MMY2 and i want to move that coordinate 5 - 10 pixels towards MMCX, MMCY.

    Now please gimme some code :P

    Code:
    • Narcle: I recall Jukka releasing a bunch of scripts like this before... Its how he rolls I think. rofl
    • Solarwind: Dude, you are like... t3h s3x.
    • Hy71194: JuKKa you're a machine! You released 3 scripts in 10 minutes! :O
    • benjaa: woah.... Jukka is the man Guildminer pwns all
    • NaumanAkhlaQ: And JuKKa Is my Her0!

  2. #2
    Join Date
    Dec 2006
    Location
    Copy pastin to my C#
    Posts
    3,788
    Mentioned
    8 Post(s)
    Quoted
    29 Post(s)

    Default

    SCAR Code:
    Procedure GetCloser(Var Point: TPoint; Origin: TPoint; HowMuchCloser: Integer);
    Var
      Angle, Dist: Integer;
    Begin
      Angle := Round(Degrees(ArcTan2(Origin.y - Point.y, Origin.x - Point.x))) - 90;
      If Angle < 0 Then
        Angle := Angle + 360;
      Dist := Distance(Point.x, Point.y, Origin.x, Origin.y) - HowMuchCloser;
      Point.x := Origin.x + Round(Dist * Cos(Radians(Angle - 90)));
      Point.y := Origin.y + Round(Dist * Sin(Radians(Angle - 90)));
    End;


    Stupid leecher You've been glancing at the thread for like half an hour without saying thank you


    @Math people: Don't complain about the "-90", I've thinked, tested and it's worked.

    Look - and example:

    ArcTan2 would return me a -90 for example. -90 points to west, then we make it -180, and add 360, voila, it's to south as supposed to.

  3. #3
    Join Date
    Oct 2006
    Location
    finland, helsinki
    Posts
    2,501
    Mentioned
    3 Post(s)
    Quoted
    2 Post(s)

    Default

    yeah i just noticed.. i dont need that anymore xP i found a easier way to do the thing i wanted ... a secret for now.

    Code:
    • Narcle: I recall Jukka releasing a bunch of scripts like this before... Its how he rolls I think. rofl
    • Solarwind: Dude, you are like... t3h s3x.
    • Hy71194: JuKKa you're a machine! You released 3 scripts in 10 minutes! :O
    • benjaa: woah.... Jukka is the man Guildminer pwns all
    • NaumanAkhlaQ: And JuKKa Is my Her0!

Thread Information

Users Browsing this Thread

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

Posting Permissions

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