Results 1 to 13 of 13

Thread: RotateOriginConnection

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

    Default RotateOriginConnection

    Rotates all the points of TPA from Origin by Degr degrees.

    SCAR Code:
    program New;


    Procedure RotateOriginConnection(Degr: Integer; Origin: TPoint; Var TPA: TPointArray);
    Var
      I: Integer;
      z, d: Extended;
    Begin
      For I := 0 To High(TPA) Do
      Begin
        z := ArcTan2(Origin.y - TPA[i].y, Origin.x - TPA[i].x) + Radians(180);
        z := z + Radians(Degr);
        d := Sqrt(Sqr(iAbs(origin.x - TPA[i].x)) + Sqr(iAbs(origin.y - TPA[i].y)));
        TPA[i].x := Origin.x + Round(d * Cos(z));
        TPA[i].y := Origin.y + Round(d * Sin(z));
      End;
    End;

    Var
      TPA: TPointArray;
      I: Integer;

    begin
      TPA := [Point(552, 50), Point(549, 61)];
      RotateOriginConnection(90, Point(545, 57), TPA);
      For I := 0 To High(TPA) Do
        MoveMouse(TPA[i].x, TPA[i].y);
    end.

  2. #2
    Join Date
    Aug 2007
    Posts
    1,404
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    So if I have a TPointArray that contains all points from 0,0 to 4,4, would it rotate all those points? With some work this could be turned into "FindBitmapRotated", if it does what I think

    -Knives

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

    Default

    Correct

    But 0,0 is a bad point, quadrants 2 and 3 wouldn't be visible.

  4. #4
    Join Date
    Jun 2006
    Posts
    3,861
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    Pretty cool
    BTW, you should be able to change
    SCAR Code:
    d := Sqrt(Sqr(iAbs(origin.x - TPA[i].x)) + Sqr(iAbs(origin.y - TPA[i].y)));
    to
    SCAR Code:
    d := Sqrt(Sqr(origin.x - TPA[i].x) + Sqr(origin.y - TPA[i].y));

  5. #5
    Join Date
    Feb 2007
    Location
    Het ademt zwaar en moedeloos vannacht.
    Posts
    7,211
    Mentioned
    26 Post(s)
    Quoted
    72 Post(s)

    Default

    yea, the iAbs is unnecessary, as the square of any number is always positive.
    I made a new script, check it out!.

  6. #6
    Join Date
    Sep 2006
    Posts
    6,089
    Mentioned
    77 Post(s)
    Quoted
    43 Post(s)

    Default

    Or use Hypot

    SCAR Code:
    Hypot(origin.x - TPA[i].x, origin.y - TPA[i].y)
    Hup Holland Hup!

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

    Default

    Oopsie, I forgot that double - = +

  8. #8
    Join Date
    Jul 2007
    Posts
    1,431
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    What the *uc*?
    I can understand...mhhh...*I have to think good word to decribe it*...Nothing!
    SCAR Code:
    z := ArcTan2(Origin.y - TPA[i].y, Origin.x - TPA[i].x) + Radians(180);
        z := z + Radians(Degr);
        d := Sqrt(Sqr(iAbs(origin.x - TPA[i].x)) + Sqr(iAbs(origin.y - TPA[i].y)));
        TPA[i].x := Origin.x + Round(d * Cos(z));
        TPA[i].y := Origin.y + Round(d * Sin(z));
    What the...?
    Shit hits the van...

    Since I don't know what are Sin Cos Tan etc... Arc?!

    I should have learned it like...woah...2 years ago when I was in 8th grade...
    Well, I got test 5 ^^
    I cribed that...
    I got exam almost 4...
    There were choice exercises...I choosed opposite of Sin - Cos - Tan part....

    Now we're studing some radians...and the 360 system...I'm good there at 360 system*RadialWalk FTW!*, I still don't know radians but I remeber that they are same as 360 system, only smaller values...

    Once again: What the *uuuc*?

    If anyone would describe what they are[Sin, Cos, Tan, Arc, Radian]...anything...
    Btw! I know what iAbs does!

    Nice job though, since it's so l33t I can't understand it...
    Last edited by Wizzup?; 01-24-2011 at 09:09 PM. Reason: (Removed email)
    [CENTER][SIZE="4"]Inactive[/SIZE]I forgot my password[/CENTER]

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

    Default

    Sin = b/c
    Cos = a/c
    Tan = b/a
    Arc[trigfunctionhere] is the inverse of the function, wizzup explained it to me many times like this:

    ArcSin(Sin(x)) = x

    and I was like whats that got to do with anything, but now I understand.


    The best explanation I can do:

    ArcTan returns the angle the tangent was done to



    EDIT: By the way...
    I should have learned it like...woah...2 years ago when I was in 8th grade...
    I'm on 7th grade

  10. #10
    Join Date
    Nov 2006
    Posts
    1,103
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    converts to polar coordinates(is that the correct word?) then rotates then converts back to normal coordinates
    Infractions, reputation, reflection, the dark side of scripting, they are.

  11. #11
    Join Date
    Sep 2006
    Posts
    6,089
    Mentioned
    77 Post(s)
    Quoted
    43 Post(s)

    Default

    If anyone would describe what they are[Sin, Cos, Tan, Arc, Radian]...anything...
    There's a tutorial about it..
    Hup Holland Hup!

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

    Default

    Also, you should read this..

  13. #13
    Join Date
    Jul 2007
    Posts
    1,431
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by nielsie95 View Post
    There's a tutorial about it..
    I'v read it 2 or 3 times...
    [CENTER][SIZE="4"]Inactive[/SIZE]I forgot my password[/CENTER]

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
  •