### Post by inventordave on May 6, 2021 19:57:15 GMT

Hi!

I've returned to my raytracer to punch it up a bit. I am generating animation capabilities. The problem is, I have noticed when I apply rotation_x/y/z to an object's position, as multiple frames are produced, each showing a step-change in the position of the object (could be the Camera, same thing happens), as the object/camera rotates it's position through 360deg (simplest test scenario), there is a 'wobble'.

To give a specific example, I have an 'Earth' at the world origin, and my camera has it's TO paramter set to (0,0,0), obviously, so it is looking directly at the Earth.

Then, I apply rotation_x to the Camera's FROM parameter:

Unfortunately, and this is true for Shapes too when I am rotating their position (translation), the rotation around the axis is not smooth, with the Earth at the origin always appearing the same size (because it's always the same distance).

Instead while travelling in orbit around the 'Earth' at the centre, the distance between the origin and the camera shrinks, then expands, and so on.

I have generated a GIF of the animation, it's below.

Note, in case it's confusing, the Camera's POSITION is rotating around the x-axis, while the Earth is stationary at the World origin, but it is ALSO rotating, in-place, around the y-axis. Hence why the animation looks so mental. The embedded image is a GIF, you may have to manually play it, I don't know.

Why, when rotating position/translating an object is there a 'wobble' in the translated flight-path?? Obviously, rotating in-place (not modifying the position), it would be harder to detect a problem. For reference, here is my rotation_x() code:

What could possibly be wrong??

I've returned to my raytracer to punch it up a bit. I am generating animation capabilities. The problem is, I have noticed when I apply rotation_x/y/z to an object's position, as multiple frames are produced, each showing a step-change in the position of the object (could be the Camera, same thing happens), as the object/camera rotates it's position through 360deg (simplest test scenario), there is a 'wobble'.

To give a specific example, I have an 'Earth' at the world origin, and my camera has it's TO paramter set to (0,0,0), obviously, so it is looking directly at the Earth.

Then, I apply rotation_x to the Camera's FROM parameter:

`FROM = multiply_matrix_by_tuple(m().rotation_x(i2), FROM) // i2 is the number of radians`

setCamera() // regenerates the CameraTransform property

Unfortunately, and this is true for Shapes too when I am rotating their position (translation), the rotation around the axis is not smooth, with the Earth at the origin always appearing the same size (because it's always the same distance).

Instead while travelling in orbit around the 'Earth' at the centre, the distance between the origin and the camera shrinks, then expands, and so on.

I have generated a GIF of the animation, it's below.

Note, in case it's confusing, the Camera's POSITION is rotating around the x-axis, while the Earth is stationary at the World origin, but it is ALSO rotating, in-place, around the y-axis. Hence why the animation looks so mental. The embedded image is a GIF, you may have to manually play it, I don't know.

Why, when rotating position/translating an object is there a 'wobble' in the translated flight-path?? Obviously, rotating in-place (not modifying the position), it would be harder to detect a problem. For reference, here is my rotation_x() code:

`// the Array type is used to represent matrices ([r][c])`

Array.prototype.rotation_x = function(r, dir) {

var m = identity_matrix()

var cos = Math.cos(r)

var sin = Math.sin(r)

m[1][1] = cos

m[1][2] = -sin

m[2][1] = sin

m[2][2] = cos

if (dir)

m = inverse(m)

return m_multiply(this, m)

}

// Used as so:

m().rotation_x(radians) // m() returns an identity matrix, pseudonym for identitiy_matrix()

What could possibly be wrong??