Repetitive points detected in three.js typography

I converted a ttf font to a js font for three.js using Facetype.js, but I am encountering multiple duplicate point errors such as:

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

What steps should I take to resolve these problems?

Answer №1

To avoid duplicate issues in your geometry, consider removing them before proceeding with the triangulation process. Alternatively, you can opt to utilize a different triangulation library such as earcut.js.

Earcut is known for being less susceptible to flaws in the geometry definition, such as duplicate points or intersecting edges. If you are interested in switching to a different triangulation library, I have created an adapter that can be accessed and downloaded from GitHub.

Simply download the required dependencies and initialize the adapter by using the following code:

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

By transitioning to earcut, you may also experience a performance boost.


Note: If your geometry appears to be in good shape, you can choose to disregard these error messages and proceed without any major concerns.

Answer №2

Hey @Wilt, just wanted to mention that using this library with earcut can be really efficient. For those who have already set up their own renderer, environment, and lights, all you need to do is include the following code:

<!-- adding the earcut triangulation library -->
<script type="text/javascript" src="earcut.js"></script>
<script type="text/javascript" src="triangulation.js"></script>
<script type="text/javascript" src="viewers/loader.js"></script>

Then, make sure to specify the library at the beginning of your script like this:

/* set the triangulation library to earcut */
THREE.Triangulation.setLibrary( THREE.Triangulation.libraries.earcut );

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

States following form submission in an HTTP request may vary

When attempting to submit a form and receive the results on the same page using AJAX, a JavaScript function is called onsubmit, initiating the AJAX call and including the following code: request=new XMLHttpRequest(); /* set up request here ...

Searching for values within an array using the ".includes" method

I'm curious if there's a method to determine if a string contains any characters that are also present in an array? const array = ["cake", "hello", "ok"]; const string = "hello"; let result = string.include ...

Having trouble keeping the passport authenticated during chai tests

I have been developing tests for routes that require authentication with passport and express-session. In normal circumstances, the routes authenticate successfully and everything functions as expected. However, during testing with chai, the authenticatio ...

Performing calculations within handsontable

Trying to figure out how to concatenate values from a handsontable grid, I stumbled upon some code on jsfiddle that caught my eye. Here is the link: http://jsfiddle.net/9onuhpn7/4/ The task at hand involves 3 columns A,B,C and an attempt to concatenate ...

Encountered an issue while attempting to view DWF/DWFX file directly in Forge Viewer

I have encountered an issue while trying to open a DWF file using the code snippet below. The file size is more than 20MB. const options = { env: 'Local', useADP: false} var config3d = { extensions: ['Autodesk.Viewing.MarkupsCore'], ...

Is there a way for me to display an alert notification when a website requests access to additional storage on my computer?

Is there a way to set up an alert notification in Internet Explorer when a website requests additional storage on your computer? The notification would ask: Do you want to grant permission for this website to use additional storage on your computer? ...

What is the best way to create a function that shifts a musical note up or down by one semitone?

Currently developing a guitar tuning tool and facing some hurdles. Striving to create a function that can take a musical note, an octave, and a direction (up or down), then produce a transposed note by a half step based on the traditional piano layout (i. ...

What could be causing the Uncaught Error to persist even after using .catch()?

Check out this code snippet: function pause(ms:number) { return new Promise((resolve:any,reject:any) => setTimeout(resolve,ms)) } async function throwError(): Promise<void> { await pause(2000) console.log("error throw") throw new ...

React Native app experiences a start-up crash caused by SoLoader problem

I'm encountering a problem with my Android app (iOS is working fine). Every time I build it, the application closes before launching. I've tried various solutions found on Github and here, but haven't been able to resolve it yet. The instal ...

Exploring the DOM in JavaScript: Searching for the final ancestor containing a specific attribute

Check out this example of HTML code: <div id="main1" data-attribute="main"> <div id="section2" data-attribute="subsection"> <div id="nested3" data-attribute="sub-subsection"> </div> </div> </div> <div id= ...

Picture goes missing from slideshow

I am currently using a CSS + Javascript slideshow on my website, inspired by an example from the W3Schools website. Here is the code I have adapted for my web application: $(document).ready(function() { var slideIndex = 1; function showSlides(n) { ...

Input Error in ASP.NET JavaScript

Within my ASP.NET website, I have implemented an <asp:TextBox /> where the text input is encoded using HttpUtility.HtmlEncode(); Furthermore, the page is equipped with validation controls like <asp:RequiredFieldValidator /> and <asp:CustomV ...

Struggling with rendering object in Next.js, receiving an error stating "map is not a function."

Currently, I am attempting to display data fetched from STRAPI using Graphql and Next.js. Fortunately, my event Adapter is functioning perfectly. However, when trying to showcase this data on the UI, an error occurs stating event.map is not a function. Whi ...

Inconsistency in Firebase data updates

Hey there, my code snippet below is responsible for capturing latitude and longitude values through a drag-and-drop marker. Although the latitude and longitude are continuously updated in the console when I log them, the same doesn't seem to happen wh ...

Redux-form fails to retrieve the value of the SelectField

I'm trying to work with a simple form using react and redux-form. My goal is to gather all the field values from my form and send them to my RESTful API using jQuery ajax. Unfortunately, I've run into an issue where redux-form doesn't seem ...

How can I effectively refresh the provider_token / access token for Discord in NextJS with Supabase Auth?

Currently, I have encountered an issue with my NextJs project using Supabase Auth for authentication. I am currently utilizing the Discord provider and everything works fine initially. However, after a few minutes, the session object gets updated and the p ...

Encountering a React error when attempting to generate a URL for an image in Sanity

Server Error Error: The asset reference 'e173af30-fd2d-42ed-a364-d92a2cddf32c' is malformed. It should be in the format of an id such as "image-Tb9Ew8CXIwaY6R1kjMvI0uRR-2000x3000-jpg".https://i.stack.imgur.com/koC26.png https://i.stack.imgur.com/ ...

What is the best way to remove double quotes surrounding "name" and "count" when displayed in the JavaScript console output?

I am struggling to transform the input: ["apple", "banana", "carrot", "durian", "eggplant", "apple", "carrot"] into the desired output: [{ name: "Apple", count: 2 }, { name: ...

What is the process for comprehending an event that is not triggered by the task queue within the event loop specifications?

According to the guidelines: Various events are triggered through tasks apart from just the task queue. I am curious to understand what exactly is meant by "various" and the specific types of tasks being referred to here? ...

Discovering the values within a separate JSON object

I have a collection of json objects that include information about different languages and user details. Languages User Details The user details contain a field for languages, which can have multiple values. Below is a sample json: $scope.languages = ...