Three.js shape from random points

纵饮孤独 提交于 2019-12-04 19:30:21

You can create a polyhedron which is the convex hull of a set of 3D points by using a pattern like so:

var points = [
    new THREE.Vector3( 100, 0, 0 ),
    new THREE.Vector3( 0, 100, 0 ),
    ...
    new THREE.Vector3( 0, 0, 100 )
];

var geometry = new THREE.ConvexGeometry( points );

var material = new THREE.MeshPhongMaterial( {
    color: 0xff0000, 
    shading: THREE.FlatShading
} );

mesh = new THREE.Mesh( geometry, material );
scene.add( mesh );

You must include the following in your project

<script src="/examples/js/geometries/ConvexGeometry.js"></script>

three.js r.78

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!