Tag Info

New answers tagged

0

When you create a rotation matrix or quaternion from an angle, you are actually taking the sine and cosine of a numeric value in radians. Your value in degrees is being converted to radians, so 90 degrees becomes π/4. π is not something that can be represented accurately in floating point. This is where the accuracy loss is coming from. If you take the ...


1

Floating point math is not perfect. You're trying to compress an infinite set (all real numbers) into an extremely finite space (32 bits). Consequently, not every number can be accurately represented, and some numbers will suffer from rounding error. Basically, as you do increasingly more math on some particular value, you increase the chance(*) that the ...


0

So there is a DirectX library called the DirectX Tool Kit which is a porting of the underlying XNA code written by people who were members of the XNA team. Below is the code relevant to you question. SpriteBatch.cpp PrepareForRendering() // Set the transform matrix. XMMATRIX transformMatrix = (mRotation == DXGI_MODE_ROTATION_UNSPECIFIED) ...


1

Three.JS has a function for this based upon this principle. BTW Matrix4x4 are represented internally as Column-Major, not sure what bullet uses. Three.js Matrix4x4.makeRotationFromQuaternion(Quaternion) makeRotationFromQuaternion: function ( q ) { var te = this.elements; var x = q.x, y = q.y, z = q.z, w = q.w; var x2 = x + x, y2 = y + y, z2 ...


2

To succinctly answer the "why" question, it's because a 4x4 matrix can describe rotation, translation, and scaling operations all at once. Being able to describe any of these in a consistent manner simplifies a lot of things. Different kinds of transformations can be more simply represented with a different mathematical operations. As you note, ...


0

I had to call glUseProgram(program) before glUniformMatrix4fv() or any other uniform call.


1

This sounds similar to polyomino puzzle solving, which I've played with... With a 10 x 10 grid, you can reasonably do an exhaustive search for each shape. Starting from the top left, and going to the lower right, try to set the shape onto the grid. If it contradicts one of the known misses, discard it. If it overlaps some of the known hits, rank it as more ...



Top 50 recent answers are included