Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
Mathematical constructions, number systems. In 3D-graphics quaternions are used alongside vectors and matrices. One of the benefits of quaternions is that they overcome some rotational problems (known as gimbal locks) that are inherent to vectors and matrices.
1
vote
Accepted
Quaternions distorting object in Metal
So with that out of the way I actually did end up getting quaternion rotations to work:
mutating func quatRotate(_ angle: Float, _ axis: float3) {
var q = quaternion(angle: angle.toRadians, axis: axis …
0
votes
2
answers
347
views
Quaternions distorting object in Metal
= quaternion(angle: toRadians(0), axis: float3(0, 0, 1))
quaternion is just a typedef of simd_quatf
my rotate function is
mutating func rotate(_ quat: quaternion) {
let quatMatrix = matrix_float4x4 … (simd_normalize(quat))
self = matrix_multiply(self, quatMatrix)
}
I also tried to do it with the .act method
mutating func rotate(_ quat: quaternion, _ vec: float3) {
let rotatedVec = …
0
votes
1
answer
95
views
Yaw rotation not translating to Quaternion
I'm keeping total orientation in a quaternion and (trying to) update it with a rotation matrix constructed by forward, right, and up vectors. … = _check) {
_orientation = Quaternion.FromMatrix(mat) * _orientation;
}
_orientation.Normalize();
and then I update the orientation quaternion. …
1
vote
Yaw rotation not translating to Quaternion
Thanks to DMGregory for correcting my quaternion understanding. All is working fine now. … I just make a quaternion for pitch and yaw then multiply them with my existing oreientation quaternion like so:
// Values in _rotation are already converted to Radians.
var pitchQuat = new Quaternion(( …