如何从three.js中的一系列3D点创建3D多边形? [英] How do I create a 3D polygon from a series of 3D points in three.js?

查看:142
本文介绍了如何从three.js中的一系列3D点创建3D多边形?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道在给定three.js中3D点数组的情况下,生成自定义3D多边形的最佳方法是什么。这是一个没有孔的简单多边形。这些点是有序的,以便它们表示相邻的顶点。我可以在2D模式下完成,但我不这样做
谢谢您的帮助!

I wonder what would be the best way to generate a custom 3D polygon given an array of 3D points in three.js. It is a simple polygon without holes. The points are ordered so that they represent neighboring vertices.I can do it in 2D, but I don't want the vertices to be coplanar. Thank you for your help!

推荐答案

主要问题这是如何从多个点创建3D网格的方法。换句话说:您需要弄清楚应该连接哪个顶点以形成一个三角形。

The main problem here is how to create a 3D mesh from a bunch of points. In other words: you need to figure out which of the vertices should be connect to form a triangle.

这是一件非常复杂的事情(嗯,至少我

This is an surprisingly complicated thing to do (well, at least I was surprised) and there are tons of scientific papers, libraries and so on about that.

但是,在您的情况下,这有点简单,因为您已经大致了解了顶点应该连接起来。我建议您看看 earcut-library libtess.js ,两者都应该能够创建所需的三角剖分。

However, in your case it is a bit simpler as you already know roughly how the vertices should get connected. I would recommend you have a look at the earcut-library or libtess.js, both of which should be able to create the triangulations you need.

一旦有了,就可以大致参考 @ lior-trau的建议,以了解如何通过结果。

Once you have that, you can roughly go with @lior-trau's recommendation for how to create the geometry from the result.

这篇关于如何从three.js中的一系列3D点创建3D多边形?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆