Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

如何平滑的更改heatmap的值 #582

Open
missBlueWhite opened this issue May 16, 2023 · 1 comment
Open

如何平滑的更改heatmap的值 #582

missBlueWhite opened this issue May 16, 2023 · 1 comment

Comments

@missBlueWhite
Copy link

如何平滑的更改heatmap的值,类似https://www.patrick-wied.at/static/heatmapjs/这个官网中,heatmap的值是平滑的变化。

@missBlueWhite
Copy link
Author

就是如何动态的更改heatmap中的值? 更改heatmap.object3d.geometry.attributes.position这个中的值起作用吗?我看three中更改一个mesh的位置属性是这样子做的:

// 创建一个几何体
var geometry = new THREE.Geometry();

// 添加顶点
geometry.vertices.push(
new THREE.Vector3(0, 0, 0), // 第一个顶点
new THREE.Vector3(1, 0, 0), // 第二个顶点
new THREE.Vector3(0, 1, 0) // 第三个顶点
);

// 创建材质
var material = new THREE.MeshBasicMaterial({ color: 0xff0000 });

// 创建网格对象
var mesh = new THREE.Mesh(geometry, material);

// 添加网格到场景中
scene.add(mesh);

// 更新顶点数据
geometry.vertices[0].x = 2; // 修改第一个顶点的X坐标

// 重新计算几何体的法线和边界
geometry.computeVertexNormals();
geometry.computeBoundingBox();

// 更新网格的几何体
mesh.geometry.verticesNeedUpdate = true;
mesh.geometry.normalsNeedUpdate = true;
mesh.geometry.computeBoundingSphere();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant