|
|
发表于 2007-6-4 13:40:00
|
显示全部楼层
Re:难道学3D游戏开发就必须学四元数吗?
- Okay, Quaternions was introduced by Hamilton as a noncommutative parallel to the complex numbers.
- What do we mean by noncommutative parallel to the complex number?
- First, let's define the complex numbers.
- Suppose we endow R^2 with a multiplication by:
- (a,b)(c,d) = (ac-bd,bc+ad).
- Under this definition R^2 becomes a field, let's call this field C. This is the complex numbers.
- Notice that, (a,b)*(a/(a^2+b^2),-b/(a^2+b^2)) = e, where e is the identity element, (1,0). That is, nonzero elements of R form an abelian group under multiplication.
- WE denote (0,1) by i, and identity x in R by (x,0), so R is a subset of C.
- Thus, (a,b) = a + ib, a,b in R. i^2 = -1.
- C is generated by adjoining i to R and closing under addition and multiplication.
- Complex division:
- Let z = a+ib, w = c+id
- Then,
- a + ib a+ib (c-id) ac+bd+i(bc-ad)
- ------ = ------------ = ----------------
- c + id c +id (c-id) c^2 + d^2
- Now, let z^bar = a-bi, z^2 = (a + ib)(a-ib) = a^2 + b^2
- z^-1 = z^bar / z^2
- That is, z^1 = (a-bi)/(a^2+b^2)
- --------------------------
- The Euler identity:
- e^it = cos(t) + isin(t),
- Complex polar form:
- z = a + bi = r*e^it
- Now, for quaternions (we shall see that quaternions is very similar to the complex numbers, with the exception that it is noncommuicative.):
- Let F be the field of real numbers and consider the set of
- a0 + a1*i + a2*j + a3*k, where a0,a1,a2,a3 in F.
- Now, suppose we define
- i^2 = j^2 = k^2 = -1
- ij = k, ki = j, ji = -k, kj = -i, ik = -j.
- (a0 + a1*i + a2*j + a3*k)(b0 + b1*i + b2*j + b3*k)
- Multiply like you do using the distributive laws but using the product rules for i,j,k defined above.
- Okay, like C, we can define a multiplicative inverse.
- Suppose q = s + v, where s = a0, v = a1*i + a2*j + a3*k
- q^bar = s - v
- q^2 = q*q^bar = q^bar*q = q*q = q^2
- Notice this is parallel to the complex numbers.
- Now we can define a parallel to z^-1, that is,
- q^-1 = q^bar/q^2.
复制代码
我累了,明天在说吧。。。还要证明!!!
|
|