Repetitive points in Three.js

I've been working on creating a line in my scene, and it displays perfectly. However, when I attempt to create a mesh using the same coordinates that formed the line, I encounter errors indicating duplicate points.

It's quite puzzling because I have over 4000 points of coordinates, and I'm confident that none of them are repeated (except for the starting and ending coordinates, which are meant to be the same). I even double-checked in Excel.

Is there a way to create the mesh from the line's points without encountering these errors? Or perhaps, what other steps should I consider taking?

for(var x in features.features){

     materialLinea[x] = new THREE.LineBasicMaterial( { color: "#FFFFFF"} ); 
      array_extrude[x]=new Array();
     material[x] = new THREE.MeshBasicMaterial({
                    color: "#FF0000"
                }); 
     geometria[x] = new THREE.Geometry();

    for(var s in features.features[x].geometry.coordinates[0]){
        geometria[x].vertices.push(new THREE.Vector3(features.features[x].geometry.coordinates[0][s][0],features.features[x].geometry.coordinates[0][s][1],0))
        array_extrude[x].push(new THREE.Vector3(features.features[x].geometry.coordinates[0][s][0],features.features[x].geometry.coordinates[0][s][1],0));
    }
    line[x] = new THREE.Line( geometria[x], materialLinea[x])
    scene.add(line[x])



    object3d[x] = new THREE.Shape( array_extrude[x] );
    var extrusionSettings = {bevelEnabled: false,amount:10, };

    figuraExtrude[x] = new THREE.ExtrudeGeometry( object3d[x],   extrusionSettings );
    municipios[x] = new THREE.Mesh( figuraExtrude[x], material[x] );
    scene.add(municipios[x]);
}

Answer №1

Combining vertices within your geometric shapes is possible with the following method: Geometry.mergeVertices()

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

casperjs timeout issue with an endless loop

Currently, I am utilizing casperjs to retrieve the content of a website that updates its values using websockets. Rather than attaching an event listener to each value, my goal is to scrape the entire website every 10 seconds. Here is the code snippet I a ...

Custom pagination with onSelectionModelChange in React Material UI Data Grid

Has anyone encountered a problem with using the DataGrid component's onSelectionModelChange prop? I can successfully retrieve the selected rows for a single page, but when I implement custom pagination and navigate to the next page, the previous selec ...

Is it possible for ResizeObserver to only observe changes in width?

Is there a way to have ResizeObserver only trigger on width changes and not on height changes? For example: const resizeObserver = new ResizeObserver(updateLayout); resizeObserver.observe(layout.current); const updateLayout = () => {/*perform action*/ ...

Tips for including data labels in a scatter plot using d3.js

I am currently studying d3.js for data visualization and I have chosen to work with the titanic dataset My objective is to incorporate passenger names into my visualization so that when a cursor hovers over a point, the person's name is displayed. H ...

Vue: the parent template does not permit the use of v-for directives

Upon creating a simple post list component, I encountered an error when trying to utilize the v-for directive: "eslint-eslint: the template root disallows v-for directives" How can I go about iterating through and displaying each post? To pass data from ...

Once lerna has the ability to handle monorepos, what benefits does Rush provide?

After thoroughly reviewing multiple datasets, it appears that Rush has a clear advantage in supporting pnpm due to its timeliness. However, it is worth noting that lerna can also offer support for pnpm: Despite this, lerna's earlier release gives it ...

Refresh your inbox after sending a response by leveraging jQuery and AJAX requests

Let's talk about updating the messaging inbox after a user sends a reply, similar to Facebook's system. Here's how my messaging setup is structured: <div class="message_container"> <div class="message_inbox"> <di ...

Every time the Select box choice is changed, Jade Pug will undergo a new iteration

Recently, I began using a Pug/Jade template to go through an object of events sent from an express app. Everything is working smoothly, but now I've added a select box with a dropdown populated by venues in the event object. I'm facing a seemingl ...

Tips for toggling Bootstrap 5 tabs using JavaScript instead of the button version

I am looking to switch tabs programmatically using bootstrap 5. The Bootstrap documentation recommends using buttons for tabs instead of links for a dynamic change. Here is the code I have: $("#mybut").click(function() { var sel = document.querySelector( ...

dispatch a WebSocket message within a route using Express.js

The Objective: Imagine a bustling marketplace with multiple shops. I'm working on a dedicated page localhost:3000/livePurchases/:storeId for shop owners to receive real-time notifications whenever they make a new sale. https://i.stack.imgur.com/VdNz ...

When two dynamically sized divs are contained within a parent div with a maximum height, the second div should be positioned at the bottom

My outer div has a maximum height of 800px. Depending on the results of a MySQL query, there could be one or two inner divs nested within the outer div. The second inner div must always be fixed to the bottom of its parent. I know how to achieve this usin ...

Prevent Click Event on Angular Mat-Button

One of the challenges I'm facing involves a column with buttons within a mat-table. These buttons need to be enabled or disabled based on a value, which is working as intended. However, a new issue arises when a user clicks on a disabled button, resul ...

Before clicking the submit button, send field values using Ajax

Is it possible to send values using ajax before submitting form data with a submit button? I have the code below. It successfully reaches the success function, but I am unable to retrieve the posted data. Any ideas on how to solve this issue? Your help an ...

The trajectory in three.js is not always accurate

As I work on creating a shooter in three.js, I've encountered an issue. When I change my aim left and right, the bullet fires in the correct direction. However, when I adjust my aim up and down, the bullet moves in those respective directions but does ...

Error encountered: Class not found exception in the context of JSONArray

import org.json.JSONArray; JSONArray json=new JSONArray(al); response.setContentType("application/json"); response.getWriter().print(json); } Despite having included the necessary jar in my project, I am encountering this error: SEVERE: Servle ...

Transferring JSON data using DWR (Direct Web Remoting)

Utilizing DWR for AJAX calls in my project involves the conversion of JavaScript objects to Java objects by analyzing the Java class. My goal is to send and receive a JSON-like structure through DWR. For example: JavaScript Object: { "name" : "TamilVe ...

When trying to save an image using multer's storage, the error message "ENOENT: file or directory not found" is displayed. It is important to note that symbols are not causing

Whenever I try to save an image using multer's storage feature, I encounter the following issue: [Error: ENOENT: no such file or directory, open 'C:\MAMP\htdocs\Chat Backend\public\images\servers\1596819056816AF ...

How can I create spacing between squares in an HTML div element?

Currently, I am working on my project using Laravel 5. I retrieve some integer values from a database and use them to create square divs in HTML. Below is the current output of my work. https://i.stack.imgur.com/sy2ru.png You may notice that there is spa ...

Encountered a SyntaxError in vue + webpack regarding an invalid range in character class

I am currently using webpack 4.29.3 and vue.js 2.6.3 to create a simple hello world project. I expected the index.html file to render correctly, but I encountered an error: SyntaxError: invalid range in character class. This error is confusing because I&ap ...

I'm experiencing an issue where a function call within a Vue.js v-for directive causes the loop to continue indefinitely, but I'm unsure of the cause

Here is the template I am working with: <template> <div> <div v-for="report in reports"> <div class="map" v-bind:id="mapID = report.started.toUpperCase()" v-text="report.started"> {{hello(mapID)}} </div& ...