• Create Account

# Delfi

Member Since 04 Feb 2004
Offline Last Active Oct 12 2012 05:54 PM

### In Topic: sync area partitioning

07 October 2012 - 03:38 PM

Has anyone considered a implementation of this? the graphics look promising:

http://www.sciencedirect.com/science/article/pii/S0305054801000338

### In Topic: sync area partitioning

03 October 2012 - 02:18 PM

I asked for a suggestion on which algorythm to use to partition the world into these zones based on where players are, i understand the concept but not what algorythm is generally used to calculate these zones.

### In Topic: convert left hand rotations to right hand

05 August 2011 - 06:54 PM

Dude, can you decompose that into some kind of pseudocode? i have no idea how to calculate such a reflection matrix..

### In Topic: so, what happened to "favorites"?

30 July 2011 - 03:55 AM

I don't wish to watch "topics", i want to watch forum >sections< that matter to me.

### In Topic: instead of glRotatef build a matrix

23 April 2011 - 03:50 PM

Ok, thanks to everyone, here's the final working version:

```function CreateGlRotateMatrix(angle, x, y, z: single) : TMatrix;
var
axis: TVector3f;
b, c, ac, s: single;
invLen : Single;
begin

invLen:= RSqrt(x * x + y * y + z * z);
x:= x * invLen;
y:= y * invLen;
z:= z * invLen;

result:= IdentityHmgMatrix;

c:= cos(angle);
s:= sin(angle);

result[0,0] := (x*x) * (1-c)+c;
result[1,0] := x*y * (1-c)-z*s;
result[2,0] := x*z * (1-c)+y*s;

result[0,1] := y*x * (1-c)+z*s;
result[1,1] := (y*y) * (1-c)+c;
result[2,1] := y*z * (1-c)-x*s;

result[0,2] := x*z * (1-c)-y*s;
result[1,2] := y*z * (1-c)+x*s;
result[2,2] := (z*z) * (1-c)+c;

end;
```

This finally matches the game's map files to build a proper matrix, it uses this with some "odd" quaternion conversion routine, which i couldn't reproduce with any other quaternion to matrix algorythm on the internet:

```	// preprocess quarternion rotations
X := rx;
Y := ry;
Z := rz;
W := -rw;
S := Sqrt(1.0 - W * W);

// divide by zero
if not (S = 0) then
begin
Axis[0] := X / S;
Axis[1] := Y / S;
Axis[2] := Z / S;
Angle   := 2 * geometry.ArcCos(W);

if not (Angle = 0) then begin

rotang:= CreateGlRotateMatrix( Angle * 180 / Pi, Axis[0], Axis[1], Axis[2]);
glMultMatrixf(@rotang[0,0]);

//glRotatef(Angle * 180 / Pi, Axis[0], Axis[1], Axis[2]);

end;
end;
```

But this only works on game file quaternions. If i use this on the game's quaternions from the memory i get some strange results, i'll post that as another question if i can't figure it out soon :S

PARTNERS