Simulation, Kinematics, Animation
Computer Graphics and Imaging
UC Berkeley CS 184/284A
Discussion 13
Week 12 Announcements
Worksheet
Physical simulation
Physical simulation
Euler’s method
Euler’s method
Euler’s method
Explicit Euler’s Method
position
velocity
acceleration
Newton’s Second Law of Motion
Question 1
Question 1.1
Question 1.1 Answer
Example:
Example:
Not physically possible! (?) (pendulum cannot swing past θ0 = 0.1 rad)
Not physically possible! (?) (pendulum cannot swing past θ0 = 0.1 rad)
Not physically possible! (?) (pendulum cannot swing past θ0 = 0.1 rad)
Hint:
θ
Modifications to Euler’s Method
Modifications to Euler’s Method
Explicit Euler’s method can be unstable, since errors accumulate. Some modifications to explicit Euler’s method include:
Modifications to Euler’s Method
Normal for comparison
Modifications to Euler’s Method
Hooke’s Law
💡 Remember that acceleration is the double derivative! Therefore, acceleration = Force/mass
Question 2
Q2 Multitudes of Euler’s Methods
Q2.1 Multitudes of Euler’s Methods
Q2.1 Multitudes of Euler’s Methods
Q2.1 Multitudes of Euler’s Methods
x1 = x0 + Δtx0 = (0, 1) + (-1, 0) = (-1, 1)
x1 = x0 + Δtx0 = (-1, 0) + (0, 0) = (-1, 0)
x1 = ?
Hint! 💡 F = ma so a = Force/mass
Modeling the Problem with a Spring System
At t=1, we want to solve for position and velocity using Euler’s, and acceleration via the spring equation
34
b
a
Q2.1 Multitudes of Euler’s Methods
Hooke’s Law
Q2.1 Multitudes of Euler’s Methods
Why unneeded? Since we only care about x3 (which doesn’t depend on x2).
Q2.1 Multitudes of Euler’s Methods
Q2.1 Multitudes of Euler’s Methods
Q2.2 Multitudes of Euler’s Methods
Q2.2 Multitudes of Euler’s Methods
Q2.3 Multitudes of Euler’s Methods
Q2.3 Multitudes of Euler’s Methods
Q2.4 Multitudes of Euler’s Methods
Q2.4 Multitudes of Euler’s Methods
Q2.5 Multitudes of Euler’s Methods
Q2.5 Multitudes of Euler’s Methods
47
Q3:
Recall the forward, or explicit Euler method, which uses the following update rules:
where respectively denote the position, velocity, and acceleration at time t.
(a) Give some pros and cons of using the explicit Euler method.
(b) Say we have a particle with mass 1 starting at position with an initial velocity and no initial acceleration. The particle is at one end of a spring, whose other end is the origin (0, 0), and whose spring constant is k = 1 and rest length is 1. Calculate particle’s position at t = 3 using the explicit Euler method with timestep .
48
Q3:
Recall the forward, or explicit Euler method, which uses the following update rules:
where respectively denote the position, velocity, and acceleration at time t.
(a) Give some pros and cons of using the explicit Euler method.
Pros - simple and easy to compute, we don’t always care about precision in graphics (i.e. close enough is good enough).
Cons - inaccurate and unstable, which frequently leads to divergent results, especially as time progresses and errors accumulate.
49
Q3:
Recall the forward, or explicit Euler method, which uses the following update rules:
where respectively denote the position, velocity, and acceleration at time t.
(b) Say we have a particle with mass 1 starting at position with an initial velocity and no initial acceleration. The particle is at one end of a spring, whose other end is the origin (0, 0), and whose spring constant is k = 1 and rest length is 1. Calculate particle’s position at t = 3 using the explicit Euler method with timestep .
50
Recall the forward, or explicit Euler method, which uses the following update rules:
where respectively denote the position, velocity, and acceleration at time t.
(b) Say we have a particle with mass 1 starting at position with an initial velocity and no initial acceleration. The particle is at one end of a spring, whose other end is the origin (0, 0), and whose spring constant is k = 1 and rest length is 1. Calculate particle’s position at t = 3 using the explicit Euler method with timestep .
51
Recall the forward, or explicit Euler method, which uses the following update rules:
where respectively denote the position, velocity, and acceleration at time t.
(b) Say we have a particle with mass 1 starting at position with an initial velocity and no initial acceleration. The particle is at one end of a spring, whose other end is the origin (0, 0), and whose spring constant is k = 1 and rest length is 1. Calculate particle’s position at t = 3 using the explicit Euler method with timestep .
52
Recall the forward, or explicit Euler method, which uses the following update rules:
where respectively denote the position, velocity, and acceleration at time t.
(b) Say we have a particle with mass 1 starting at position with an initial velocity and no initial acceleration. The particle is at one end of a spring, whose other end is the origin (0, 0), and whose spring constant is k = 1 and rest length is 1. Calculate particle’s position at t = 3 using the explicit Euler method with timestep .
53
Recall the forward, or explicit Euler method, which uses the following update rules:
where respectively denote the position, velocity, and acceleration at time t.
(b) Say we have a particle with mass 1 starting at position with an initial velocity and no initial acceleration. The particle is at one end of a spring, whose other end is the origin (0, 0), and whose spring constant is k = 1 and rest length is 1. Calculate particle’s position at t = 3 using the explicit Euler method with timestep .
Animation & Inverse Kinematics
Question 3
= (a, b)
a = x cosθ
b = x sinθ
a
b
Let’s Take Attendance.
71
Q1:
What are keyframes and what do we do with them?
72
Q1:
What are keyframes and what do we do with them?
Important moments in some transition/motion, usually starting and ending points. We interpolate between them (though not linearly, usually too complex) to create frames between the keyframes to form fluid video - known as tweening.
73
Q2.1:
What is the difference between forward and inverse kinematics?
74
Q2.1:
What is the difference between forward and inverse kinematics?
Forward - we provide angles (e.g. for joints), computer determines final position (e.g. of end of limbs).
Inverse - we provide ending position, need to compute the joint angles to reach the position.
75
Q2.2:
What are some problems associated with inverse kinematics?
76
Q2.2:
What are some problems associated with inverse kinematics?
Sometimes has multiple possible solutions (sometimes connected to each other, sometimes separate), sometimes has no solutions, want to make sure solution found is realistic, etc.
https://github.com/cal-cs184/rope_simulation
This is a smaller, toy version of Project 4 to get intuition about simulation