Questions tagged [quaternions]

Unit quaternions are a mathematical representation of 3D rotations. They have 4 dimensions (one real and 3 imaginary) and can be represented as follows: a + i b + j c + k d or in terms of axis-angles: q = cos(a/2) + i ( x * sin(a/2)) + j (y * sin(a/2)) + k ( z * sin(a/2)) where: - a=angle of rotation. - x,y,z = vector representing axis of rotation.

Filter by
Sorted by
Tagged with
0 votes
0 answers
49 views

Scene Kit Rotation - rotating around X and Y axis only, causing Z rotation

I am trying to control the orientation of a box in Scene Kit (iOS) using gestures. I am using the translation in x and y to update the x and y rotation of the SCNNode. After a long search I have ...
Marcus Raty's user avatar
0 votes
0 answers
12 views

Difference of two Quaternion

I want to calculate the difference of one List of four quaternions(sample quaternions) to a set of 4x5 quaterions(reference quaternions), please find below the given lists as an example: ...
GaTe's user avatar
  • 23
0 votes
1 answer
75 views

Mapping a C-style quaternion with different storage order with Eigen Quaternion Map

I am trying to map a C-style array which in my application represents a quaternion with components storage order w, x, y, z using an Eigen::Map<Quaternion>. The problem is that internally Eigen ...
giafranchini's user avatar
0 votes
0 answers
10 views

Quaternion vs Axis + Angle in terms interpolation

Quaternion is kind of defining rotation axis by it's XYZ components / divided by sin(angle/2), so it's seems to be very similar to Axis+Angle in that sense. Though when we interpolate between axis+...
FamousSnake's user avatar
0 votes
0 answers
9 views

Quaternion camera stretching object

I've been implementing camera movement using quaternions. Im making a game where you have a plane in front of you and you fly around but when you apply yaw the object just stretches almost infinitely ...
blov's user avatar
  • 1
0 votes
0 answers
63 views

Spherical interpolation between two points in GLM for OpenGL

I'm trying to interpolate between two points on a sphere to make a simple camera following an arc. Quaternions are utterly incomprehensible to me, so I've been trying to hack something together ...
Andriy Sultanov's user avatar
0 votes
1 answer
51 views

convert mpu6050 euler angle (order xyz) from quaternion

I use the dmp of the Mpu6050 chip to read quaternions and convert them to Euler Angle (zyx) very well. pitch and roll angles do not drift over long periods of time. But when I use the same quaternion ...
xuanzhuang chen's user avatar
0 votes
1 answer
100 views

Convert Threejs quaternion to DXF insert normal and angle

I’m trying to convert a THREE.Object3D quaternion to and insert normal vector and rotation for use in a DXF drawing. Below is partially working code. The insert vector seems to be calculated correctly ...
Immugio's user avatar
  • 526
-1 votes
1 answer
60 views

I'm almost there? 4 DOF robot arm forward kinematics

I started a project to learn the forward kinematics of a custom 4 DOF robot arm I made. Essentially, I wanted to learn the basics to apply them to learning inverse kinematics fingers crossed. I cannot ...
Ponderer's user avatar
0 votes
1 answer
25 views

How to make FromToRotation end with a desired up vector, similar to when using LookRotation?

Use case: Translating the motion-tracking-detected player's shoulder, elbow, and wrist position into an in-game avatar. Instead of taking each position as ground truth or using IK, I want the relative ...
pete's user avatar
  • 1,898
1 vote
0 answers
91 views

2D Compass heading from AbsoluteOrientationSensor quaternion for the normal to the back of the smartphone. Gimbal lock issue

I need to get the angle of rotation of the smartphone(device) with respect to north(0 - 360 degrees) I am interested in the angle from the normal, from the back cover of the device (where the camera ...
WSA's user avatar
  • 43
1 vote
0 answers
93 views

Converting quaternions to angles for a 3D editor

I have a 3D map editor and the objects are rotated using a quaternion, but also the user has the ability to set angles using a textbox. I need to correctly convert from angles to quaternion and back I ...
Lagerat's user avatar
  • 11
1 vote
2 answers
129 views

In Unity, make an object rotate between two angles that are greater than 180 degrees

I am trying to simulate a robotic arm in Unity. I am avoiding super expensive addons (500+ euro) that implement these features by default, so I got to somehow manage on my own or with a little bit of ...
Aias Sotiropoulos's user avatar
0 votes
0 answers
20 views

Representing Spherocylinder (capsule) in Paraview

I am trying to render spherocylinders (Capsules, pills, E.coli) in Paraview. I am trying to understand how the author [https://discourse.paraview.org/t/tensor-glyph-and-other-quadrics-than-ellipsoids/...
Andres Valdez's user avatar
0 votes
1 answer
50 views

Slerp on 2 quaternions vs the multiplication of "s"lerp of per-axis quaternions

I split a quaternion into 3 rotations, and interpolate those, and multiply to merge the result, I don't get the same as spherically interpolating the non-split quaternions. var quat_A_full = ...
Spectraljump's user avatar
  • 4,249
0 votes
1 answer
79 views

Python division of small floats in quaternion calculations

Consider the math equation: y = (sin(x/2)/x) which shows up in the calculation of rotations. In the limit as x->0 this has a value of 1/2. Implementing this in Python (or any language with ...
user22524802's user avatar
0 votes
2 answers
44 views

Computing quaternion in three.js to orient object to target direction and normal

I have a box object that I am using as an instance mesh in THREE.JS and I'm creating a transformation matrix to move each instance to a different position and orientation. I am currently facing a ...
leonidasarch's user avatar
0 votes
0 answers
13 views

Unity - How come the AutoRotate() is smoother than ManualRotate()

The methods work but ManualRotate() is shaky and does not stay centered unlike AutoRotate() which is stable, no shake, and orbits around target. What am I doing wrong? I just want the same effect as ...
WokerHead's user avatar
  • 947
0 votes
0 answers
25 views

C++ quaternion chaos warping glitch

I am making a "retro" 3D engine for a flight simulator and I implemented quaternions to avoid gimbal lock, but if the angle is big the vertices start to make weird things, and by big i mean ...
Garlic bread's user avatar
0 votes
1 answer
79 views

How to swap the roll and pitch of a quaternion?

I'm writing code that receives quaternion values that are used to rotate a 3D model. To display the model with the correct rotation, though, I'll need to swap the roll and pitch (rotation about the x ...
Epsilon's user avatar
  • 1,026
0 votes
0 answers
27 views

Implementing my own arrow helper in Three.js

I would like to be able to draw arrows in Three.js with variable thickness, possibly with other customizations. As far as I have found from searching, this cannot easily be done with ArrowHelper, so ...
Addem's user avatar
  • 3,693
0 votes
0 answers
35 views

How to negative the yaw of a quaternion

I'm writing code that receives quaternion values that are used to rotate a 3D model. To display the model with the correct rotation, though, I'll need to negate the yaw (rotation about the z axis). ...
Epsilon's user avatar
  • 1,026
-1 votes
1 answer
134 views

How to fix ModuleNotFoundError: No module named 'quaternion' problem?

I have downloaded the code for Ronin algorithm implementation from Sachini/ronin . While trying to run it with the command python ronin_resnet.py --mode train --train_list <path-to-train-list> --...
evening's user avatar
0 votes
0 answers
52 views

How to mathematically calculate Unity Quaternion Curve inSlope,outSlope

Quaternion curves are created in the .anim file when Animation Rotation is set to Quaternion interpolation in Unity. In general, the curve is created as a bezier curve, and it was confirmed that it is ...
TheIceMan0224's user avatar
0 votes
1 answer
64 views

Getting a specific portion of rotation in Unity

I'm trying to implement gear physics using Unity, but I've encountered an issue. I've written the following code for one gear to follow another gear. Quaternion targetRot = Quaternion.Inverse(...
Akuu's user avatar
  • 9
1 vote
0 answers
57 views

Three.js Cannon.js Cylinder rotates weirdly

I'm trying to use CANNON.js with three.js. All is working well with cube, sphere, and plane, but now when I try with Cylinder, it is rotating weirdly. I do NOT want to rotate the three.js object to ...
Halo's user avatar
  • 1,794
0 votes
0 answers
39 views

Shoulder orientation tracking with azurekinect python

I am working on finding arm orientation with Azure Kinect body tracking. So I have been working on finding the orientation angles of the shoulder. I have used a rotation matrix which has 3 vectors ( ...
Croma Warrior's user avatar
0 votes
1 answer
119 views

How does the 'QQuaternion' rotation work?

I noticed the difference in the rotation of the vector through the quaternion between the Qt library and other libraries. This is the Qt realization. QQuaternion QQuaternion::fromEulerAngles(float ...
Василий Марков's user avatar
0 votes
0 answers
37 views

Quaternion rotation in 3d not working as expected

I am trying to understand how quaternions work and what the proper approach would be to implement arbitrary rotations in three dimensions. I am using Vulkan and glm for rendering and 3d math resp. I ...
Plegeus's user avatar
  • 140
0 votes
0 answers
32 views

Phone device inclination using Euler angles

I am trying to track the inclination of a phone device during motorcycle rides. As I am using Expo, I use the library expo-sensors and DeviceMotion. From DeviceMotion I get rotation as Euler angles ...
michjea's user avatar
  • 115
0 votes
0 answers
24 views

three.js orbitcontrols.js wiht custom handleTouchMoveRotate()

im trying to get touch controls from https://threejs.org/docs/#examples/en/controls/OrbitControls to rotate over a camera axis with quaternions. this gives no errors, it is not changing the camera ...
cubesareneat's user avatar
0 votes
0 answers
147 views

MPU6050 Quaternion calculation with stm32

I've been interested in mpu6050 for a while. I can read gyro data but i need help how to convert it to quaternion. This is pretty easy on Arduino, jrowberg's library is really great. But i am working ...
f.cerkesli's user avatar
0 votes
1 answer
91 views

How to obtain the derivative of a conjugated quaternion?

I'm currently currently stuck at obtaining the derivative of a pure yaw conjugated quaternion, what I mean by this is the following: The previous image is my attempt at finding the answer. However, ...
Gustavo_OL's user avatar
0 votes
0 answers
165 views

micropython qmi8658 exposing the AttitudeEngine quaternion

I'm trying to expose the AttitudeEngine quaternion on the QMIi8658 mentioned in the documentation. It's part of the WaveShare RP2040-Touch-LCD-1.28 module. Their original demo sketch exposes the ...
Victor Lazaro's user avatar
3 votes
1 answer
427 views

Calculating Euler angles from Rotation matrix in C++

I have this code in Python: from scipy.spatial.transform import Rotation r = Rotation.from_matrix(R) angles = r.as_euler("zyx",degrees=True) print(f'angles = {angles}') Where R is 3x3 ...
Eugene Alexeev's user avatar
0 votes
0 answers
79 views

How to convert quaternion between coordinate systems

I have a quaternion, coming from a system with the following: (Unity) Left-handed. Forward direction: Z axis Right direction: X axis Up direction: Y axis I need to convert this into a coordinate ...
AndrewMulti's user avatar
3 votes
1 answer
124 views

How to convert the quaternion to euler angles in EKF filter?

I am using the extended kalman filter and trying to find the orientation from the mag, accel and gyr. I get the quaternion, but I want to convert it to euler angles. How should I do that? should I ...
SAHAR GOHARSHENASAN's user avatar
0 votes
0 answers
72 views

How can I combine an initial angular velocity and angular acceleration to obtain a final rotation?

I am attempting to model the rotation of a soccer ball for a game I'm working on. Specifically, I have the initial rotation as a quaternion and the initial angular velocity and angular acceleration in ...
John Doe's user avatar
0 votes
1 answer
45 views

Blocking the movement of the gyroscope along the Y axis (Unity)

I'm making a game where by tilting my smartphone I can rotate an object in the z-axis. I made sure that the rotation is correct at different angles of the smartphone, but the problem is that if you ...
Operator's user avatar
0 votes
0 answers
42 views

3D rotation in Python given two sets of vectors

I have two set of vectors where the first is a rotated version of the second. I want to align them together and find the rotation matrix which satisfies it. The best way I found so far is scipy....
ofir1080's user avatar
  • 125
0 votes
1 answer
104 views

Is there a bug in the cgmath Rust library?

I'm making a ray tracer, and I have a function that does some math with Matrix4s. I've noticed that the outputs are wildly incorrect, and I'm just using the out-of-the-box cgmath functions. pub fn ...
Question Asker's user avatar
0 votes
1 answer
127 views

Pyqtgraph GLMeshItem set rotation with quaternion

I'm working on a real-time visualization for IMU data. The idea is to display a 3D object and update its attitude from the IMU data. From the IMU, I get the quaternion representing the device's ...
Yaxit's user avatar
  • 177
0 votes
0 answers
52 views

Reading rotation values, applying them to GameObjects in Unity and reading them back gives different results

I am creating a road editor in Unity. I have the data of each road segment that comes after another stored in a text file. It also includes 0-360° values for the segments rotation. For example, the ...
doc4's user avatar
  • 3
0 votes
0 answers
132 views

Rotating the player beyond 360 degrees, 90 degrees at a time (Unity)?

So I am Somewhat new to coding (Started last year) so I might get a few things wrong or confused, I apologize preemptively. I am trying to rotate my player in the same way the game series "Etrian ...
JadeAutumn's user avatar
1 vote
0 answers
63 views

How OpenSFM is calculating the computed_rotation field for openstreetmap streetview images?

When the spherical images uploaded by mapillary to openstreetmap, it attaches fields to the images like computed_rotation, computed_altitude, computed_camera. In documentation, its mentioned that ...
Rishabh Kumar's user avatar
1 vote
0 answers
20 views

How do I detect movement direction based on deltas and forward rotation?

I need to determine if an object/player is moving left or right (using math, this isn't necessarily a coding question). I'm working with a UGC game system that provides no events for movement and no ...
Wahlbeck Warforge's user avatar
1 vote
0 answers
55 views

How do I convert a rotation described by three coordinates into a quaternion?

Question: I have a 3D rotation specified by three coordinates. How do I transform this into a CannonJS quaternion to physically rotate the body? // I saw this online: var qX = new CANNON.Quaternion() ...
Jason Roman's user avatar
0 votes
1 answer
47 views

Changing the angle of rotation using a coroutine

I have a game object bg whose rotation in the z-axis can be controlled using the keys in the update method. I'm calculating the position of another object based on the rotation angle. using System; ...
Operator's user avatar
0 votes
0 answers
39 views

quaternion rotations and orientation at poles

I'm working in threejs, and I'm struggling to find a method to avoid "pole switching" when orienting an object to a target. Let’s say I have two moving Object3Ds, source and target, and I ...
stmaccarelli's user avatar
1 vote
0 answers
114 views

Opening doors in UNITY as in visage or amnesia

I'm attempting to replicate a comparable door opening style seen in games like Visage or Amnesia. So, if I approach a door and hold the mouse while dragging downwards (towards me), the door will open ...
Gan's user avatar
  • 53

1
2 3 4 5
30