Combine multiple Line objects in THREE.js using GeometryUtils.merge

Is there a way to improve performance by merging multiple Line objects into a single geometry using GeometryUtils.merge? It doesn't seem to work as expected with Line objects. Is it necessary to redefine the concept of a line to achieve this optimization?

Answer №1

Indeed, manual intervention is required for this task.

Version r.58 of three.js

Answer №2

After encountering the same issue, I came across a solution while browsing for answers. To resolve the problem temporarily, I utilized the third parameter in the THREE.Line constructor. There are two options available - THREE.LineStrip and THREE.LinePieces. Opting for the latter option, it connects a series of segments such as 0-1, 2-3, and so on. By adding a set of vertices for each line like 0-1, 1-2, 2-3, and then resetting this sequence for the next line, I was able to address the issue successfully. Hopefully, this approach will assist you as well if you prefer not to redefine the Line implementation.

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

Identifying Cross-Origin (CORS) Error from Other Errors in JavaScript's XMLHttpRequest()

I am currently working on detecting when an XMLHttpRequest() fails due to a Cross Origin Error rather than a bad request. Take, for example: ajaxObj=new XMLHttpRequest() ajaxObj.open("GET", url, true); ajaxObj.send(null); Let's consider ...

String casting for large JavaScript integers may require rounding to function properly

When trying to pass a large integer to a function from an onclick event in HTML, I always encounter issues with rounding. Despite using bigInt libraries, I still struggle to pass the full number accurately and would prefer a simple string casting method. ...

Link that causes the regular expression test to hang

My goal is to create a regular expression that can accurately identify URLs. I found the code snippet for this on Check if a Javascript string is a url. The code looks like this: function ValidURL(str) { var pattern = new RegExp('^(https?:\/&b ...

Unexpected EOF error occurred when parsing JSON data using AJAX, Javascript, and Servlet in a Java application

Currently, I am encountering an obstacle with my login request. The error message displayed is as follows: [object Object] parsererror SyntaxError: JSON Parse error: Unexpected EOF Despite successfully sending the request (as confirmed by the ...

Ways to effectively manage multiple asynchronous operations while retrieving emails and attachments using IMAP and JavaScript

Currently, I am utilizing the IMAP library along with JavaScript to retrieve emails from a server. This is my approach: Retrieve emails based on email address, subject, and a specified time frame. Determine the total number of emails received. For each e ...

Eliminate the JSON object within jqGrid's posted data

The web page I'm working on features Filters with two buttons that load data for jqGrid when clicked. Clicking 'Filter' generates a postData json object and sends it to the server, which is working perfectly. However, I'm facing an is ...

Modifying content on the fly with a dropdownlist in Knockout framework

Currently experimenting with implementing inline editing through knockout. I stumbled upon this informative thread about Knockout Inline Edit Binding After some tweaks to introduce a "Select" for edit mode, the functionality seems to be working fine. Howe ...

Tips for accessing the assigned variable within and outside of a function

Currently, I am working with Webdriverjs and facing an issue. I am trying to assign a variable in a function and then compare that result with some data retrieved from a csv file. However, I am encountering a problem where the value of the data from the ...

Choose a HTML element <a> containing a hyperlink reference and a nested child element <li>

Does anyone know of a way in javascript/css to select the (n) <li> in my code, while also specifying that the <li> must have a parent with the current <a> tag containing a specific href link? <a href="www.link.com">CATEGORY NAME& ...

Is the use of addEventListener("load",... creating an excessive number of XmlHttpRequests?

Consider a scenario where you have the following JavaScript code running in a Firefox plugin, aimed to execute an XmlHttpRequest on a page load: function my_fun(){ var xmlHttpConnection = new XMLHttpRequest(); xmlHttpConnection.open('GET', ...

Guide on concatenating the output values using jQuery

After selecting the matched records from the database, I returned to the previous page. Although I retrieved all the values, I am unsure how to append these return values on this page. What I need is to replace ROOM 2, Room 3... with the value in value.roo ...

Issue with React-Route not displaying components

Below is the code snippet from my app.js file: <Router> <Header title="My Todos List" /> <Routes> <Route path="/about" element={<About />} /> <Route path="/" ...

What solutions are available to resolve the routing problem in React.js?

On my fourth day working with Node and React.js, I am creating a custom offline search function for Docusaurus 2. I've built a JSON index and implemented a search function using elasticlunr. My goal is to redirect to a separate results page, but I&apo ...

Converting JSON-style data into a string with the power of node mysql

Just a quick note - I'm a total newbie in the world of web development, so I might be missing an obvious solution here. My challenge is to insert a dataset into a MySQL database using nodejs/expressjs/mysql. I've managed to establish a connecti ...

Looking to extract data from an HTML form?

In my HTML form, I am dynamically creating elements and setting their name and value attributes. When I try to access the value using document.formname.nameoftheelement.value, I receive an error stating that the value is undefined. I then attempted to us ...

Tips for postponing a function's execution in order to ensure it has completely loaded

I am facing an issue with a dynamic page that is populated by an ajax call. Here is the current code snippet: function loadPage() { var container = document.querySelector(".container"); var xhr = new XMLHttpRequest(); xhr.open('GET ...

What could be the reason for my function not being executed in this particular scenario with my calculator HTML code?

Memory = "0"; Current = "0"; Operation = 0; MAXLENGTH = 30; alert("yea"); function AddDigit(digit) { alert("yea"); if (Current.length > MAXLENGTH) { Current = "Aargh! Too long"; } else { if (eval(Current) == 0) { Current = dig; ...

Obtain additional information to address concerns related to onZoom and onPan issues on the line

Attempting to enhance my Chart.js line chart by fetching more data or utilizing cached backup data during onZoom/onPan events has proven quite challenging. The original code base is too intricate to share entirely, but I will outline the approaches I have ...

Show a list of checkbox options excluding the item that was chosen in the dropdown menu

I have a dropdown list of items and a popup (using colorbox for opening popup) with a list of checkboxes. The popup appears when '+Add/Edit' is clicked. Both the dropdown items and the checkboxes are generated dynamically in PHP from a complaint. ...

Wondering how to optimize FullCalendar for mobile and touch events?

I am looking to incorporate a drop event feature into the mobile version of fullcalendar. To achieve this, I am utilizing Jquery UI Touch Punch. After researching on various platforms such as Stack Overflow 1, Stack Overflow 2, Stack Overflow 3, Stack Ove ...