Results 1 to 5 of 5

Thread: Draw Pizza/ Cartwheel

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

    Default Draw Pizza/ Cartwheel

    Well JuKKa needed a proc that moves a point closer to another point and I was bored and made something small, I thought I'd post it if someone would happen to learn something from it.

    SCAR Code:
    Program New;

    Function SetPointCloser(Point: TPoint; Origin: TPoint; tDist: Integer): TPoint;
    Var
      Angle, Dist: Integer;
    Begin
      Angle := Round(Degrees(ArcTan2(Point.y - Origin.y, Point.x - Origin.x))) - 90;
      If Angle < 0 Then
        Angle := Angle + 360;
      Dist := Distance(Point.x, Point.y, Origin.x, Origin.y) - tDist;
      Result.x := Origin.x + Round(Dist * Cos(Radians(Angle - 90)));
      Result.y := Origin.y + Round(Dist * Sin(Radians(Angle - 90)));
    End;


    Function doArc(Origin: TPoint; Dist, SD, ED: Integer): TPointArray;
    Var
      I: Integer;
    Begin
      SetArrayLength(Result, ED - SD + 1);
      For I := SD To ED Do
      Begin
        Result[ED - i].x := Origin.x + Round(Dist * Cos(Radians(SD + i - 90)));
        Result[ED - i].y := Origin.y + Round(Dist * Sin(Radians(SD + i - 90)));
      End;
    End;


    Function LetsMakePizza(Origin: TPoint; Dist, SD, ED: Integer): TPointArray;
    Var
      tmp: TPointArray;
      C, I: Integer;
    Begin
      tmp := doArc(Origin, Dist, SD, ED);
      SetArrayLength(Result, Dist * 2 + 1);
      For C := 0 To 1 Do
        Case C Of
          0: For I := 1 To Dist Do
               Result[i] := SetPointCloser(tmp[0], Origin, i);
          1: For I := 1 To Dist Do
               Result[Dist + i] := SetPointCloser(tmp[High(tmp)], Origin, i);
        End;
    End;


    Var
      Arc, Tmp, TPA: TPointArray;
    Var
      I, II, III: Integer;
    Var
      BitMap: Integer;

    Begin
      DisplayDebugImgWindow(500, 500);
      Bitmap := BitmapFromString(500, 500, '');
      For I := 0 To 5 Do
      Begin
        Arc := doArc(Point(250, 250), 100, I * 60, I * 60 + 120);
        Tmp := LetsMakePizza(Point(250, 250), 100, I * 60, I * 60 + 60);
        TPA := CombineTPA(Arc, Tmp);
        III := High(TPA);
        For II := 0 To III Do
          FastSetPixel(Bitmap, TPA[ii].x, TPA[ii].y, 255);
      End;
      CopyCanvas(GetBitmapCanvas(bitmap), GetDebugCanvas, 0, 0, 500, 500, 0, 0, 500, 500);
    End.

  2. #2
    Join Date
    Jan 2008
    Location
    Frankfurt, Germany
    Posts
    742
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    [homer simpson's voice] ahhhhhhh... ppppiiiizzzzaaaa... [/homer simpson's voice]
    Looks nice, and uhm... and... puh, really have no clue what more to say.
    There is nothing right in my left brain and there is nothing left in my right brain.

  3. #3
    Join Date
    Jun 2007
    Posts
    785
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Lol cool, i need to learn something more about canvas drawing

    [22:20] <[-jesus-]> freddy, go uninstall yourself

  4. #4
    Join Date
    Jun 2007
    Location
    Wednesday
    Posts
    2,446
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    The traingular-based functions for making circles will always live on! So from what I can see, it works by making a circle then inputting all the points on it into a tpoint instead of a movemouse, then the exact same for all the little slice bits and it then puts all of the points up onto the canvas. Once again, an entirely useless but fun none the less function/procedure's hurrah!
    By reading this signature you agree that mixster is superior to you in each and every way except the bad ways but including the really bad ways.

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

    Default

    No, drawing the slices isn't exactly the same as drawing the arc, you also need to draw the legs of the "triangles".

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. How to Draw Stuff In RS
    By Naum in forum RuneScape Guides
    Replies: 79
    Last Post: 10-13-2008, 11:05 AM
  2. Ancho-pizza!!!
    By Ultra in forum RS3 Outdated / Broken Scripts
    Replies: 68
    Last Post: 10-10-2008, 06:24 PM
  3. Somebody order Pizza ?
    By RAM in forum Who Are You ? Who ? Who ?
    Replies: 28
    Last Post: 02-19-2008, 02:32 AM

Posting Permissions

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