rotation of items, not using matrix

Open discussion forum. For topics that do not fit anywhere else.

Moderator: POL Developer

Post Reply
guialtran
Grandmaster Poster
Posts: 120
Joined: Wed Jul 30, 2008 12:42 pm

rotation of items, not using matrix

Post by guialtran »

this function is very similar to TurnBoat (boat, direction), is made to rotate items that are not in an matrix.

Code: Select all

//DIRection 1=right, 2=flip, 3=left

my_RotatePoint( who, struct{"x":=item.x,"y":=item.y} , 1);

function my_RotatePoint( byref pivo, byref ponto , dir)
    var difx := pivo.x - ponto.x;
    var dify := pivo.y - ponto.y;
    case (dir)
        1: // Right
            ponto.x := pivo.x + dify;
            ponto.y := pivo.y - difx;

        2: // Flip
            ponto.x := pivo.x + difx;
            ponto.y := pivo.y + dify;

        3: // Left
            ponto.x := pivo.x - dify;
            ponto.y := pivo.y + difx;
    endcase
endfunction
there is only the calculation of mathematics.
you can adapt it to receive 1 object or a list.
Last edited by guialtran on Mon Nov 05, 2018 9:15 pm, edited 1 time in total.
guialtran
Grandmaster Poster
Posts: 120
Joined: Wed Jul 30, 2008 12:42 pm

Re: rotation of items, not using matrix

Post by guialtran »

Post Reply