Skip to content

Commit 42341df

Browse files
committed
edit tutorials; correctness fixes in some Meshes functions
1 parent 6c66f36 commit 42341df

File tree

4 files changed

+170
-69
lines changed

4 files changed

+170
-69
lines changed

glutil-meshes.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ Meshes.createPartialDisk=function(inner, outer, slices, loops, start, sweep, inw
276276
}
277277
for(var i=0;i<=slices;i++){
278278
var t=i*1.0/slices;
279-
var angle=start+arcLength*t;
279+
var angle=(t==1 && arcLength==twopi) ? start : start+arcLength*t;
280280
angle=(angle<0) ? twopi-(-angle)%twopi : angle%twopi;
281281
sc.push(Math.sin(angle),Math.cos(angle));
282282
tc.push(t);
@@ -371,14 +371,18 @@ Meshes.createTorus=function(inner, outer, lengthwise, crosswise,flat,inward){
371371
var twopi=GLMath.PiTimes2;
372372
var sci=[];
373373
var scj=[];
374-
for(var i = 0; i <= crosswise; i++){
374+
for(var i = 0; i < crosswise; i++){
375375
var u = i*twopi/crosswise;
376376
sci.push(Math.sin(u),Math.cos(u));
377377
}
378-
for(var i = 0; i <= lengthwise; i++){
378+
sci.push(sci[0]);
379+
sci.push(sci[1]);
380+
for(var i = 0; i < lengthwise; i++){
379381
var u = i*twopi/lengthwise;
380382
scj.push(Math.sin(u),Math.cos(u));
381383
}
384+
scj.push(scj[0]);
385+
scj.push(scj[1]);
382386
for(var j = 0; j < lengthwise; j++){
383387
var v0 = (j)/lengthwise;
384388
var v1 = (j+1.0)/lengthwise;

glutil_min.js

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)