Skip to content

Commit e1a7736

Browse files
committed
- new style
1 parent 2848515 commit e1a7736

1 file changed

Lines changed: 55 additions & 51 deletions

File tree

examples/shape_matching.html

Lines changed: 55 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@
22
<html class="no-js" lang="en">
33
<head>
44
<meta charset="utf-8">
5-
<style>
6-
body {font-family: Helvetica, sans-serif;}
7-
table {background-color:#CCDDEE;text-align:left}
8-
</style>
5+
<meta name="viewport" content="width=device-width, initial-scale=1">
6+
<link rel="stylesheet" href="https://interactivecomputergraphics.github.io/physics-simulation/examples/style.css">
97
<script type="text/x-mathjax-config">
108
MathJax.Hub.Config({
119
extensions: ["tex2jax.js"],
@@ -18,59 +16,64 @@
1816
"HTML-CSS": { fonts: ["TeX"] }
1917
});
2018
</script>
21-
<script type="text/javascript" aync src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.4/MathJax.js"></script>
19+
<script type="text/javascript" async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.4/MathJax.js"></script>
2220
<title>Shape Matching</title>
2321
</head>
2422
<body>
23+
24+
<header class="page-header">
25+
<h1>Shape Matching</h1>
26+
</header>
27+
2528
<main>
26-
<h1 style="text-align:center">Shape Matching</h1>
29+
<!-- Simulation panel: canvas + controls -->
2730
<table style="align_center;border-radius: 20px;padding: 20px;margin:auto">
28-
<col width="1100">
29-
<col width="400">
31+
<col width="75%">
32+
<col width="25%">
3033
<tr>
3134
<td>
32-
<canvas id="simCanvas" width="1024" height="768" style="border:2px solid #000000;border-radius: 20px;background-color:#EEEEEE">Your browser does not support the HTML5 canvas tag.</canvas>
35+
<div class="card sim-panel">
36+
<div class="sim-canvas-wrap">
37+
<canvas id="simCanvas" width="1024" height="960" style="border:2px solid #000000;border-radius: 20px;background-color:#EEEEEE">Your browser does not support the HTML5 canvas tag.</canvas>
38+
</div>
39+
</div>
3340
</td>
3441
<td>
35-
<table>
36-
<col width="180" style="padding-right:10px">
37-
<col width="100">
38-
<tr>
39-
<td><label>Current time</label></td>
40-
<td><span id="time">0.00</span> s</td>
41-
</tr>
42-
<tr>
43-
<td><label>Time per sim. step</label></td>
44-
<td><span id="timePerStep">0.00</span> ms</td>
45-
</tr>
46-
<tr>
47-
<td><label for="timeStepSizeInput">Time step size</label></td>
48-
<td><input onchange="gui.sim.timeStepSize=parseFloat(value)" id="timeStepSizeInput" type="number" value="0.01" step="0.001"></td>
49-
</tr>
50-
<tr>
51-
<td><label for="stiffnessInput">Stiffness</label></td>
52-
<td><input onchange="gui.sim.stiffness=parseFloat(value)" id="stiffnessInput" type="number" value="0.02" step="0.1"></td>
53-
</tr>
54-
<tr>
55-
<td><label for="simulateMotion">Simulate motion</label></td>
56-
<td><input onchange="gui.simulateMotion=this.checked" id="simulateMotion" type="checkbox" checked ></td>
57-
</tr>
58-
<tr>
59-
<td><label for="renderGoalPos">Render goal positions</label></td>
60-
<td><input onchange="gui.renderGoalPos=this.checked" id="renderGoalPos" type="checkbox"></td>
61-
</tr>
62-
<tr>
63-
<td></td>
64-
<td><button onclick="gui.restart()" type="button" id="restart">Restart</button></td>
65-
</tr>
66-
<tr>
67-
<td></td>
68-
<td><button onclick="gui.doPause()" type="button" id="Pause">Pause</button></td>
69-
</tr>
70-
</table>
42+
<div class="controls-panel">
43+
<h3>Controls</h3>
44+
<div class="controls-grid">
45+
<label>Current time</label>
46+
<span class="stat-value"><span id="time">0.00</span> s</span>
47+
48+
<label>Time per sim. step</label>
49+
<span class="stat-value"><span id="timePerStep">0.00</span> ms</span>
50+
51+
<label for="timeStepSizeInput">Time step size</label>
52+
<input onchange="gui.sim.timeStepSize=parseFloat(value)" id="timeStepSizeInput" type="number" value="0.01" step="0.001">
53+
54+
<label for="stiffnessInput">Stiffness</label>
55+
<input onchange="gui.sim.stiffness=parseFloat(value)" id="stiffnessInput" type="number" value="0.02" step="0.1">
56+
57+
<label for="simulateMotion">Simulate motion</label>
58+
<input onchange="gui.simulateMotion=this.checked" id="simulateMotion" type="checkbox" checked >
59+
60+
<label for="renderGoalPos">Render goal positions</label>
61+
<input onchange="gui.renderGoalPos=this.checked" id="renderGoalPos" type="checkbox">
62+
63+
<div class="full-width">
64+
<button onclick="gui.restart()" id="restart">&#9654; Restart</button>
65+
</div>
66+
<div class="full-width">
67+
<button onclick="gui.doPause()" id="Pause" class="btn-secondary">&#9646;&#9646; Pause</button>
68+
</div>
69+
</div>
70+
</div>
7171
</td>
7272
</tr>
73-
<tr><td>
73+
</table>
74+
75+
<!-- Theory section -->
76+
<div class="card theory">
7477
<h2>Shape Matching algorithm:</h2>
7578
This example shows the shape matching simulation method for deformable solids introduced by Müller et al. [MHTG05, BMM17].
7679
<ol>
@@ -165,8 +168,7 @@ <h3>References</h3>
165168
<li>[BMM17] Jan Bender, Matthias Müller, Miles Macklin. A Survey on Position Based Dynamics, 2017. Eurographics Tutorials, 2017</li>
166169
</ul>
167170

168-
</td></tr>
169-
</table>
171+
</div>
170172

171173
</main>
172174

@@ -631,10 +633,12 @@ <h3>References</h3>
631633

632634
getMousePos(canvas, event)
633635
{
634-
let rect = canvas.getBoundingClientRect();
636+
const rect = canvas.getBoundingClientRect();
637+
const scaleX = canvas.width / rect.width; // buffer / displayed size
638+
const scaleY = canvas.height / rect.height;
635639
return {
636-
x: (event.clientX - rect.left) * canvas.width / rect.width,
637-
y: (event.clientY - rect.top) * canvas.height / rect.height
640+
x: (event.clientX - rect.left) * scaleX,
641+
y: (event.clientY - rect.top) * scaleY
638642
};
639643
}
640644

0 commit comments

Comments
 (0)