正如你可以告诉我正在试图把一个非常简单的3d引擎放在一起。我正在用javascript编写它。我认为公式中可能存在错误,但对于我而言,我找不到它。所以现在我想可能还有别的东西我还没有考虑过。第21行出现的错误(DX = Math.cos .....)什么是导致未捕获的类型错误:数量不是函数?
这里是我的代码的相关部分:
// Camera Position in x,y,z
var c = [ 0,0,0 ];
// Viewer position [x,y,z]
var v = [ 0,0,0 ];
// Angle of view [x, y, z]
var a = [ 0.01, 0.01, 0.01 ];
var point = [ 0,0, 50 ];
dx = Math.cos(a[1])(Math.sin(a[2])(point[1] - c[1]) + Math.cos(a[2])(point[0] - c[0])) - Math.sin(a[1])(point[2] - c[2]);
dy = Math.sin(a[0])(Math.cos(a[1])(point[2] - c[2]) + Math.sin(a[1])(Math.sin(a[2])(point[1] - c[1]) + Math.cos(a[2])(point[0] - c[0]))) + Math.cos(a[0])(Math.cos(a[2])(point[1] - c[1]) - Math.sin(a[2])(point[0] - c[0]));
dz = Math.cos(a[0])(Math.cos(a[1])(point[2] - c[2]) + Math.sin(a[1])(Math.sin(a[2])(point[1] - c[1]) + Math.cos(a[2])(point[0] - c[0]))) - Math.sin(a[0])(Math.cos(a[2])(point[1] - c[1]) - Math.sin(a[2])(point[0] - c[0]));
bx = (dx - v[0])(v[2]/dz);
by = (dy - v[1])(v[2]/dz);
哇.....它的太迟。谢谢。 – 2011-03-29 03:20:13