3 <title>Serrated
</title>
4 <script type=
"text/javascript" src=
"nt3d.js"></script>
5 <script type=
"text/javascript">
6 function serrated(length, thickness, depth, serration_count, arc, steps_per_serration, edge_bevel_angle) {
8 var path_length = serration_count * steps_per_serration;
10 for (var i =
0; i <= path_length; i++) {
11 path[i] = [length*i/path_length,
0,
0];
13 var serration_length = length / serration_count;
14 var serration_half_length = serration_length /
2;
15 var serration_radius = serration_half_length / Math.sin(tau * arc /
2);
16 var serration_max_height = Math.sqrt(serration_radius*serration_radius - serration_half_length*serration_half_length);
17 // This emits a Sabre Grind. TODO: Support a double bevel.
18 // http://en.wikipedia.org/wiki/Grind#Typical_grinds
19 // http://www.allaboutpocketknives.com/images/aapk_content/blade_bevel.JPG
20 var edge_height = thickness / (
2 * Math.tan(tau * edge_bevel_angle));
22 var serration_progress = (i % steps_per_serration) / steps_per_serration;
23 var serration_x = serration_progress * serration_length - serration_half_length;
24 var serration_height = serration_max_height - Math.sqrt(serration_radius*serration_radius - serration_x*serration_x);
25 if (arc <
0) serration_height *= -
1;
26 var blade_height = depth + serration_height;
28 [blade_height - edge_height,
0,
0],
29 [blade_height, thickness/
2,
0],
30 [blade_height - edge_height, thickness,
0],
33 return nt3d.extrude(path, shape, [
1,
0,
0], [
0,
0,
1]);
35 var params = [["Blade length",
100],
36 ["Blade thickness",
2],
38 ["Number of serrations",
10],
39 ["Arc of each serration (in turns)",
.2],
40 ["Steps per serration",
11],
41 ["Edge bevel angle (in turns)",
.05]];
44 <body onload=
"nt3d.framework(serrated, params)">
46 <p>Make a serrated blade.
</p>