Creating a three.js lathe object using SVG spline with a Bézier curve

  • For my new game project, I am currently designing a replica of the iconic theme building located at LAX airport.

I am exploring methods to transform an svg spline (featuring Bézier curves) into a lathe object within three.js. Is there a reliable way to accomplish this?

  • Utilizing a 3D modeller to create the model is not feasible for me since I am implementing continuous Level of Detailing (LOD) and aiming to minimize server data transmission.

Answer №1

When it comes to transmitting data from the server to the client, the most efficient method would be:

  1. Sending your spline/curve to the client from the server
  2. Converting the curve to a polygon on the client side
  3. Creating a Lathe from the polygon in the client-side code

To start this process, you'll need to transform your SVG spline into a polygon, which will then be utilized in Three.js as a Lathe Geometry.

The amount of data involved depends on the level of accuracy needed for your curve-to-polygon conversion (the number of samples/divisions used during the conversion). Since this task can be handled by the client side (refer to the code snippet below), the data volume should not raise concerns.


  • For guidance on creating a Lathe Geometry from multiple points, check out this answer

  • If you're looking to convert an SVG curve into a series of points, use the following code snippet:

    // Function to convert path to polygon
    function pathToPolygon(path, samples) {
    // Code implementation here
    }
    

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

Needing to utilize the provide() function individually for every service in RC4

In Beta, my bootstrapping code was running smoothly as shown below: bootstrap(App, [ provide(Http, { useFactory: (backend: XHRBackend, defaultOptions: RequestOptions, helperService: HelperService, authProvider: AuthProvider) => new CustomHt ...

Issue arises when using Ionic 7 tabs with standalone Angular components

Hey, I'm new to Ionic and trying to learn it. However, all the courses available are on the old versions 5 or 6. I attempted to learn it with Angular standalone but it didn't turn out as I expected. The new way of routing wasn't working for ...

Utilizing $templateCache with ui-router and minifying in AngularJS 1.x

Posting this as a question-answer post. How can one effectively utilize the $templateCache in the templateProvider of a route within ui-router when attempting to refactor the code? Injection is ineffective, and Angular cannot inject by reference. For ins ...

Retrieving information from Flask server using an Ajax request

Exploring Flask and Ajax, my server-side web application is meant to double and return a passed number. I adapted the code from the example on Flask's site, resulting in this Python snippet: from flask import Flask, request, jsonify # Initialize the ...

Ways to test the initial launch of an Android application using Cordova

I am developing an Android application using Cordova. My app consists of multiple pages, with the main homepage being index.html. I need to determine if it is the first time a user lands on the homepage after opening the app, regardless of how many times ...

``Changing the value of the radio button does not update the ng-model variable

I have encountered an issue with my code. Upon page load, the radio button is checked but the ng-model value session.payment does not get updated automatically. I have to manually select it again for the update to take effect. <li ng-repeat="method i ...

JavaScript now has Type Inference assistance

When attempting to utilize the Compiler API for processing JavaScript code and implementing Type inference to predict types of 'object' in a 'object.property' PropertyAccessExpression node, I encountered some issues. Some simple example ...

Why doesn't AngularJS validation function properly with input elements of type "number"?

Struggling with Angularjs validation here. Ng-pattern seems to work fine only when the input type is text. However, when the input type is number, ng-pattern doesn't seem to work, although required, min, and max attributes still function. <input t ...

The Node js server operates by passively listening for incoming connections rather than actively establishing them

I have been working on setting up a node.js server to send emails to a specific email address using the sendgrid API. Everything was working perfectly until I attempted to deploy the server on Heroku. After deployment, the terminal shows that the server ...

An error arises when using the command window.close()

I have encountered an issue with this code where it closes all Safari windows but works fine in Internet Explorer. What should I do? Is there an alternative method for closing the current opened window in every browser? <input type='button' v ...

The three.js plugin is not loading in tern.js

Issue I am currently in the process of developing a 3D web application using three.js. For my development environment, I have opted to use neovim and YouCompleteMe for code completion. To enable JavaScript completion, I have installed tern and created a ...

Displaying only the final item from an array when clicking in an ng-repeat loop

My objective is to display the details of each value from my data in a pop-up window. However, instead of showing three different values, the pop-up only displays the last value from an array three times. This is the HTML code I am using: <div ng-re ...

Transform identical words in a website's content into clickable buttons

I'm currently in the process of developing a Chrome extension that scans a website for specific keywords and then converts them into interactive buttons. However, I've encountered an issue where changing the text causes the image path to become c ...

Attempting to obtain a score value from the input, but unsuccessful in doing so

Prior to posing this question, I had already managed to successfully retrieve the score value. Below is my original script: <script> $.ajax({ type: "POST", url: "https://example.com/paylist.php?acc=useraccount&json=1", ...

Tips on preventing the need for null or undefined checks in JS/Typescript singletons that have an initialization function

Is there a way to streamline the process of handling props in an Object literal that is dynamically initialized only once? I'm looking for a pattern that would eliminate the need for repetitive null/undefined checks and throw errors when certain metho ...

Issue: Unable to assign headers once they have already been sent to the client

As a newcomer to the world of Node.js, I am facing some challenges. Currently, my setup includes Node.js 4.10 and Express 2.4.3. Whenever I attempt to access , I get redirected to . This redirection triggers the following error: Error: Headers cannot b ...

jQuery blueimp File Uploader: Transferring multiple files to the server on Internet Explorer

After customizing the demo for my Rails application, I encountered an issue with the plugin in Internet Explorer. While it works smoothly on Chrome and Firefox, in IE (all versions) it fails to upload all but one file when multiple files are selected, and ...

Is AngularJS the right choice for developing this application?

Recently, I've come to the realization that I want to dive into the world of AngularJS framework after working with jQuery for several years. I have a vision of developing an application that allows users to easily modify webpage DOM using a browser- ...

Unable to send image file and string via XHR is causing issues

This task may seem straightforward, but I've been struggling with it for hours. My goal is to upload an image file along with stringified coordinates to crop the image on the server-side. Below is my client-side code: var formdata = new FormD ...

Determine the placement of a <div> based on information stored in localStorage

I'm diving into the world of localStorage and trying to figure out how it works. To get a better understanding, I decided to create an HTML page that allows users to drag and drop tiles around the screen. Here's a snippet of the code I came up ...