Forum

Mathlib v2

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

Postby Dr. Shadowborg » Tue May 23, 2006 6:55 pm

Uploaded revised bugfix version.

Also adds damage level tweaks for forte scale blaster and demicannon. See original post for download links.
User avatar
Dr. Shadowborg
InsideQC Staff
 
Posts: 1110
Joined: Sat Oct 16, 2004 3:34 pm

Oh yeah?

Postby Urre » Wed Nov 22, 2006 1:25 am

FrikaC wrote:
Quake Matt wrote:One thing I would like to see is matrix maths, for rotations and other transformations. I'd suggest quaternions, too, but I can't get my head round them!


Now lets not get crazy here.


LH wrote that very kind of code to dpmod a good ol' while back, and should definitely be included in mathlib. What the code does is store orientation using matrices, and rotation using axisangle (aka rodrigues vector among other names). What it's lacking is a matrix->euler conversion function, to actually show off the cool maths going on behind the screen. I've recently been working on expanding the use of this code, and making it available for more general use (it has a very specific use in dpmod, which isn't even finished). I've done tests to prove it works, and plan to use it for some cool physics stuff and whatnot, and would be glad to incorporate it into mathlib.

I need help though, I need an Arc cosine function, which in turn requires both an Arc sine and a Logarithm function, as far as I understand. I also need help with the matrix->euler conversion, as I have no idea what I'm actually doing.
I was once a Quake modder
User avatar
Urre
 
Posts: 1109
Joined: Fri Nov 05, 2004 2:36 am
Location: Moon

Re: Oh yeah?

Postby FrikaC » Wed Nov 22, 2006 5:20 am

Urre wrote:I have no idea what I'm actually doing.


Neither do I.
FrikaC
Site Admin
 
Posts: 1026
Joined: Fri Oct 08, 2004 11:19 pm

Postby Urre » Fri Nov 24, 2006 2:36 am

LH implemented arc cos among others as a builtin to DP, so now I got stuff going on. Does obviously unfortunately not work in regular quake :(

Still hunting for some matrix->euler magic though...

EDIT: found code in dpmod which did this, so the matrix stuff is working now. If anyone cares I can post it here, just make some noise. Otherwise I'll just keep and use it for myself until I have a mod to show it off in. Note that it's DP only, unless you don't care about a function which finds the angle between two vectors. If you can live without that it should work in any quake engine.
I was once a Quake modder
User avatar
Urre
 
Posts: 1109
Joined: Fri Nov 05, 2004 2:36 am
Location: Moon

Postby Preach » Fri Nov 24, 2006 9:11 am

Urre wrote:LH implemented arc cos among others as a builtin to DP, so now I got stuff going on. Does obviously unfortunately not work in regular quake :(

Still hunting for some matrix->euler magic though...

EDIT: found code in dpmod which did this, so the matrix stuff is working now. If anyone cares I can post it here, just make some noise. Otherwise I'll just keep and use it for myself until I have a mod to show it off in. Note that it's DP only, unless you don't care about a function which finds the angle between two vectors. If you can live without that it should work in any quake engine.


Arccos is basically available in quake once you have the sqrt function, and if you have sqrt as a builtin it's only two builtin calls.:

Code: Select all
float arccos(float r) =
{

local vector t;
t_x = r;
t_y = sqrt(1 - r * r);

return vectoyaw(t);
}


I hope I've got the components the right way round in this one, you may have to switch the x and y components about or multiply by -1 on one of the components. Arctan is even easier, as it doesn't need the sqrt function, just set the adjacent compontent of t to 1 and the opposite to r.
Preach
 
Posts: 122
Joined: Thu Nov 25, 2004 7:20 pm

Postby Urre » Fri Nov 24, 2006 12:07 pm

That's cool Preach! If that works it'd work just fine in any quake engine.

Just realised mathlib.qc (with trigonometry) is something that should've been available when qc was popular, to prove the strengths of qc.
I was once a Quake modder
User avatar
Urre
 
Posts: 1109
Joined: Fri Nov 05, 2004 2:36 am
Location: Moon

Postby Wazat » Fri Oct 03, 2008 6:51 am

Does anyone know of a working link to Dr. Shadowborg's mod? I'd like to try it.
When my computer inevitably explodes and kills me, my cat inherits everything I own. He may be the only one capable of continuing my work.
Wazat
 
Posts: 771
Joined: Fri Oct 15, 2004 9:50 pm
Location: Middle 'o the desert, USA

Postby Dr. Shadowborg » Fri Oct 03, 2008 3:48 pm

Wazat wrote:Does anyone know of a working link to Dr. Shadowborg's mod? I'd like to try it.


http://tlb.quakedev.com/files/mlx20b.zip

This is actually an embarassment now. :oops:

Also, you should try this with the IKSPQ series of maps:

http://tlb.quakedev.com/files/drsgv1.zip
User avatar
Dr. Shadowborg
InsideQC Staff
 
Posts: 1110
Joined: Sat Oct 16, 2004 3:34 pm

Previous

Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest