If the cylinder is rotated sequentially in the x, y, and z directions by different angles theta, what will be the final height on the y-axis of the cylinder?

When working with three.js, I encountered an issue where a cylinder created would default to being parallel to the y-axis. In this scenario, the height along the y-axis is designated as 'a'.

If I were to subsequently rotate the cylinder along the x, then y, and finally z axes by different theta values, what would be the resulting height along the y-axis for the cylinder (as shown in the code snippet below)?

I have attempted to solve this problem without success. Any insights or answers would be greatly appreciated. :)

cylinder.rotation.x = theta1;
cylinder.rotation.y = theta2;
cylinder.rotation.z = theta3;

Answer №1

If you're looking for a solution, one option is to post your query on a mathematics forum like math stack exchange. Alternatively, you can run the code snippet below by substituting your own values for X, Y, and Z. Let's say our cylinder has a height of 1.0 along the positive y axis in this scenario:

let x = 0.0;
let y = 1.0;
let z = 0.0;

let e = new THREE.Euler(theta1, theta2, theta3);
let p = new THREE.Vector3(x, y, z);
p.applyEuler(e);

console.log(e);

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

Functional Components embedded within class components

I am currently utilizing a class component that includes functions acting as components within my JSX. For example: class MyComponent extends React.Component { MySubComponent = (props) => { if (props.display) { return <p> ...

Leveraging ng-repeat within ng-view

I am facing an issue with using ng-repeat inside ng-view as the data is not being displayed. I have come across suggestions on forums to use a factory, but I am hesitant to utilize a service because my $scope data relies on $routeParams for querying. var ...

Why is my backend sending two Objects in the http response instead of just one?

When I receive data from my Django backend, sometimes instead of one object I get two objects within the HTTP response. This inconsistency is puzzling because it occurs intermittently - at times there's only one object, while other times there are two ...

When the "ok" button is clicked in a custom confirmation box, the function will return

When the first button is clicked, I validate certain text boxes and then call Confirm() to display a confirmation box. I want it to return true to the calling function when "ok" is clicked and for control to go back to the UI to proceed ...

CSS Text ellipsis displays only the beginning of each paragraph

I want to add ellipsis to a text, but it keeps including the first line of all paragraphs. What I actually need is for only the first line of the content to have the ellipsis applied. Here is an example of the content: When using websocket to send message ...

The particles from particles.js plugin fail to appear on Chrome browser

While experimenting with particles.js, I noticed that it runs smoothly on the Safari browser (I'm using a MacBook), but it encounters an error on Chrome and the particles fail to display. Error pJS - XMLHttpRequest status: 404 particles.js:1558 Error ...

Exploring the possibilities of combining OpenCV with web technologies like Javascript

I am currently faced with the challenge of integrating OpenCV into a web application using Express.js. While I am familiar with the Python and C++ libraries for OpenCV, I now need to work with it in conjunction with Express.js. My main requirements include ...

How to generate a nested <p> element in Jade JS without adding a line break at the

Looking for help with Jade JS! <div id="container"> Temperature<p id = "temp">00.00</p> </div> Specifically, how can I create a nested tag without a newline? I've attempted: // results in a newline #container p#temp ...

cross-domain ajax response

Imagine a unique scenario that will pique the interest of many developers. You have a JavaScript file and a PHP file - in the JS file, you've coded AJAX to send parameters via HTTP request to the PHP file and receive a response. Now, let's delve ...

"Table featuring rows that can be scrolled and a header that remains fixed in

I have implemented this code using this solution, but unfortunately, it doesn't seem to be working as expected. My requirements are : Scroll through the rows Keep the header fixed Ensure that the headers width matches the first TD row. Being new t ...

Issues with Login and Register functionality in a node.js application using MongoDB

I am facing an issue with my app.js. After registering for a new account, it should send the data to MongoDB and then take me directly to page2. However, instead of that, it redirects me back to the home page. Moreover, when I try to log in by entering my ...

What is the process for implementing the google maps API using an up-to-date version?

I have an application that utilizes Google Maps. To call in the library, I use the following script: src="https://maps.googleapis.com/maps/api/js?v=[VERSION]&key=[MYKEY]&sensor=false" Initially, everything ran smoothly for about a year ...

A method of iteration that allows us to traverse through an object, regardless of whether it contains a single item or an array of items, is known as dynamic looping

I am dealing with a JSON output that can have different types of data: There may be an array of objects like this: var data = { "EARNINGS": [ { "PAYMENT": "1923.08", ...

JavaScript timer that activates only on the initial occurrence

Is it possible to automatically execute a function 3 seconds after pushing a button? The code snippet below should do the job: button.onclick = setTimeout(yup,3000); The function being called is named yup. After the initial button click, the function tri ...

Combining specific columns in the user interface grid

I need to customize a UI grid by merging some middle columns to achieve the following layout: Name | Address | Comment | Job | College | Married ---------------------------------------------------------- Keshvi | India | New | Not applicable ...

What is the best way to narrow down a selection of elements in d3js?

I am trying to implement a feature where all elements below the one that is being hovered over will translate downwards. Currently, I am able to filter the selection using .filter for elements greater than 10. Is there a way to dynamically use the id of th ...

Ensure to preselect the radio button based on the Day's value

I have set up my Radio buttons with corresponding content to be displayed when clicked. I want to automatically pre-select the tab button based on the current day. For example, if today is Sunday, the page should load showing the contents for Sunday. If i ...

Setting the position of a tooltip relative to an element using CSS/JS

I'm struggling to make something work and would appreciate your help. I have a nested list of items that includes simple hrefs as well as links that should trigger a copy-to-clipboard function and display a success message in a span element afterwards ...

Using JavaScript to transform a string into a multidimensional array

I am currently working with sockets (server and client) and I have been attempting to send a matrix. My goal is to send a string array and then convert it into a variable called "ARRAY". For instance, if I want to send an array structured like this: edit ...

Transferring information between container and component with Meteor React

I'm facing a challenge with passing data from a container to a component in the context of Meteor and React. Despite following the steps in the Meteor React tutorial and making some customizations, the code doesn't seem to be working as expected. ...