3 <title>Serrated
</title>
4 <script type=
"text/javascript" src=
"nt3d.js"></script>
5 <script type=
"text/javascript">
6 function serrated(params) {
8 var path_length = params.num_serrations * params.steps_per_serration;
10 for (var i =
0; i <= path_length; i++) {
11 path[i] = [params.length*i/path_length,
0,
0];
13 var serration_length = params.length / params.num_serrations;
14 var serration_half_length = serration_length /
2;
15 var serration_radius = serration_half_length / Math.sin(tau * params.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 = params.thickness / (
2 * Math.tan(tau * params.edge_bevel_angle));
22 var serration_progress = (i % params.steps_per_serration) / params.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 (params.arc <
0) serration_height *= -
1;
26 var blade_height = params.depth + serration_height;
28 [blade_height - edge_height,
0,
0],
29 [blade_height, params.thickness/
2,
0],
30 [blade_height - edge_height, params.thickness,
0],
31 [
0, params.thickness,
0]];
33 return nt3d.extrude(path, shape, [
1,
0,
0], [
0,
0,
1]);
35 var params = [["length",
100, ],
38 ["num_serrations",
10],
39 ["arc",
.2, "Arc of Each Serration (in turns)"],
40 ["steps_per_serration",
11],
41 ["edge_bevel_angle",
.05, "Edge Bevel Angle (in turns)"]];
44 <body onload=
"nt3d.framework(serrated, params)">
46 <p>Make a serrated blade.
</p>