P11
补充1:Integration Methods Explained
Explicit Euler
By definition, the integral x(t)=∫v(t)dt is the area. Many methods estimate the area as a box.
✅ 假设x和v都是一维的。速度的积分就是阴影区域的面积。
✅ 近似到一阶项,因此称为一阶方法。漏掉的高阶项就是误差。
P12
Implicit Euler
✅ 使用 t0 时刻的速度:显式积分
使用 t1 时刻的速度:隐式积分
两种方法都只能一阶近似
P13
Mid-Point
P14
比较与混合
By definition, the integral x(t)=∫v(t)dt is the area. Many methods estimate the area as a box.
Explicit Euler (1st-order accurate) sets the height at t[0]. ∫t[1]t[0]v(t)dt≈∆tv(t[0]) |
---|
Implicit Euler (1st-order accurate) sets the height at t[0]. ∫t[1]t[0]v(t)dt≈∆tv(t[1]) |
---|
Mid-point (2nd-order accurate) sets the height at t[0]. ∫t[1]t[0]v(t)dt≈∆tv(t[0.5]) |
---|
P15
{v(t[1])=v(t[0])+M−1∫t[1]t[0]f(x(t),v(t),t)dtx(t[1])=x(t[0])+∫t[1]t[0]v(t)dt
✅ 在当前应用场景中,使用前面方法的混合
P16
Leapfrog Integration
✅ 速度和位置是错开的。上下两种写法,在计算上是一样的。
In some literature, such a approach is called semi-implicit.
It has a funnier name: the leapfrog method.
P20
补充2:Rotation Representation
Rotation Represented by Matrix
-
The matrix representation is widely used for rotational motion.
-
It’s friendly for applying rotation to each vertex (by matrix-vector multiplication).
-
But it is not suitable for dynamics:
- It has too much redundancy: 9 elements but only 3 DoFs.
- It is non-intuitive.
- Defining its time derivative (rotational velocity) is also difficult.
P21
Rotation Represented by Euler Angles
-
The Euler Angles representation is also popular, often in design and control.
-
It is intuitive. It uses three axial rotations to represent one general rotation. Each axial rotation uses an angle.
-
In Unity, the order is rotation-by-Z, rotation-by-X, then rotation-by-Y.
-
But it is not suitable for dynamics either:
- It can lose DoFs in certain statuses: gimbal lock.
- Defining its time derivative (rotational velocity) is difficult.
P22
Gimbal Lock
The alignment of two or more axes results in a loss of rotational DoFs.
✅ 在某些特定的情况下,自由度降低了
P23
Rotation Represented by Quaternion
Introduction
In the complex system, two numbers represent a 2D point.
What about a “complex” system for 3D point? Quaternion! Four numbers represent a 3D point (with multiplication and division).
P24
Quaternion Arithematic
Let q=[sv] be a quaternion made of two parts: a scalar part s and a 3D vector part v, accounting for ijk.
✅ 在有些库里面写作: q=[wxyz],w为实数部分
aq=[asav] Scalar-quaternion Multiplication
q1±q2=[s1±s2v1±v2] Addition/Subtraction
q1×q2=[s1s2−v1⋅v2s1v2+s2v1+v1×v2] Multiplication
||q||=√s2+v⋅vMagnitude
P25
Rotation Represented by Quaternion
-
To represent a rotation around v by angle 0, we set the quaternion as:
-
lt's very intuitive. lt's the built-in representation in Unity.
-
Convertible to the matrix:
R=[s2+x2−y2−z22(xy−sz)2(xz+sy)2(xy+sz)s2−x2+y2−z22(yz−sx)2(xz−sy)2(yz+sx)s2−x2−y2+z2]
本文出自CaterpillarStudyGroup,转载请注明出处。
https://caterpillarstudygroup.github.io/GAMES103_mdbook/