summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
2f26ede)
It was kind of sheer luck that any extrudes worked before this fix.
Also, add rotation to torus_by_extrude, which was an easy way to
reproduce this.
},
project: function(a, b) { // Project b onto a
var a_magnitude = this.magnitude(a);
},
project: function(a, b) { // Project b onto a
var a_magnitude = this.magnitude(a);
- return this.scale(a, this.dot(a, b) / a_magnitude * a_magnitude);
+ return this.scale(a, this.dot(a, b) / (a_magnitude * a_magnitude));
},
project_to_orthogonal: function(a, b) {
// The nearest thing to b that is orthogonal to a
},
project_to_orthogonal: function(a, b) {
// The nearest thing to b that is orthogonal to a
<title>Torus by extrude</title>
<script type="text/javascript" src="nt3d.js"></script>
<script type="text/javascript">
<title>Torus by extrude</title>
<script type="text/javascript" src="nt3d.js"></script>
<script type="text/javascript">
- function torus_by_extrude(torus_radius, cross_section_radius, long_steps, short_steps) {
+ function torus_by_extrude(torus_radius, cross_section_radius, rotation, long_steps, short_steps) {
var path = nt3d.circle(torus_radius, long_steps);
var path = nt3d.circle(torus_radius, long_steps);
+ path = nt3d.rotate_about_origin(path, [0,1,0], rotation * 2*Math.PI);
return nt3d.closed_extrude(
path,
nt3d.circle(cross_section_radius, short_steps),
return nt3d.closed_extrude(
path,
nt3d.circle(cross_section_radius, short_steps),
}
var params = [["Torus radus", 100],
["Cross section radius", 40],
}
var params = [["Torus radus", 100],
["Cross section radius", 40],
+ ["Rotation (turns)", 0.001],
["Steps around the long way", 50],
["Steps around the short way", 16]];
</script>
["Steps around the long way", 50],
["Steps around the short way", 16]];
</script>