Added a IPtoPfMatrix method to the grid class Returns the matrix that applied to a point in grid space transforms it in the original space.

This commit is contained in:
Paolo Cignoni 2014-04-17 08:17:08 +00:00
parent 612fd0d226
commit c085b7d6ba
1 changed files with 193 additions and 226 deletions

View File

@ -20,48 +20,7 @@
* for more details. *
* *
****************************************************************************/
/****************************************************************************
History
$Log: not supported by cvs2svn $
Revision 1.12 2008/02/19 12:43:01 callieri
in BestDim(...) changed int -> _int64 to cope with programs with a very large cell number (like plyMC)
Revision 1.11 2008/02/04 19:18:44 ganovelli
typo corrected
Revision 1.10 2006/08/23 15:21:35 marfr960
added some comments
Revision 1.9 2005/12/02 00:27:22 cignoni
removed excess typenames
Revision 1.8 2005/10/03 16:21:10 spinelli
erase wrong assert on boxToIbox function
Revision 1.7 2005/10/02 23:16:26 cignoni
English comment and moved typedef to public scope
Revision 1.6 2005/09/30 13:12:46 pietroni
basic grid class is derived from Indexing base class defined in base,h
Revision 1.5 2005/09/16 11:56:38 cignoni
removed wrong typename and added ending \n
Revision 1.4 2005/08/02 11:01:05 pietroni
added IPToP and IBoxToBox functions, modified BoxToIBox function in order to use PToIP function
Revision 1.3 2005/07/28 06:11:12 cignoni
corrected error in GridP (did not compile)
Revision 1.2 2005/07/01 11:33:36 cignoni
Added a class BasicGrid with some utility function that are scattered among similar classes
Revision 1.1 2005/03/15 11:43:18 cignoni
Removed BestDim function from the grid_static_ptr class and moved to a indipendent file (grid_util.h) for sake of generality.
****************************************************************************/
#ifndef __VCGLIB_GRID_UTIL
#define __VCGLIB_GRID_UTIL
@ -152,7 +111,15 @@ public:
p[2] = ((ScalarType)pi[2])*voxel[2];
p += bbox.min;
}
/* Returns the matrix that applied to a point in grid space
* transforms it in the original space.
*/
inline Matrix44<ScalarType> IPtoPfMatrix() const
{
Matrix44<ScalarType> m; m.SetScale(voxel);
Matrix44<ScalarType> t; t.SetTranslate(bbox.min);
return t*m;
}
/* Given a cell index return the corresponding box
* @param integer coordinates pi of the cell
* @return b is the corresponding box in <ScalarType> coordinates