# precision problems

## Recommended Posts

Im using the GLM library for my matrix transformation needs..

doing a quick test by just rotating a quad 90 degrees I come up with the following results

[img]http://i38.photobucket.com/albums/e121/evilnando/precision.png[/img]

##### Share on other sites
Brother Bob    10344
Kind of difficult to help when we have no clue what you're doing.

##### Share on other sites
oh code of course xD

[code]

glm::vec4 _vertices[] = { glm::vec4(-50.0f, -50.0f, 0.0f, 1.0f)
, glm::vec4(-50.0f, 50.0f, 0.0f, 1.0f)
, glm::vec4( 50.0f, 50.0f, 0.0f, 1.0f)
, glm::vec4( 50.0f, -50.0f, 0.0f, 1.0f) };

std::cout<<std::endl<<"Untransformed vertices"<<std::endl;

for (int _idx = 0; _idx < 4; _idx++)
{
std::cout<<"Vertex "<<_idx + 1<<" ";
std::cout<<"X: "<<_vertices[_idx].x<<" "
<<"Y: "<<_vertices[_idx].y<<" "
<<"Z: "<<_vertices[_idx].z<<std::endl;
}

glm::vec4 _translation_vector();

glm::mat4 _rotation_matrix = glm::rotate(glm::mat4(1.0f), _rotation, glm::vec3(0.0f, 0.0f, 1.0f));

for (int _idx = 0; _idx < 4; _idx++)
{
_vertices[_idx] = _rotation_matrix * _vertices[_idx];
}

std::cout<<std::endl<<"Transformed vertices"<<std::endl;

for (int _idx = 0; _idx < 4; _idx++)
{
std::cout<<"Vertex "<<_idx + 1<<" ";
std::cout<<"X: "<<std::setprecision(3)<<_vertices[_idx].x<<" "
<<"Y: "<<std::setprecision(3)<<_vertices[_idx].y<<" "
<<"Z: "<<std::setprecision(3)<<_vertices[_idx].z<<std::endl;
}

[/code]

##### Share on other sites
Brother Bob    10344
Looks like the rotation angle is in degrees but you pass the angle in radians.

nailed it !