Bill Currie
6eec76dd49
Implement Fischer's SEB algorithm (for 3d).
...
Now we can get tight (<1e-6 * radius_squared error) bounding spheres. More
importantly (for qfvis, anyway) very quickly: 1.7Mspheres/second for a 5
point cloud on my 2.33GHz Core 2 :)
2013-03-13 17:10:55 +09:00
Bill Currie
b6d4766201
Add a function to find the circumsphere of up to 4 points.
...
It seems to be a little sloppy (an error of a bit less than 1e-4). This
might be why I'm having trouble with my SEB code.
2013-03-13 14:35:30 +09:00
Bill Currie
0cd6d93030
Add a function to get the barycentric coords of a point.
...
It "works" for lines, triangles and tetrahedrons. For lines and triangles,
it gives the barycentric coordinates of the perpendicular projection of the
point onto to features. Only tetrahedrons are guaranteed to reproduce the
original point.
2013-03-12 14:16:42 +09:00
Bill Currie
6f484ee757
Add support and tests for 3x3 matrices.
2012-08-18 16:29:57 +09:00
Bill Currie
b5add680f7
Add Mat4as3MultVec.
...
to transform a vertex without the translation (eg, for normals) without
having to have separate matrices.
2012-05-20 15:20:18 +09:00
Bill Currie
4ba69b511b
Make quat_origin the right type.
...
It's quat_t, not vec3_t :P.
2012-05-15 21:08:46 +09:00
Bill Currie
9f253454e4
Implement and test Mat4Inverse().
2012-05-15 21:08:44 +09:00
Bill Currie
fa6270322f
Make Mat4Decompose a little more intuitive.
...
Params are now in application order (good thing not much code uses it yet).
2012-05-15 21:08:44 +09:00
Bill Currie
de131c18ad
Add VectorShear and really test Mat4Decompose.
...
And the tests really exercised VectorShear (first attempt had things
messed up when more than one shear value was non-zero). Also,
Mat4Decompose wasn't orthogonalizing the z axis row. Oops. Anyway,
Mat4Decompose is now known to work well, and the usage of its output is
understood :)
2012-05-15 21:08:44 +09:00
Bill Currie
8cea6b0a1e
Fix a scaling snafu in Mat4Decompose.
...
Found when checking how rotation affects non-uniform scaling (haven't
written proper tests yet: need to figure out how).
2012-05-15 21:08:44 +09:00
Bill Currie
82abd5e426
More matrix tests.
2012-05-15 21:08:44 +09:00
Bill Currie
730f9668bd
Add support for mat4 * vec3
2012-05-15 21:08:44 +09:00
Bill Currie
50af8a562e
Add tests for matrix decomposition and fix the bugs.
2012-05-15 21:08:44 +09:00
Bill Currie
215d2e9747
Add a function to decompose a matrix.
...
The function gives rotation(quaternion), scale, shear, and translation (all
three as vectors), shear is (XY, XZ, YZ).
2012-05-15 21:08:44 +09:00
Bill Currie
8791b35e55
Add support for half floats.
...
iqm and OpenGL use them, so they might come in handy. The tests use values
from wikipedia and a couple extra.
2012-04-26 20:55:11 +09:00
Bill Currie
efaef89c5f
Add a shortcut function for quaterion/vector multiplication.
...
I got the idea from blender when I discovered by accident that quat * vect
produces the same result as quat * qvect * quat* and looked up the code to
check what was going on. While matrix/vector multiplication still beats the
pants off quaternion/vector multiplication, QuatMultVec is a slight
optimization over quat * qvect * quat* (17+,24* vs 24+,32*, plus no need to
to generate quat*).
2012-04-26 09:48:08 +09:00
Bill Currie
bc1b483525
Nuke the rcsid stuff.
...
It's pretty useless in git.
2012-04-22 10:56:32 +09:00
Bill Currie
cbd13ac54e
Implement QuatExp and fix up QuatBlend's param names.
2012-01-12 21:22:06 +09:00
Bill Currie
ea2ae1436c
Fix some bugs in the new matrix functions/macros.
2011-12-31 13:20:31 +09:00
Bill Currie
35bf957d08
Add a 4x4 matrix type and some functions for it.
2011-12-30 20:11:53 +09:00
Bill Currie
91e65b6c80
Rename mplane_t to plane_t and clean up the mess.
...
I got rather tired of there being multiple definitions of mostly compatible
plane types (and I need a common type anyway). dplane_t still exists for
now because I want to be careful when messing with the actual bsp format.
2011-11-28 20:54:34 +09:00
Bill Currie
12e238f806
Add a function to convert quake angles to a quaternion.
...
The test works by comparing the result of AngleVectors with forward,
right, and up vectors rotated by the quaternion resulting from AngleQuat.
2011-09-04 09:58:12 +09:00
Bill Currie
fe3cdbcf5a
fix a snafu in quattomat
2011-09-04 09:58:12 +09:00
Bill Currie
eb205d73fd
Add a function to convert a quaternion to a rotation matrix.
2011-09-04 09:58:12 +09:00
Bill Currie
33db650161
Add QuatInverse to calculate 1/q.
...
There's still no direct quaternion division because I don't know if the
definition of q1/q2 is (1/q2)*q1 or q1*(1/q2) (it does make a difference).
2011-01-18 22:22:18 +09:00
Bill Currie
13503198e5
Add quat_origin convenience constant.
...
Same as vec3_origin in that all elements are zero.
2011-01-11 08:41:40 +09:00
Bill Currie
99c0954b47
the big dso visibility patch :). Sure, we have to have unique names for static builds, but with controlled visibitly we should get faster program loads (although this isn't C++, so it's not as bad) and complex plugins are cleaner.
2007-03-10 12:00:59 +00:00
Bill Currie
3fb03fc2be
hah, should have been using __attribute__((used)) all that time (rather
...
than __attribute__((unused))). fixes the missing console in -x11
2005-08-04 15:27:09 +00:00
Bill Currie
4c4f40f137
fix a few bugs. basics seem to be working
2004-04-08 05:13:24 +00:00
Bill Currie
39685d0c63
more readability and add the quaternion functions
2004-04-07 18:01:45 +00:00
Bill Currie
19ef80c555
this should fix static win32 builds
2004-01-21 00:15:35 +00:00
Bill Currie
7ead5a91f8
don't let gcc automaticly inline functions but make gcc inline bigger
...
functions when told to. also make gcc warn if it can't inline a function.
Explicitly inline several functions (including moving VectorNormalize to
mathlib.h so it /can/ be) resulting in a 5.5% speedup for spam2 (88 to 92
fps)
2003-08-11 06:05:07 +00:00
Bill Currie
6a94607d9d
rename VectorMA to VectorMultAdd, add VectorMultSub and use it in a few
...
places. Not certain how much speed difference it makes :/
2003-08-08 15:25:53 +00:00
Ragnvald Maartmann-Moe IV
bf18436ad5
Whitespace.
2003-03-21 00:51:57 +00:00
Bill Currie
72d1343735
add some comments about the coordinate systems used in AngleVectors
2003-03-10 20:44:50 +00:00
Bill Currie
761a7546dd
re-arrange things so __attribute__ and __builtin_expect are properly
...
autoconfiscated so rcsid will continue to work with gcc 3.3
2003-01-15 15:31:36 +00:00
Bill Currie
71196fedf6
make gcc more anal about prototypes, string constants and function
...
visibility (ie, global functions must have a prototype)
2003-01-06 18:28:13 +00:00
Bill Currie
d25ee82838
provide a tighter accuracy (but slower) _VectorNormalize for the tools
2002-09-25 21:35:49 +00:00
Bill Currie
56843557f6
make _VectorCompare use EQUAL_EPSILON (VectorCompare is still the fast
...
macro) and use it instead of VectorCompare in the map tools. This (and, it
seems, RINT) fixes qfbsp on spc. Also, jump /all/ entities that get hit
by the filler in qfbsp
2002-09-20 17:02:53 +00:00
Ragnvald Maartmann-Moe IV
d757c10f07
Only need one define for R_Cull*
2002-08-23 20:46:19 +00:00
Ragnvald Maartmann-Moe IV
6e8bd2aeb0
defines and ifdefs for R_CullSphere, just like R_CullBox.
2002-08-23 07:04:29 +00:00
Ragnvald Maartmann-Moe IV
c91f1a2aea
Rename Length to VectorLength.
2002-08-20 02:22:40 +00:00
Ragnvald Maartmann-Moe IV
fd1ded5c4a
Add r_nearclip and r_particles_nearclip. Also put some limits on r_farclip. And fix id's insane max and min float, and some minor improvements in frustum setup in GL.
2002-06-26 22:20:12 +00:00
Bill Currie
44dcf74627
strip the \n from all(?) of the Sys_Error calls (Sys_Error itself will be
...
adding \n).
2002-05-14 06:12:29 +00:00
Bill Currie
630aa80dc4
various cleanups including TODOs and FIXMEs and rewrite va to use a dynamic
...
buffer.
2002-01-12 04:34:53 +00:00
Bill Currie
36bb62c3c5
rewrite CrossProduct so memory is accessed more linearly. should provide
...
a tiny speedup for servers and clipped skyboxes
2002-01-04 06:13:50 +00:00
Bill Currie
013f503738
start getting const-correct on vec3_t params
2002-01-03 05:29:38 +00:00
Bill Currie
21686adf10
remove redundant prototype
2001-12-03 23:40:07 +00:00
Ragnvald Maartmann-Moe IV
7ea1051b9a
Code cleanups.
2001-10-30 19:55:34 +00:00
Bill Currie
b1f4a778f9
the rcsid commit from hell }:>
2001-09-28 06:26:31 +00:00