Determine a three-dimensional vector using a rotation and a different vector

Here's a challenging query for you. I'm currently utilizing three.js and facing the need to compute a specific vector.
Given one vector referred to as C and a rotation denoted as (r) in the form of an euler, I am now seeking to derive a second vector indicated as (X). This second vector should, when subtracted by itself with the applied euler rotation, result in the original vector C.
In essence, this can be represented as:

X - X(r) = C

Answer №1

  1. To transform the Euler angles, convert them into a 3x3 matrix using three.js. It's important to note that three.js utilizes Tait-Bryan angles instead of Proper Euler angles. Construct the necessary matrix R by combining these axis rotation matrices (refer to this link) in the order of Rz * Ry * Rx.

  2. Remember that X = I * X where I stands for the 3x3 identity matrix.

  3. The equation can be expressed as (I - R) * X = C, and is easily inverted as X = inverse(I - R) * C (Matrix3.getInverse).


UPDATE: steps to calculate R:

  • Utilize standard rotation matrices:

    https://i.sstatic.net/6mhd2.png

  • For the Euler angles euler = (x, y, z), the calculation becomes R = Rz(z) * Ry(y) * Rx(x):

    var c_x = Math.Cos(euler.x), s_x = Math.Sin(euler.x);
    var Rx = (new Matrix3()).set(
              1,   0,    0,
              0, c_x, -s_x,
              0, s_x,  c_x
             );
    // proceed likewise with Ry and Rz
    
  • Ultimately:

    var R = Rz.multiply(Ry.multiply(Rx));
    var ImR = (new Matrix3()).set(
               1.0 - R.elements[0], -R.elements[1], -R.elements[2],
               -R.elements[3], 1.0 - R.elements[4], -R.elements[5],
              -R.elements[6], -R.elements[7], 1.0 - R.elements[8]
              );
    // perform multiplication of ImR.getInverse() with C to derive X
    

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

express: how to differentiate routing path based on request parameters

Currently, I am working on an API that is designed to receive a specific value from an Android client and then provide back a list of posts. One interesting aspect of this API is the request value known as req.body.sortType, which influences how the list o ...

Substitute the Iframe element with Ajax technology

Currently, I am working on a project where I want to include previews of various websites within my own website. Right now, I am using Iframes to load the website previews and allow users to interact with them. For SEO purposes, I have decided to replace ...

Delete the last TD before adding the new element

Below is a snippet of jQuery code that I am working with: html += '<tr>'; html += '<td>AAA</td>'; html += '<td>BBB</td>'; html += '<td>CCC</td>'; html += '<td>DDD ...

Is there a way to delay the start of an ajax function until a few moments after the user

Good evening, I am interested in implementing a new feature using Ajax. Specifically, I would like to introduce a delay of 2 seconds after the user finishes typing before triggering the search function, as opposed to using "onkeyup". Note: This modificati ...

Using R to extract the citation of a scholarly article for export

I need R to: Visit THIS page. Choose "Bibtex" as the format and select "Citation and Abstract" for the "Export type". Click on "Submit" and save the citation file to a specific folder. Is this achievable with R? How can I accomplish this task without ...

Unable to access child props in parent event handler in React

Currently utilizing React for building a UI, the structure involves a parent component and a child component as shown below: // Child Component var ListItem = React.createClass({ render: function() { var link_details = ( <div> ...

Failure of $.post to activate the function

I'm really struggling to understand why the alert or console.log functions are not being triggered in this snippet of code: $.post("http://localhost:8080/mail", jsonObject, function(data) { ...

Can data sent to unauthenticated (angularFire) clients in firebase be limited or restricted in any way?

Using angularFire, I am fetching data in my project: angular.module('FireApp', ['firebase']) .controller('Document', function($scope, $routeParams, angularFire){ var url = "https://my-account.firebaseio.com/test" + "/" ...

Ways to delay the execution of a loop using setTimeout or setInterval

In my code, I have an array named RotatorNames which includes different elements. Let's say it currently includes ["rotatorA","rotatorB","rotatorC"]. My goal is to loop through this array and trigger a click event for each item. While I have made pro ...

Utilizing a custom keyboard with Jquery for a recurring function

It seems like I might be missing something simple here, as I am following the code tutorial provided in the link below: The goal of this project is to create a popup keyboard for a touch screen. Although I have made some modifications for specific purpose ...

What is the best way to access a specific item within a Json object in a React component?

I am facing an issue where I receive a JSON object from my express backend in my react application, but I am unable to access the username property. I need to retrieve the value stored in the username field. After storing the JSON object in my react state ...

ReactJS attempting to invoke a class function using a dynamically generated button

When attempting to access the deletePost(index) method from the ShowPost class using a dynamically rendered button within the render() step in React, I encounter an issue. The button labeled "click me" successfully retrieves and prints the first item in my ...

JavaScript is having trouble with the custom attribute (data-) in HTML and it is not functioning

I created a select bar with multiple options to help me sort items, and I also wanted to add a feature where clicking the option again switches between ascending and descending order. Here is the HTML code snippet: <select name="theme" id="sortSelec ...

Tips for converting .WAV files to .MP3 format and streaming audio within a Meteor application

I have a function in my Meteor app that retrieves .wav data based on a text input. I now want to convert this .wav data into .mp3 format and play the audio within my app. How can I accomplish this? Meteor.call("watsonaudio",wusername,wpassword,text, funct ...

The jQuery spoiler functionality is rather basic and only partly functional

I decided to create a very basic jQuery spoiler feature by using the code below: HTML: <a href="" onclick="return false" class="spoiler" content="spoiled content"> Reveal spoiler </a> jQuery / Javascript: $('a.spoiler').cli ...

Sending an array of dictionary objects to a JavaScript function

I have a situation where I need to pass a large amount of data stored in an NSArray containing NSDictionary objects to a JavaScript function using a webview and the method: - (NSString *)stringByEvaluatingJavaScriptFromString:(NSString *)script My inquir ...

Effortlessly uploading multiple files using Multer

Having trouble uploading multiple images using Multer? While everything seems to be in place, only the last file selected gets uploaded. Here is the HTML: <form class='new-project' action='/projects' method='POST' enctype ...

Vue.js fails to update view after file status changes

I am currently working with Vue.js and have the following code snippet: <div class="file has-name is-fullwidth is-light"> <label class="file-label"> <input class="file-input" ...

Ensure that all the checkboxes in a specific column are selected for every row within the gridview

I recently created a gridview with various columns, some of which are hidden boundfields and others that contain dynamically created templated fields with checkboxes. The number of checkbox columns varies depending on the query. Each checkbox in the heade ...

Iterate through nested objects in Javascript

I am having trouble extracting only the word from each new instance of the newEntry object. It shows up in the console every time I add a new word, but not when I assign it to .innerHTML. Can someone assist me with this issue? Full code: <style ty ...