-
Notifications
You must be signed in to change notification settings - Fork 1
/
lec10.1-ground_to_slope.html
306 lines (261 loc) · 41 KB
/
lec10.1-ground_to_slope.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
<!DOCTYPE HTML>
<html lang="en" class="light" dir="ltr">
<head>
<!-- Book generated using mdBook -->
<meta charset="UTF-8">
<title>From Ground To Slope - Physics-Based Simulation</title>
<!-- Custom HTML head -->
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="theme-color" content="#ffffff">
<link rel="icon" href="favicon.svg">
<link rel="shortcut icon" href="favicon.png">
<link rel="stylesheet" href="css/variables.css">
<link rel="stylesheet" href="css/general.css">
<link rel="stylesheet" href="css/chrome.css">
<link rel="stylesheet" href="css/print.css" media="print">
<!-- Fonts -->
<link rel="stylesheet" href="FontAwesome/css/font-awesome.css">
<link rel="stylesheet" href="fonts/fonts.css">
<!-- Highlight.js Stylesheets -->
<link rel="stylesheet" href="highlight.css">
<link rel="stylesheet" href="tomorrow-night.css">
<link rel="stylesheet" href="ayu-highlight.css">
<!-- Custom theme stylesheets -->
<!-- MathJax -->
<script async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
</head>
<body class="sidebar-visible no-js">
<div id="body-container">
<!-- Provide site root to javascript -->
<script>
var path_to_root = "";
var default_theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "navy" : "light";
</script>
<!-- Work around some values being stored in localStorage wrapped in quotes -->
<script>
try {
var theme = localStorage.getItem('mdbook-theme');
var sidebar = localStorage.getItem('mdbook-sidebar');
if (theme.startsWith('"') && theme.endsWith('"')) {
localStorage.setItem('mdbook-theme', theme.slice(1, theme.length - 1));
}
if (sidebar.startsWith('"') && sidebar.endsWith('"')) {
localStorage.setItem('mdbook-sidebar', sidebar.slice(1, sidebar.length - 1));
}
} catch (e) { }
</script>
<!-- Set the theme before any content is loaded, prevents flash -->
<script>
var theme;
try { theme = localStorage.getItem('mdbook-theme'); } catch(e) { }
if (theme === null || theme === undefined) { theme = default_theme; }
var html = document.querySelector('html');
html.classList.remove('light')
html.classList.add(theme);
var body = document.querySelector('body');
body.classList.remove('no-js')
body.classList.add('js');
</script>
<input type="checkbox" id="sidebar-toggle-anchor" class="hidden">
<!-- Hide / unhide sidebar before it is displayed -->
<script>
var body = document.querySelector('body');
var sidebar = null;
var sidebar_toggle = document.getElementById("sidebar-toggle-anchor");
if (document.body.clientWidth >= 1080) {
try { sidebar = localStorage.getItem('mdbook-sidebar'); } catch(e) { }
sidebar = sidebar || 'visible';
} else {
sidebar = 'hidden';
}
sidebar_toggle.checked = sidebar === 'visible';
body.classList.remove('sidebar-visible');
body.classList.add("sidebar-" + sidebar);
</script>
<nav id="sidebar" class="sidebar" aria-label="Table of contents">
<div class="sidebar-scrollbox">
<ol class="chapter"><li class="chapter-item expanded affix "><a href="preface.html">Preface</a></li><li class="chapter-item expanded affix "><li class="part-title">Simulation with Optimization</li><li class="chapter-item expanded "><a href="lec1-discrete_space_time.html"><strong aria-hidden="true">1.</strong> Discrete Space and Time</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="lec1.1-solid_rep.html"><strong aria-hidden="true">1.1.</strong> Representations of a Solid Geometry</a></li><li class="chapter-item expanded "><a href="lec1.2-newton_2nd_law.html"><strong aria-hidden="true">1.2.</strong> Newton's Second Law</a></li><li class="chapter-item expanded "><a href="lec1.3-time_integration.html"><strong aria-hidden="true">1.3.</strong> Time Integration</a></li><li class="chapter-item expanded "><a href="lec1.4-explicit_time_integration.html"><strong aria-hidden="true">1.4.</strong> Explicit Time Integration</a></li><li class="chapter-item expanded "><a href="lec1.5-implicit_time_integration.html"><strong aria-hidden="true">1.5.</strong> Implicit Time integration</a></li><li class="chapter-item expanded "><a href="lec1.6-summary.html"><strong aria-hidden="true">1.6.</strong> Summary</a></li></ol></li><li class="chapter-item expanded "><a href="lec2-opt_framework.html"><strong aria-hidden="true">2.</strong> Optimization Framework</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="lec2.1-opt_time_integration.html"><strong aria-hidden="true">2.1.</strong> Optimization Time Integrator</a></li><li class="chapter-item expanded "><a href="lec2.2-dirichlet_BC.html"><strong aria-hidden="true">2.2.</strong> Dirichlet Boundary Conditions</a></li><li class="chapter-item expanded "><a href="lec2.3-contact.html"><strong aria-hidden="true">2.3.</strong> Contact</a></li><li class="chapter-item expanded "><a href="lec2.4-friction.html"><strong aria-hidden="true">2.4.</strong> Friction</a></li><li class="chapter-item expanded "><a href="lec2.5-summary.html"><strong aria-hidden="true">2.5.</strong> Summary</a></li></ol></li><li class="chapter-item expanded "><a href="lec3-projected_Newton.html"><strong aria-hidden="true">3.</strong> Projected Newton</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="lec3.1-conv_issue_Newton.html"><strong aria-hidden="true">3.1.</strong> Convergence of Newton's Method</a></li><li class="chapter-item expanded "><a href="lec3.2-line_search.html"><strong aria-hidden="true">3.2.</strong> Line Search</a></li><li class="chapter-item expanded "><a href="lec3.3-grad_based_opt.html"><strong aria-hidden="true">3.3.</strong> Gradient-Based Optimization</a></li><li class="chapter-item expanded "><a href="lec3.4-summary.html"><strong aria-hidden="true">3.4.</strong> Summary</a></li></ol></li><li class="chapter-item expanded "><a href="lec4-2d_mass_spring.html"><strong aria-hidden="true">4.</strong> Case Study: 2D Mass-Spring*</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="lec4.1-discretizations.html"><strong aria-hidden="true">4.1.</strong> Spatial and Temporal Discretizations</a></li><li class="chapter-item expanded "><a href="lec4.2-inertia.html"><strong aria-hidden="true">4.2.</strong> Inertia Term</a></li><li class="chapter-item expanded "><a href="lec4.3-mass_spring_energy.html"><strong aria-hidden="true">4.3.</strong> Mass-Spring Potential Energy</a></li><li class="chapter-item expanded "><a href="lec4.4-opt_time_integrator.html"><strong aria-hidden="true">4.4.</strong> Optimization Time Integrator</a></li><li class="chapter-item expanded "><a href="lec4.5-sim_with_vis.html"><strong aria-hidden="true">4.5.</strong> Simulation with Visualization</a></li><li class="chapter-item expanded "><a href="lec4.6-gpu_accel.html"><strong aria-hidden="true">4.6.</strong> GPU-Accelerated Simulation</a></li><li class="chapter-item expanded "><a href="lec4.6-summary.html"><strong aria-hidden="true">4.7.</strong> Summary</a></li></ol></li><li class="chapter-item expanded "><li class="part-title">Boundary Treatments</li><li class="chapter-item expanded "><a href="lec5-dirichlet_BC_solve.html"><strong aria-hidden="true">5.</strong> Dirichlet Boundary Conditions*</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="lec5.1-equality_constraints.html"><strong aria-hidden="true">5.1.</strong> Equality Constraint Formulation</a></li><li class="chapter-item expanded "><a href="lec5.2-DOF_elimin.html"><strong aria-hidden="true">5.2.</strong> DOF Elimination Method</a></li><li class="chapter-item expanded "><a href="lec5.3-hanging_square.html"><strong aria-hidden="true">5.3.</strong> Case Study: Hanging Sqaure*</a></li><li class="chapter-item expanded "><a href="lec5.4-summary.html"><strong aria-hidden="true">5.4.</strong> Summary</a></li></ol></li><li class="chapter-item expanded "><a href="lec6-slip_DBC.html"><strong aria-hidden="true">6.</strong> Slip Dirichlet Boundary Conditions</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="lec6.1-axis_aligned.html"><strong aria-hidden="true">6.1.</strong> Axis-Aligned Slip DBC</a></li><li class="chapter-item expanded "><a href="lec6.2-change_of_vars.html"><strong aria-hidden="true">6.2.</strong> Change of Variables</a></li><li class="chapter-item expanded "><a href="lec6.3-general_slip_DBC.html"><strong aria-hidden="true">6.3.</strong> General Slip DBC</a></li><li class="chapter-item expanded "><a href="lec6.4-summary.html"><strong aria-hidden="true">6.4.</strong> Summary</a></li></ol></li><li class="chapter-item expanded "><a href="lec7-dist_barrier.html"><strong aria-hidden="true">7.</strong> Distance Barrier for Nonpenetration</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="lec7.1-signed_dists.html"><strong aria-hidden="true">7.1.</strong> Signed Distances</a></li><li class="chapter-item expanded "><a href="lec7.2-dist_barrier_formulation.html"><strong aria-hidden="true">7.2.</strong> Distance Barrier</a></li><li class="chapter-item expanded "><a href="lec7.3-sol_accuracy.html"><strong aria-hidden="true">7.3.</strong> Solution Accuracy</a></li><li class="chapter-item expanded "><a href="lec7.4-summary.html"><strong aria-hidden="true">7.4.</strong> Summary</a></li></ol></li><li class="chapter-item expanded "><a href="lec8-filter_line_search.html"><strong aria-hidden="true">8.</strong> Filter Line Search*</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="lec8.1-tunneling.html"><strong aria-hidden="true">8.1.</strong> Tunneling Issue</a></li><li class="chapter-item expanded "><a href="lec8.2-nonpenetration_traj.html"><strong aria-hidden="true">8.2.</strong> Penetration-free Trajectory</a></li><li class="chapter-item expanded "><a href="lec8.3-square_drop.html"><strong aria-hidden="true">8.3.</strong> Case Study: Square Drop*</a></li><li class="chapter-item expanded "><a href="lec8.4-summary.html"><strong aria-hidden="true">8.4.</strong> Summary</a></li></ol></li><li class="chapter-item expanded "><a href="lec9-friction.html"><strong aria-hidden="true">9.</strong> Frictional Contact</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="lec9.1-smooth_fric.html"><strong aria-hidden="true">9.1.</strong> Smooth Dynamic-Static Transition</a></li><li class="chapter-item expanded "><a href="lec9.2-semi_imp_fric.html"><strong aria-hidden="true">9.2.</strong> Semi-Implicit Discretization</a></li><li class="chapter-item expanded "><a href="lec9.3-fixed_point_iter.html"><strong aria-hidden="true">9.3.</strong> Fixed-Point Iteration</a></li><li class="chapter-item expanded "><a href="lec9.4-summary.html"><strong aria-hidden="true">9.4.</strong> Summary</a></li></ol></li><li class="chapter-item expanded "><a href="lec10-square_on_slope.html"><strong aria-hidden="true">10.</strong> Case Study: Square On Slope*</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="lec10.1-ground_to_slope.html" class="active"><strong aria-hidden="true">10.1.</strong> From Ground To Slope</a></li><li class="chapter-item expanded "><a href="lec10.2-slope_fric.html"><strong aria-hidden="true">10.2.</strong> Slope Friction</a></li><li class="chapter-item expanded "><a href="lec10.3-summary.html"><strong aria-hidden="true">10.3.</strong> Summary</a></li></ol></li><li class="chapter-item expanded "><a href="lec11-mov_DBC.html"><strong aria-hidden="true">11.</strong> Moving Boundary Conditions*</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="lec11.1-penalty_method.html"><strong aria-hidden="true">11.1.</strong> Penalty Method</a></li><li class="chapter-item expanded "><a href="lec11.2-compress_square.html"><strong aria-hidden="true">11.2.</strong> Case Study: Compressing Square*</a></li><li class="chapter-item expanded "><a href="lec11.3-summary.html"><strong aria-hidden="true">11.3.</strong> Summary</a></li></ol></li><li class="chapter-item expanded "><li class="part-title">Hyperelasticity</li><li class="chapter-item expanded "><a href="lec12-kinematics.html"><strong aria-hidden="true">12.</strong> Kinematics Theory</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="lec12.1-continuum_motion.html"><strong aria-hidden="true">12.1.</strong> Continuum Motion</a></li><li class="chapter-item expanded "><a href="lec12.2-deformation.html"><strong aria-hidden="true">12.2.</strong> Deformation</a></li><li class="chapter-item expanded "><a href="lec12.3-summary.html"><strong aria-hidden="true">12.3.</strong> Summary</a></li></ol></li><li class="chapter-item expanded "><a href="lec13-strain_energy.html"><strong aria-hidden="true">13.</strong> Strain Energy</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="lec13.1-rigid_null_rot_inv.html"><strong aria-hidden="true">13.1.</strong> Rigid Null Space and Rotation Invariance</a></li><li class="chapter-item expanded "><a href="lec13.2-polar_svd.html"><strong aria-hidden="true">13.2.</strong> Polar Singular Value Decomposition</a></li><li class="chapter-item expanded "><a href="lec13.3-simp_model_inversion.html"><strong aria-hidden="true">13.3.</strong> Simplified Models and Invertibility</a></li><li class="chapter-item expanded "><a href="lec13.4-summary.html"><strong aria-hidden="true">13.4.</strong> Summary</a></li></ol></li><li class="chapter-item expanded "><a href="lec14-stress_and_derivatives.html"><strong aria-hidden="true">14.</strong> Stress and Its Derivatives</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="lec14.1-stress.html"><strong aria-hidden="true">14.1.</strong> Stress</a></li><li class="chapter-item expanded "><a href="lec14.2-compute_P.html"><strong aria-hidden="true">14.2.</strong> Computing Stress</a></li><li class="chapter-item expanded "><a href="lec14.3-compute_stress_deriv.html"><strong aria-hidden="true">14.3.</strong> Computing Stress Derivatives</a></li><li class="chapter-item expanded "><a href="lec14.4-summary.html"><strong aria-hidden="true">14.4.</strong> Summary</a></li></ol></li><li class="chapter-item expanded "><a href="lec15-inv_free_elasticity.html"><strong aria-hidden="true">15.</strong> Case Study: Inversion-free Elasticity*</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="lec15.1-linear_tri_elem.html"><strong aria-hidden="true">15.1.</strong> Linear Triangle Elements</a></li><li class="chapter-item expanded "><a href="lec15.2-energy_grad_hess.html"><strong aria-hidden="true">15.2.</strong> Computing Energy, Gradient, and Hessian</a></li><li class="chapter-item expanded "><a href="lec15.3-filter_line_search.html"><strong aria-hidden="true">15.3.</strong> Filter Line Search for Non-Inversion</a></li><li class="chapter-item expanded "><a href="lec15.4-summary.html"><strong aria-hidden="true">15.4.</strong> Summary</a></li></ol></li><li class="chapter-item expanded "><li class="part-title">Governing Equations</li><li class="chapter-item expanded "><a href="lec16-strong_and_weak_forms.html"><strong aria-hidden="true">16.</strong> Strong and Weak Forms</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="lec16.1-mass_conserv.html"><strong aria-hidden="true">16.1.</strong> Conservation of Mass</a></li><li class="chapter-item expanded "><a href="lec16.2-momentum_conserv.html"><strong aria-hidden="true">16.2.</strong> Conservation of Momentum</a></li><li class="chapter-item expanded "><a href="lec16.3-weak_form.html"><strong aria-hidden="true">16.3.</strong> Weak Form</a></li><li class="chapter-item expanded "><a href="lec16.4-summary.html"><strong aria-hidden="true">16.4.</strong> Summary</a></li></ol></li><li class="chapter-item expanded "><a href="lec17-disc_weak_form.html"><strong aria-hidden="true">17.</strong> Discretization of Weak Forms</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="lec17.1-discrete_space.html"><strong aria-hidden="true">17.1.</strong> Discrete Space</a></li><li class="chapter-item expanded "><a href="lec17.2-discrete_time.html"><strong aria-hidden="true">17.2.</strong> Discrete Time</a></li><li class="chapter-item expanded "><a href="lec17.3-summary.html"><strong aria-hidden="true">17.3.</strong> Summary</a></li></ol></li><li class="chapter-item expanded "><a href="lec18-BC_and_fric.html"><strong aria-hidden="true">18.</strong> Boundary Conditions and Frictional Contact</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="lec18.1-incorporate_BC.html"><strong aria-hidden="true">18.1.</strong> Incorporating Boundary Conditions</a></li><li class="chapter-item expanded "><a href="lec18.2-normal_contact.html"><strong aria-hidden="true">18.2.</strong> Normal Contact for Nonpenetration</a></li><li class="chapter-item expanded "><a href="lec18.3-barrier_potential.html"><strong aria-hidden="true">18.3.</strong> Barrier Potential</a></li><li class="chapter-item expanded "><a href="lec18.4-friction_force.html"><strong aria-hidden="true">18.4.</strong> Friction Force</a></li><li class="chapter-item expanded "><a href="lec18.5-summary.html"><strong aria-hidden="true">18.5.</strong> Summary</a></li></ol></li><li class="chapter-item expanded "><li class="part-title">Finite Element Method</li><li class="chapter-item expanded "><a href="lec19-linear_FEM.html"><strong aria-hidden="true">19.</strong> Linear Finite Elements</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="lec19.1-linear_disp_field.html"><strong aria-hidden="true">19.1.</strong> Piecewise Linear Displacement Field</a></li><li class="chapter-item expanded "><a href="lec19.2-mass_matrix.html"><strong aria-hidden="true">19.2.</strong> Mass Matrix and Lumping</a></li><li class="chapter-item expanded "><a href="lec19.3-elasticity_term.html"><strong aria-hidden="true">19.3.</strong> Elasticity Term</a></li><li class="chapter-item expanded "><a href="lec19.4-summary.html"><strong aria-hidden="true">19.4.</strong> Summary</a></li></ol></li><li class="chapter-item expanded "><a href="lec20-pw_linear_boundary.html"><strong aria-hidden="true">20.</strong> Piecewise Linear Boundaries</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="lec20.1-boundary_conditions.html"><strong aria-hidden="true">20.1.</strong> Boundary Conditions</a></li><li class="chapter-item expanded "><a href="lec20.2-obstacle_contact.html"><strong aria-hidden="true">20.2.</strong> Solid-Obstacle Contact</a></li><li class="chapter-item expanded "><a href="lec20.3-self_contact.html"><strong aria-hidden="true">20.3.</strong> Self-Contact</a></li><li class="chapter-item expanded "><a href="lec20.4-summary.html"><strong aria-hidden="true">20.4.</strong> Summary</a></li></ol></li><li class="chapter-item expanded "><a href="lec21-2d_self_contact.html"><strong aria-hidden="true">21.</strong> Case Study: 2D Self-Contact*</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="lec21.1-scene_setup.html"><strong aria-hidden="true">21.1.</strong> Scene Setup and Boundary Element Collection</a></li><li class="chapter-item expanded "><a href="lec21.2-point_edge_dist.html"><strong aria-hidden="true">21.2.</strong> Point-Edge Distance</a></li><li class="chapter-item expanded "><a href="lec21.3-barrier_and_derivatives.html"><strong aria-hidden="true">21.3.</strong> Barrier Energy and Its Derivatives</a></li><li class="chapter-item expanded "><a href="lec21.4-ccd.html"><strong aria-hidden="true">21.4.</strong> Continuous Collision Detection</a></li><li class="chapter-item expanded "><a href="lec21.5-summary.html"><strong aria-hidden="true">21.5.</strong> Summary</a></li></ol></li><li class="chapter-item expanded "><a href="lec22-2d_self_fric.html"><strong aria-hidden="true">22.</strong> 2D Frictional Self-Contact*</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="lec22.1-disc_and_approx.html"><strong aria-hidden="true">22.1.</strong> Discretization and Approximation</a></li><li class="chapter-item expanded "><a href="lec22.2-precompute.html"><strong aria-hidden="true">22.2.</strong> Precomputing Normal and Tangent Information</a></li><li class="chapter-item expanded "><a href="lec22.3-fric_and_derivatives.html"><strong aria-hidden="true">22.3.</strong> Friction Energy and Its Derivatives</a></li><li class="chapter-item expanded "><a href="lec22.4-summary.html"><strong aria-hidden="true">22.4.</strong> Summary</a></li></ol></li><li class="chapter-item expanded "><a href="lec23-3d_elastodynamics.html"><strong aria-hidden="true">23.</strong> 3D Elastodynamics</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="lec23.1-kinematics.html"><strong aria-hidden="true">23.1.</strong> Kinematics</a></li><li class="chapter-item expanded "><a href="lec23.2-mass_matrix.html"><strong aria-hidden="true">23.2.</strong> Mass Matrix</a></li><li class="chapter-item expanded "><a href="lec23.3-elasticity.html"><strong aria-hidden="true">23.3.</strong> Elasticity</a></li><li class="chapter-item expanded "><a href="lec23.4-summary.html"><strong aria-hidden="true">23.4.</strong> Summary</a></li></ol></li><li class="chapter-item expanded "><a href="lec24-3d_fric_self_contact.html"><strong aria-hidden="true">24.</strong> 3D Frictional Self-Contact</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="lec24.1-barrier_and_dist.html"><strong aria-hidden="true">24.1.</strong> Barrier and Distances</a></li><li class="chapter-item expanded "><a href="lec24.2-collision_detection.html"><strong aria-hidden="true">24.2.</strong> Collision Detection</a></li><li class="chapter-item expanded "><a href="lec24.3-friction.html"><strong aria-hidden="true">24.3.</strong> Friction</a></li><li class="chapter-item expanded "><a href="lec24.4-summary.html"><strong aria-hidden="true">24.4.</strong> Summary</a></li></ol></li><li class="chapter-item expanded "><a href="bibliography.html">Bibliography</a></li></ol>
</div>
<div id="sidebar-resize-handle" class="sidebar-resize-handle">
<div class="sidebar-resize-indicator"></div>
</div>
</nav>
<!-- Track and set sidebar scroll position -->
<script>
var sidebarScrollbox = document.querySelector('#sidebar .sidebar-scrollbox');
sidebarScrollbox.addEventListener('click', function(e) {
if (e.target.tagName === 'A') {
sessionStorage.setItem('sidebar-scroll', sidebarScrollbox.scrollTop);
}
}, { passive: true });
var sidebarScrollTop = sessionStorage.getItem('sidebar-scroll');
sessionStorage.removeItem('sidebar-scroll');
if (sidebarScrollTop) {
// preserve sidebar scroll position when navigating via links within sidebar
sidebarScrollbox.scrollTop = sidebarScrollTop;
} else {
// scroll sidebar to current active section when navigating via "next/previous chapter" buttons
var activeSection = document.querySelector('#sidebar .active');
if (activeSection) {
activeSection.scrollIntoView({ block: 'center' });
}
}
</script>
<div id="page-wrapper" class="page-wrapper">
<div class="page">
<div id="menu-bar-hover-placeholder"></div>
<div id="menu-bar" class="menu-bar sticky">
<div class="left-buttons">
<label id="sidebar-toggle" class="icon-button" for="sidebar-toggle-anchor" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="sidebar">
<i class="fa fa-bars"></i>
</label>
<button id="theme-toggle" class="icon-button" type="button" title="Change theme" aria-label="Change theme" aria-haspopup="true" aria-expanded="false" aria-controls="theme-list">
<i class="fa fa-paint-brush"></i>
</button>
<ul id="theme-list" class="theme-popup" aria-label="Themes" role="menu">
<li role="none"><button role="menuitem" class="theme" id="light">Light</button></li>
<li role="none"><button role="menuitem" class="theme" id="rust">Rust</button></li>
<li role="none"><button role="menuitem" class="theme" id="coal">Coal</button></li>
<li role="none"><button role="menuitem" class="theme" id="navy">Navy</button></li>
<li role="none"><button role="menuitem" class="theme" id="ayu">Ayu</button></li>
</ul>
<button id="search-toggle" class="icon-button" type="button" title="Search. (Shortkey: s)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="S" aria-controls="searchbar">
<i class="fa fa-search"></i>
</button>
</div>
<h1 class="menu-title">Physics-Based Simulation</h1>
<div class="right-buttons">
<a href="print.html" title="Print this book" aria-label="Print this book">
<i id="print-button" class="fa fa-print"></i>
</a>
</div>
</div>
<div id="search-wrapper" class="hidden">
<form id="searchbar-outer" class="searchbar-outer">
<input type="search" id="searchbar" name="searchbar" placeholder="Search this book ..." aria-controls="searchresults-outer" aria-describedby="searchresults-header">
</form>
<div id="searchresults-outer" class="searchresults-outer hidden">
<div id="searchresults-header" class="searchresults-header"></div>
<ul id="searchresults">
</ul>
</div>
</div>
<!-- Apply ARIA attributes after the sidebar and the sidebar toggle button are added to the DOM -->
<script>
document.getElementById('sidebar-toggle').setAttribute('aria-expanded', sidebar === 'visible');
document.getElementById('sidebar').setAttribute('aria-hidden', sidebar !== 'visible');
Array.from(document.querySelectorAll('#sidebar a')).forEach(function(link) {
link.setAttribute('tabIndex', sidebar === 'visible' ? 0 : -1);
});
</script>
<div id="content" class="content">
<main>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.4/dist/katex.min.css">
<h2 id="from-ground-to-slope"><a class="header" href="#from-ground-to-slope">From Ground to Slope</a></h2>
<p>The implementation in the <a href="lec8.3-square_drop.html">Square Drop</a> case study for horizontal grounds results in a simplified distance and distance gradient (Equation <a href="lec8.3-square_drop.html#eq:lec8:dist_ground">(8.3.1)</a>) compared to that of a general half-space (Equation <a href="lec7.1-signed_dists.html#eq:lec7:half_space_dist">(7.1.1)</a>):
<span class="katex-display"><span class="katex"><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathnormal">d</span><span class="mopen">(</span><span class="mord mathbf">x</span><span class="mclose">)</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:1.1413em;vertical-align:-0.25em;"></span><span class="mord"><span class="mord mathbf">n</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8913em;"><span style="top:-3.113em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight" style="margin-right:0.13889em;">T</span></span></span></span></span></span></span></span><span class="mopen">(</span><span class="mord mathbf">x</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">−</span><span class="mspace" style="margin-right:0.2222em;"></span></span><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord"><span class="mord"><span class="mord boldsymbol">o</span></span></span><span class="mclose">)</span><span class="mpunct">,</span><span class="mspace" style="margin-right:1em;"></span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord">∇</span><span class="mord mathnormal">d</span><span class="mopen">(</span><span class="mord mathbf">x</span><span class="mclose">)</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:1.1141em;vertical-align:-0.25em;"></span><span class="mord mathbf">n</span><span class="mpunct">,</span><span class="mspace" style="margin-right:1em;"></span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord text"><span class="mord">and</span></span><span class="mspace" style="margin-right:1em;"></span><span class="mord"><span class="mord">∇</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8641em;"><span style="top:-3.113em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">2</span></span></span></span></span></span></span></span><span class="mord mathnormal">d</span><span class="mopen">(</span><span class="mord mathbf">x</span><span class="mclose">)</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.6444em;"></span><span class="mord"><span class="mord"><span class="mord mathbf">0</span></span></span><span class="mord">.</span><span class="enclosing" id="eq:lec10:half_space_dist"></span></span><span class="tag"><span class="strut" style="height:1.1413em;vertical-align:-0.25em;"></span><span class="mord text"><span class="mord">(</span><span class="mord"><span class="mord">10.1.1</span></span><span class="mord">)</span></span></span></span></span></span>
This is all we need for implementing the slope. Defining a normal direction and a point lying on the slope</p>
<p><a name="imp:lec10:slope"></a>
<strong>Implementation 10.1.1 (Slope setup, simulator.py).</strong></p>
<pre><code class="language-python">ground_n = np.array([0.1, 1.0]) # normal of the slope
ground_n /= np.linalg.norm(ground_n) # normalize ground normal vector just in case
ground_o = np.array([0.0, -1.0]) # a point on the slope
</code></pre>
<p>and passing them to the time integrator and barrier energy, we can modify the barrier energy value, gradient, and Hessian computation for the slope as</p>
<p><a name="imp:lec10:slope_barrier"></a>
<strong>Implementation 10.1.2 (Slope contact barrier, BarrierEnergy.py).</strong></p>
<pre><code class="language-python">import math
import numpy as np
dhat = 0.01
kappa = 1e5
def val(x, n, o, contact_area):
sum = 0.0
for i in range(0, len(x)):
d = n.dot(x[i] - o)
if d < dhat:
s = d / dhat
sum += contact_area[i] * dhat * kappa / 2 * (s - 1) * math.log(s)
return sum
def grad(x, n, o, contact_area):
g = np.array([[0.0, 0.0]] * len(x))
for i in range(0, len(x)):
d = n.dot(x[i] - o)
if d < dhat:
s = d / dhat
g[i] = contact_area[i] * dhat * (kappa / 2 * (math.log(s) / dhat + (s - 1) / d)) * n
return g
def hess(x, n, o, contact_area):
IJV = [[0] * 0, [0] * 0, np.array([0.0] * 0)]
for i in range(0, len(x)):
d = n.dot(x[i] - o)
if d < dhat:
local_hess = contact_area[i] * dhat * kappa / (2 * d * d * dhat) * (d + dhat) * np.outer(n, n)
for c in range(0, 2):
for r in range(0, 2):
IJV[0].append(i * 2 + r)
IJV[1].append(i * 2 + c)
IJV[2] = np.append(IJV[2], local_hess[r, c])
return IJV
</code></pre>
<p>Then for the continuous collision detection, we similarly modify the implementation to compute the large feasible initial step size for line search using <span class="katex"><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.4444em;"></span><span class="mord mathbf">n</span></span></span></span> and <span class="katex"><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.4444em;"></span><span class="mord"><span class="mord"><span class="mord boldsymbol">o</span></span></span></span></span></span>:</p>
<p><a name="imp:lec10:slope_ccd"></a>
<strong>Implementation 10.1.3 (Slope CCD, BarrierEnergy.py).</strong></p>
<pre><code class="language-python">def init_step_size(x, n, o, p):
alpha = 1
for i in range(0, len(x)):
p_n = p[i].dot(n)
if p_n < 0:
alpha = min(alpha, 0.9 * n.dot(x[i] - o) / -p_n)
return alpha
</code></pre>
<p>Here the search direction of each node is projected onto the normal direction <span class="katex"><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.4444em;"></span><span class="mord mathbf">n</span></span></span></span> to divide the current distance when computing the smallest step size that first brings the distance to <span class="katex"><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6444em;"></span><span class="mord">0</span></span></span></span>.</p>
<p>Finally, drawing the slope as a line from <span class="katex"><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6667em;vertical-align:-0.0833em;"></span><span class="mord"><span class="mord"><span class="mord boldsymbol">o</span></span></span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">−</span><span class="mspace" style="margin-right:0.2222em;"></span></span><span class="base"><span class="strut" style="height:0.6944em;"></span><span class="mord">3</span><span class="mord accent"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.6944em;"><span style="top:-3em;"><span class="pstrut" style="height:3em;"></span><span class="mord mathnormal">n</span></span><span style="top:-3em;"><span class="pstrut" style="height:3em;"></span><span class="accent-body" style="left:-0.25em;"><span class="mord">^</span></span></span></span></span></span></span></span></span></span> to <span class="katex"><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6667em;vertical-align:-0.0833em;"></span><span class="mord"><span class="mord"><span class="mord boldsymbol">o</span></span></span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">+</span><span class="mspace" style="margin-right:0.2222em;"></span></span><span class="base"><span class="strut" style="height:0.6944em;"></span><span class="mord">3</span><span class="mord accent"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.6944em;"><span style="top:-3em;"><span class="pstrut" style="height:3em;"></span><span class="mord mathnormal">n</span></span><span style="top:-3em;"><span class="pstrut" style="height:3em;"></span><span class="accent-body" style="left:-0.25em;"><span class="mord">^</span></span></span></span></span></span></span></span></span></span> where <span class="katex"><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6944em;"></span><span class="mord accent"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.6944em;"><span style="top:-3em;"><span class="pstrut" style="height:3em;"></span><span class="mord mathnormal">n</span></span><span style="top:-3em;"><span class="pstrut" style="height:3em;"></span><span class="accent-body" style="left:-0.25em;"><span class="mord">^</span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:1.0361em;vertical-align:-0.2861em;"></span><span class="mopen">[</span><span class="mord"><span class="mord mathbf">n</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.1514em;"><span style="top:-2.55em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight" style="margin-right:0.03588em;">y</span></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.2861em;"><span></span></span></span></span></span></span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord">−</span><span class="mord"><span class="mord mathbf">n</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.1514em;"><span style="top:-2.55em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">x</span></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span><span class="mclose">]</span></span></span></span> pointing to the inclined direction,</p>
<p><a name="imp:lec10:slope_vis"></a>
<strong>Implementation 10.1.4 (Slope visualization, simulator.py).</strong></p>
<pre><code class="language-python"> pygame.draw.aaline(screen, (0, 0, 255), screen_projection([ground_o[0] - 3.0 * ground_n[1], ground_o[1] + 3.0 * ground_n[0]]),
screen_projection([ground_o[0] + 3.0 * ground_n[1], ground_o[1] - 3.0 * ground_n[0]])) # slope
</code></pre>
<p>we can now simulate an elastic square dropped on a slope without friction (<a href="#fig:lec10:slope_mu0">Figure 10.1.1</a>).</p>
<figure>
<center>
<img src="img/lec10/slope_mu0.jpg">
</center>
<figcaption><b><a name="fig:lec10:slope_mu0"></a>
Figure 10.1.1.</b> An elastic square dropped onto a frictionless slope, bouncing as it slides down. </figcaption>
</figure>
</main>
<nav class="nav-wrapper" aria-label="Page navigation">
<!-- Mobile navigation buttons -->
<a rel="prev" href="lec10-square_on_slope.html" class="mobile-nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
<i class="fa fa-angle-left"></i>
</a>
<a rel="next prefetch" href="lec10.2-slope_fric.html" class="mobile-nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
<i class="fa fa-angle-right"></i>
</a>
<div style="clear: both"></div>
</nav>
</div>
</div>
<nav class="nav-wide-wrapper" aria-label="Page navigation">
<a rel="prev" href="lec10-square_on_slope.html" class="nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
<i class="fa fa-angle-left"></i>
</a>
<a rel="next prefetch" href="lec10.2-slope_fric.html" class="nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
<i class="fa fa-angle-right"></i>
</a>
</nav>
</div>
<script>
window.playground_copyable = true;
</script>
<script src="elasticlunr.min.js"></script>
<script src="mark.min.js"></script>
<script src="searcher.js"></script>
<script src="clipboard.min.js"></script>
<script src="highlight.js"></script>
<script src="book.js"></script>
<!-- Custom JS scripts -->
</div>
</body>
</html>