Added SetIdentity method

This commit is contained in:
Paolo Cignoni 2006-09-21 18:09:34 +00:00
parent eb6d41150e
commit d8b56cedb1
1 changed files with 15 additions and 0 deletions

View File

@ -22,6 +22,10 @@
****************************************************************************/
/***************************************************************************
$Log: not supported by cvs2svn $
Revision 1.9 2006/09/11 16:11:39 marfr960
Added const to declarations of the overloaded (operators *).
Otherwise the * operator would always attempt to convert any type of data passed as an argument to Point3<TYPE>
Revision 1.8 2006/08/23 15:24:45 marfr960
Copy constructor : faster memcpy instead of slow 'for' cycle
empty constructor
@ -635,6 +639,17 @@ namespace vcg{
_data[i] = ScalarType(0.0);
};
/*!
* Set the matrix to identity.
*/
void SetIdentity()
{
assert(_rows==_columns);
for (unsigned int i=0; i<_rows; i++)
for (unsigned int j=0; j<_columns; j++)
_data[i] = (i==j) ? ScalarType(1.0) : ScalarType(0.0f);
};
/*!
* Set the values of <I>j</I>-th column to v[j]
* \param j the column index