Three.js 字体中的重复点 [英] Duplicate points in three.js font

查看:31
本文介绍了Three.js 字体中的重复点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用 Facetype.js 将 ttf 字体转换为 Three.js 的 js 字体,但是我收到了许多重复点错误,如下所示:

I've used Facetype.js to convert a ttf font to a js font for three.js however I'm getting a number of duplicate point errors like so:

THREE.Shape:重复点 41.52:10.928 THREE.ShapeUtils:无法三角化多边形!在三角()

THREE.Shape: Duplicate point 41.52:10.928 THREE.ShapeUtils: Unable to triangulate polygon! in triangulate()

如何解决这些问题?

推荐答案

要么在进行三角剖分之前从几何中删除重复项,要么使用不同的三角剖分库,例如 earcut.js.

Either remove the duplicates from your geometry before you do the triangulation or use a different triangulation library for example earcut.js.

Earcut 对几何定义中的缺陷(如重复点或相交边缘)不太敏感.您可以使用我在此处在 GitHub 上制作和共享的适配器轻松使用不同的三角剖分库.

Earcut is less sensitive for flaws in your geometry definition (like duplicate points or intersecting edges). You can easily use a different triangulation library using an adapter that I made and shared here on GitHub.

只需下载依赖项并执行:

Just download the dependencies and do:

THREE.Triangulation.setLibrary( THREE.Triangulation.libraries.earcut );

切换到耳切后,您(很可能)还会获得一些性能提升.

With switching to earcut you will (most likely) also get some performance increase.

注意:只要您的几何图形看起来不错,您就不必担心这些错误消息,您也可以决定忽略它们.

这篇关于Three.js 字体中的重复点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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