Skip to content

Commit

Permalink
truncatedConeのnormalの計算のバグを修正
Browse files Browse the repository at this point in the history
  • Loading branch information
inaridarkfox4231 committed Nov 7, 2023
1 parent 0dd1074 commit 9ae9b0e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/p5wgex.js
Original file line number Diff line number Diff line change
Expand Up @@ -4044,11 +4044,13 @@ const p5wgex = (function(){
const r = upperRadius * (1-k/dty) + lowerRadius * k/dty;
const theta = Math.atan2(lowerRadius - upperRadius, top - bottom);
mesh.v.push(r*Math.cos(angle), r*Math.sin(angle), h);
// cosとsinが逆でした。
mesh.n.push(
Math.cos(angle) * Math.sin(theta),
Math.sin(angle) * Math.sin(theta),
Math.cos(theta)
Math.cos(angle) * Math.cos(theta),
Math.sin(angle) * Math.cos(theta),
Math.sin(theta)
);
//console.log(theta);
mesh.uv.push(i/dtx, k/dty); // 基本的には全体
// つまり側面のない円柱の場合UVは正方形全体
}
Expand Down

0 comments on commit 9ae9b0e

Please sign in to comment.