Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

gunu::minbbox_rec Class Template Reference

utility class for finding a rotation, so that the volume of the bounding box of a set of points gets minimal volume. More...

List of all members.

Public Methods

 minbbox_rec (int anP, Ptr< point< T > > &aP, T theta0x, T theta0y, T theta0z)
volume (T theta_x, T theta_y, T theta_z)

Static Public Methods

minimize_about_z_cb (T theta, void *data)

Public Attributes

Ptr< point< T > > P
int nP
theta0_x
theta0_y
theta0_z


Detailed Description

template<class T>
class gunu::minbbox_rec< T >

utility class for finding a rotation, so that the volume of the bounding box of a set of points gets minimal volume.

this can be done much more optimal (by using RAPID's method for calculating oriented bounding boxes)!

Definition at line 353 of file gunu_mba_approximate.cpp.


Constructor & Destructor Documentation

template<class T>
gunu::minbbox_rec< T >::minbbox_rec int    anP,
Ptr< point< T > > &    aP,
  theta0x,
  theta0y,
  theta0z
[inline]
 

Definition at line 362 of file gunu_mba_approximate.cpp.

00363   {
00364     nP = anP; P = aP; 
00365     theta0_x = theta0x; theta0_y = theta0y; theta0_z = theta0z;
00366   }


Member Function Documentation

template<class T>
T gunu::minbbox_rec< T >::minimize_about_z_cb   theta,
void *    data
[inline, static]
 

Definition at line 396 of file gunu_mba_approximate.cpp.

References GULAPI.

00397   {
00398     minbbox_rec *m = (minbbox_rec *)data;
00399     return m->volume( (T)0, (T)0, theta );
00400   }

template<class T>
T gunu::minbbox_rec< T >::volume   theta_x,
  theta_y,
  theta_z
[inline]
 

Definition at line 367 of file gunu_mba_approximate.cpp.

00368   {
00369     mat4x4<T> m1 = mat4x4<T>::rotate_x(theta0_x + theta_x);
00370     mat4x4<T> m2 = mat4x4<T>::rotate_y(theta0_y + theta_y);
00371     mat4x4<T> m3 = mat4x4<T>::rotate_z(theta0_z + theta_z);
00372     mat4x4<T> m;
00373     m = m1 * m2 * m3;
00374     vec4<T> v,vt;
00375     T minx,maxx,miny,maxy,minz,maxz;
00376 
00377     v[0] = P[0].x;  v[1] = P[0].y;  v[2] = P[0].z;  v[3] = 1.0;
00378     vt = v * m;
00379     minx = maxx = vt[0];
00380     miny = maxy = vt[1];
00381     minz = maxz = vt[2];
00382 
00383     for( int i = 1; i < nP; i++ )
00384     {
00385       v[0] = P[i].x;  v[1] = P[i].y;  v[2] = P[i].z;  v[3] = 1.0;
00386       vt = v * m;
00387       if( vt[0] < minx ) minx = vt[0];
00388       else if( vt[0] > maxx ) maxx = vt[0];
00389       if( vt[1] < miny ) miny = vt[1];
00390       else if( vt[1] > maxy ) maxy = vt[1];
00391       if( vt[2] < minz ) minz = vt[2];
00392       else if( vt[2] > maxz ) maxz = vt[2];
00393     }
00394     return (maxx-minx)*(maxy-miny)*(maxz-minz);  /* volume */  
00395   }


Member Data Documentation

template<class T>
int gunu::minbbox_rec::nP
 

Definition at line 357 of file gunu_mba_approximate.cpp.

template<class T>
Ptr< point<T> > gunu::minbbox_rec::P
 

Definition at line 356 of file gunu_mba_approximate.cpp.

template<class T>
T gunu::minbbox_rec::theta0_x
 

Definition at line 358 of file gunu_mba_approximate.cpp.

template<class T>
T gunu::minbbox_rec::theta0_y
 

Definition at line 359 of file gunu_mba_approximate.cpp.

template<class T>
T gunu::minbbox_rec::theta0_z
 

Definition at line 360 of file gunu_mba_approximate.cpp.


The documentation for this class was generated from the following file:
Generated on Mon Jan 21 04:18:11 2002 for GUL 0.6 - Geometry Utility Library by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001