Closed GoogleCodeExporter closed 9 years ago
sorry, "it actually fills one array of 12 elements" above..
Original comment by mihail.i...@googlemail.com
on 4 Nov 2010 at 12:34
btw, more functions depend on this 12 elements array.. patch were no problem,
but i'll check it again before i shall suggest one..
2 in btTransform:
/**@brief Set from an array
* @param m A pointer to a 15 element array (12 rotation(row major padded on the right by 1), and 3 translation */
void setFromOpenGLMatrix(const btScalar *m)
{
m_basis.setFromOpenGLSubMatrix(m);
m_origin.setValue(m[12],m[13],m[14]);
}
/**@brief Fill an array representation
* @param m A pointer to a 15 element array (12 rotation(row major padded on the right by 1), and 3 translation */
void getOpenGLMatrix(btScalar *m) const
{
m_basis.getOpenGLSubMatrix(m);
m[12] = m_origin.x();
m[13] = m_origin.y();
m[14] = m_origin.z();
m[15] = btScalar(1.0);
}
and one in btMatrix3x3 :
/** @brief Set from a carray of btScalars
* @param m A pointer to the beginning of an array of 9 btScalars */
void setFromOpenGLSubMatrix(const btScalar *m)
{
m_el[0].setValue(m[0],m[4],m[8]);
m_el[1].setValue(m[1],m[5],m[9]);
m_el[2].setValue(m[2],m[6],m[10]);
}
Original comment by mihail.i...@googlemail.com
on 4 Nov 2010 at 2:04
checked it, it is easy to fix it (use 9 elements array as OpenGL submatrix, for
upper 3x3), below preview how it looks like.... but is hard to recommend such
change... it may affect existing code somewhere and is doing the same... may be
just correct comments one day (9 element array mentioned many times)... for me
the issue can be closed... can work it around... thank you
Here how were :
for btTransform :
/**@brief Fill an array representation
* @param m A pointer to a 16 element array */
void getOpenGLMatrix(btScalar *m) const
{
btScalar basis[9];
m_basis.getOpenGLSubMatrix(basis);
m[0] = basis[0];
m[1] = basis[1];
m[2] = basis[2];
m[3] = btScalar(0.0);
m[4] = basis[3];
m[5] = basis[4];
m[6] = basis[5];
m[7] = btScalar(0.0);
m[8] = basis[6];
m[9] = basis[7];
m[10] = basis[8];
m[11] = btScalar(0.0);
m[12] = m_origin.x();
m[13] = m_origin.y();
m[14] = m_origin.z();
m[15] = btScalar(1.0);
}
and for btMatrix3x3 :
/** @brief Set from a carray of btScalars
* @param m A pointer to the beginning of an array of 9 btScalars */
void setFromOpenGLSubMatrix(const btScalar *m)
{
m_el[0].setValue(m[0],m[3],m[6]);
m_el[1].setValue(m[1],m[4],m[7]);
m_el[2].setValue(m[2],m[5],m[8]);
}
and
/**@brief Fill the values of the matrix into a 9 element array
* @param m The array to be filled */
void getOpenGLSubMatrix(btScalar *m) const
{
m[0] = btScalar(m_el[0].x());
m[1] = btScalar(m_el[1].x());
m[2] = btScalar(m_el[2].x());
m[3] = btScalar(m_el[0].y());
m[4] = btScalar(m_el[1].y());
m[5] = btScalar(m_el[2].y());
m[6] = btScalar(m_el[0].z());
m[7] = btScalar(m_el[1].z());
m[8] = btScalar(m_el[2].z());
}
Original comment by mihail.i...@googlemail.com
on 4 Nov 2010 at 3:04
comment has been clarified:
http://code.google.com/p/bullet/source/detail?r=2233
Original comment by erwin.coumans
on 12 Nov 2010 at 10:31
Original issue reported on code.google.com by
mihail.i...@googlemail.com
on 4 Nov 2010 at 12:32