Alien-FreeImage

 view release on metacpan or  search on metacpan

src/Source/OpenEXR/Imath/ImathMatrixAlgo.h  view on Meta::CPAN

//  transformation matrices (Imath::Matrix33 and Imath::Matrix44).
//  The assumption made is that these functions are called much less
//  often than the basic point functions or these functions require
//  more support classes.
//
//  This file also defines a few predefined constant matrices.
//
//-------------------------------------------------------------------------

#include "ImathExport.h"
#include "ImathMatrix.h"
#include "ImathQuat.h"
#include "ImathEuler.h"
#include "ImathExc.h"
#include "ImathVec.h"
#include "ImathLimits.h"
#include "ImathNamespace.h"
#include <math.h>

IMATH_INTERNAL_NAMESPACE_HEADER_ENTER

//------------------
// Identity matrices
//------------------

IMATH_EXPORT_CONST M33f identity33f;
IMATH_EXPORT_CONST M44f identity44f;
IMATH_EXPORT_CONST M33d identity33d;
IMATH_EXPORT_CONST M44d identity44d;

//----------------------------------------------------------------------
// Extract scale, shear, rotation, and translation values from a matrix:
// 
// Notes:
//
// This implementation follows the technique described in the paper by
// Spencer W. Thomas in the Graphics Gems II article: "Decomposing a 
// Matrix into Simple Transformations", p. 320.
//
// - Some of the functions below have an optional exc parameter
//   that determines the functions' behavior when the matrix'
//   scaling is very close to zero:
//
//   If exc is true, the functions throw an Imath::ZeroScale exception.
//
//   If exc is false:
//
//      extractScaling (m, s)            returns false, s is invalid
//	sansScaling (m)		         returns m
//	removeScaling (m)	         returns false, m is unchanged
//      sansScalingAndShear (m)          returns m
//      removeScalingAndShear (m)        returns false, m is unchanged
//      extractAndRemoveScalingAndShear (m, s, h)  
//                                       returns false, m is unchanged, 
//                                                      (sh) are invalid
//      checkForZeroScaleInRow ()        returns false
//	extractSHRT (m, s, h, r, t)      returns false, (shrt) are invalid
//
// - Functions extractEuler(), extractEulerXYZ() and extractEulerZYX() 
//   assume that the matrix does not include shear or non-uniform scaling, 
//   but they do not examine the matrix to verify this assumption.  
//   Matrices with shear or non-uniform scaling are likely to produce 
//   meaningless results.  Therefore, you should use the 
//   removeScalingAndShear() routine, if necessary, prior to calling
//   extractEuler...() .
//
// - All functions assume that the matrix does not include perspective
//   transformation(s), but they do not examine the matrix to verify 
//   this assumption.  Matrices with perspective transformations are 
//   likely to produce meaningless results.
//
//----------------------------------------------------------------------


//
// Declarations for 4x4 matrix.
//

template <class T>  bool        extractScaling 
                                            (const Matrix44<T> &mat,
					     Vec3<T> &scl,
					     bool exc = true);
  
template <class T>  Matrix44<T> sansScaling (const Matrix44<T> &mat, 
					     bool exc = true);

template <class T>  bool        removeScaling 
                                            (Matrix44<T> &mat, 
					     bool exc = true);

template <class T>  bool        extractScalingAndShear 
                                            (const Matrix44<T> &mat,
					     Vec3<T> &scl,
					     Vec3<T> &shr,
					     bool exc = true);
  
template <class T>  Matrix44<T> sansScalingAndShear 
                                            (const Matrix44<T> &mat, 
					     bool exc = true);

template <class T>  void        sansScalingAndShear 
                                            (Matrix44<T> &result,
                                             const Matrix44<T> &mat, 
					     bool exc = true);

template <class T>  bool        removeScalingAndShear 
                                            (Matrix44<T> &mat,
					     bool exc = true);

template <class T>  bool        extractAndRemoveScalingAndShear
                                            (Matrix44<T> &mat,
					     Vec3<T>     &scl,
					     Vec3<T>     &shr,
					     bool exc = true);

template <class T>  void	extractEulerXYZ 
                                            (const Matrix44<T> &mat,
					     Vec3<T> &rot);

template <class T>  void	extractEulerZYX 
                                            (const Matrix44<T> &mat,
					     Vec3<T> &rot);

template <class T>  Quat<T>	extractQuat (const Matrix44<T> &mat);

template <class T>  bool	extractSHRT 
                                    (const Matrix44<T> &mat,
				     Vec3<T> &s,



( run in 1.730 second using v1.01-cache-2.11-cpan-b50b6a40fd4 )