> The value in quaternions is that they are a compact, direct representation
> of a transformation matrix in 3D space, ergo seems ideally suited for 3D
> graphics abstractions.  Technically, I suppose a software layer could do the
> optimization and map it to SIMD coprocessors, but figuring out hardware that
> could apply the same principles might result in even more speedup.  I don't
> know of any algorithms with acceptable speed for quaternion multiplication,
> though, so regardless of whether we use existing hardware or not, it comes
> down to the discovery of such algorithms.

Quaternion multiply is a basic linear algebra op.

In GLSL, it's:
vec4 qmul(vec4 q1, vec4 q2) {
        return vec4(
                q1.w*q2.x + q1.x*q2.w + q1.y*q2.z - q1.z*q2.y,
                q1.w*q2.y - q1.x*q2.z + q1.y*q2.w + q1.z*q2.x,
                q1.w*q2.z + q1.x*q2.y - q1.y*q2.x + q1.z*q2.w,
                q1.w*q2.w - q1.x*q2.x - q1.y*q2.y - q1.z*q2.z
        );
}


The usual OpenGL axis-angle representation is exactly equivalent to quaternions.


> Does Gaigen implement such
> effective algorithms?

Gaigen is an algebra compiler, translating the pure mathematical
constructs into efficient C/C++/JAVA/... code.  It works by defining
the particular algebraic structure (e.g. 2D euclidean metric,  5D
conformal model, etc.) and a list of named objects (point, vector,
plane, trivector, circle, point pair, ...) and the available operators
(geometric product, dual, exponentiation, ...) and derives an
efficient set of computational structures, which in C++ would be the
corresponding classes and operators.  It's quaternion multiplication
will be fast despite existing as a generic GA object because the
translation from abstract structure to code only computes what's
necessary.

_______________________________________________
fonc mailing list
[email protected]
http://vpri.org/mailman/listinfo/fonc

Reply via email to