昨天我试图用3D [F(x,y)]绘制数学函数。 我是怎么做到的我在空间中计算了一些点(x,y,z),然后在那里画了一个白点。
第一个问题: 当我移动场景(使用轨道控制)时,性能太差了! 所以,我正在寻找一个解决方案,我觉得NURBS曲面可能是我的解决方案。但是,问题在于我无法找到定义大量控制点的方法。 我想创建一个具有50 x 50控制点的NURBS曲面(如上图所示),但我只能创建一个3 x 4点的NURB曲面。 代码如下:
var nsControlPoints = [
[
new THREE.Vector4 ( -150, 0, 150, 1 ),
new THREE.Vector4 ( 150, 0, 150, 1 ),
new THREE.Vector4 ( 150, 0, -150, 1 ),
new THREE.Vector4 ( -150, 0, -150, 1 ),
new THREE.Vector4 ( -150, 0, 150, 1 )
],
[
new THREE.Vector4 ( -50, 50, 50, 1 ),
new THREE.Vector4 ( 50, 50, 50, 1 ),
new THREE.Vector4 ( 50, 50, -50, 1 ),
new THREE.Vector4 ( -50, 50, -50, 1 ),
new THREE.Vector4 ( -50, 50, 50, 1 )
],
[
new THREE.Vector4 ( -100, -50, 100, 1 ),
new THREE.Vector4 ( 100, -50, 100, 1 ),
new THREE.Vector4 ( 100, -50, -100, 1 ),
new THREE.Vector4 ( -100, -50, -100, 1 ),
new THREE.Vector4 ( -100, -50, 100, 1 )
],
];
var degree1 = 2;
var degree2 = 3;
var knots1 = [0, 0, 0, 1, 1, 1];
var knots2 = [0, 0, 0, 0, 1, 1, 1, 1];
var nurbsSurface = new THREE.NURBSSurface(degree1, degree2, knots1, knots2, nsControlPoints);
var map = new THREE.TextureLoader().load( 'styles/grid.jpg' );
map.wrapS = map.wrapT = THREE.RepeatWrapping;
map.anisotropy = 16;
getSurfacePoint = function(u, v) {
return nurbsSurface.getPoint(u, v);
};
var geometry = new THREE.ParametricGeometry( getSurfacePoint, 20, 20 );
var material = new THREE.MeshLambertMaterial( { map: map, side: THREE.DoubleSide } );
var object = new THREE.Mesh( geometry, material );
object.position.set( - 200, 100, 0 );
object.scale.multiplyScalar( 1 );
group.add( object );
结果:
问题: 你知道是否有办法说出类似的东西:"嘿NURBS Surface,你应该采用这个50x50的数组/矩阵向量并绘制它!"?
第二个问题: 那些功能不存在的那些点呢?
问题: 我可以用数学函数绘制一种平面吗?