Okay, the rule of this is simple, you can post a reply, but you need to reply with a piece of useful code that you wrote and that everyone can use.
For example, this function rotates a vector around the Z axis, and works on any vector type (be it glscene Tvector or tvector3f or some other vector type..) as long as it consists of 3 sequential 32 bit floats it will work.
Code:
procedure RotateVertexXY(var vector; const angle: single);
var
COORDS: array[0..1] of single absolute vector;
TEMP: array[0..1] of single;
AFUNC: array[0..1] of single;
anglerad: single;
begin
TEMP[0] := COORDS[0];
TEMP[1] := COORDS[1];
anglerad := degtorad(angle);
AFUNC[0] := Cos(anglerad);
AFUNC[1] := Sin(anglerad);
COORDS[0] := TEMP[0] * AFUNC[0] - TEMP[1] * AFUNC[1];
COORDS[1] := TEMP[0] * AFUNC[1] + TEMP[1] * AFUNC[0];
end;
Bookmarks