Main Page | Directories | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

vtkMath Class Reference

#include <vtkMath.h>

Inheritance diagram for vtkMath:

Inheritance graph
[legend]
Collaboration diagram for vtkMath:

Collaboration graph
[legend]
List of all members.

Detailed Description

performs common math operations

vtkMath is provides methods to perform common math operations. These include providing constants such as Pi; conversion from degrees to radians; vector operations such as dot and cross products and vector norm; matrix determinant for 2x2 and 3x3 matrices; and random number generation.

Created by:
  • Schroeder, Will
CVS contributions (if > 5%):
  • Schroeder, Will (28%)
  • Gobbi, David (25%)
  • Martin, Ken (9%)
  • Henderson, Amy (5%)
CVS logs (CVSweb):
  • .cxx (/Common/vtkMath.cxx)
  • .h (/Common/vtkMath.h)
Examples:
vtkMath (Examples)
Tests:
vtkMath (Tests)

Definition at line 49 of file vtkMath.h.

Public Types

typedef vtkObject Superclass

Public Member Functions

virtual const char * GetClassName ()
virtual int IsA (const char *type)
void PrintSelf (ostream &os, vtkIndent indent)

Static Public Member Functions

vtkMathNew ()
int IsTypeOf (const char *type)
vtkMathSafeDownCast (vtkObject *o)
int Floor (double x)
void Cross (const float x[3], const float y[3], float z[3])
void Cross (const double x[3], const double y[3], double z[3])
float Normalize (float x[3])
double Normalize (double x[3])
float Distance2BetweenPoints (const float x[3], const float y[3])
double Distance2BetweenPoints (const double x[3], const double y[3])
float Normalize2D (float x[3])
double Normalize2D (double x[3])
int SolveLinearSystem (double **A, double *x, int size)
int InvertMatrix (double **A, double **AI, int size)
int LUFactorLinearSystem (double **A, int *index, int size)
double EstimateMatrixCondition (double **A, int size)
void RandomSeed (long s)
double Random ()
double Random (double min, double max)
double * SolveCubic (double c0, double c1, double c2, double c3)
double * SolveQuadratic (double c0, double c1, double c2)
double * SolveLinear (double c0, double c1)
int SolveLinear (double c0, double c1, double *r1, int *num_roots)
float Pi ()
float DegreesToRadians ()
float RadiansToDegrees ()
double DoubleDegreesToRadians ()
double DoublePi ()
double DoubleRadiansToDegrees ()
int Round (float f)
int Round (double f)
float Dot (const float x[3], const float y[3])
double Dot (const double x[3], const double y[3])
float Norm (const float *x, int n)
double Norm (const double *x, int n)
float Norm (const float x[3])
double Norm (const double x[3])
void Perpendiculars (const double x[3], double y[3], double z[3], double theta)
void Perpendiculars (const float x[3], float y[3], float z[3], double theta)
float Dot2D (const float x[3], const float y[3])
double Dot2D (const double x[3], const double y[3])
float Norm2D (const float x[3])
double Norm2D (const double x[3])
float Determinant2x2 (const float c1[2], const float c2[2])
double Determinant2x2 (double a, double b, double c, double d)
double Determinant2x2 (const double c1[2], const double c2[2])
void LUFactor3x3 (float A[3][3], int index[3])
void LUFactor3x3 (double A[3][3], int index[3])
void LUSolve3x3 (const float A[3][3], const int index[3], float x[3])
void LUSolve3x3 (const double A[3][3], const int index[3], double x[3])
void LinearSolve3x3 (const float A[3][3], const float x[3], float y[3])
void LinearSolve3x3 (const double A[3][3], const double x[3], double y[3])
void Multiply3x3 (const float A[3][3], const float in[3], float out[3])
void Multiply3x3 (const double A[3][3], const double in[3], double out[3])
void Multiply3x3 (const float A[3][3], const float B[3][3], float C[3][3])
void Multiply3x3 (const double A[3][3], const double B[3][3], double C[3][3])
void Transpose3x3 (const float A[3][3], float AT[3][3])
void Transpose3x3 (const double A[3][3], double AT[3][3])
void Invert3x3 (const float A[3][3], float AI[3][3])
void Invert3x3 (const double A[3][3], double AI[3][3])
void Identity3x3 (float A[3][3])
void Identity3x3 (double A[3][3])
double Determinant3x3 (float A[3][3])
double Determinant3x3 (double A[3][3])
float Determinant3x3 (const float c1[3], const float c2[3], const float c3[3])
double Determinant3x3 (const double c1[3], const double c2[3], const double c3[3])
double Determinant3x3 (double a1, double a2, double a3, double b1, double b2, double b3, double c1, double c2, double c3)
void QuaternionToMatrix3x3 (const float quat[4], float A[3][3])
void QuaternionToMatrix3x3 (const double quat[4], double A[3][3])
void Matrix3x3ToQuaternion (const float A[3][3], float quat[4])
void Matrix3x3ToQuaternion (const double A[3][3], double quat[4])
void Orthogonalize3x3 (const float A[3][3], float B[3][3])
void Orthogonalize3x3 (const double A[3][3], double B[3][3])
void Diagonalize3x3 (const float A[3][3], float w[3], float V[3][3])
void Diagonalize3x3 (const double A[3][3], double w[3], double V[3][3])
void SingularValueDecomposition3x3 (const float A[3][3], float U[3][3], float w[3], float VT[3][3])
void SingularValueDecomposition3x3 (const double A[3][3], double U[3][3], double w[3], double VT[3][3])
int InvertMatrix (double **A, double **AI, int size, int *tmp1Size, double *tmp2Size)
int LUFactorLinearSystem (double **A, int *index, int size, double *tmpSize)
void LUSolveLinearSystem (double **A, int *index, double *x, int size)
int Jacobi (float **a, float *w, float **v)
int Jacobi (double **a, double *w, double **v)
int JacobiN (float **a, int n, float *w, float **v)
int JacobiN (double **a, int n, double *w, double **v)
int SolveCubic (double c0, double c1, double c2, double c3, double *r1, double *r2, double *r3, int *num_roots)
int SolveQuadratic (double c0, double c1, double c2, double *r1, double *r2, int *num_roots)
int SolveHomogeneousLeastSquares (int numberOfSamples, double **xt, int xOrder, double **mt)
int SolveLeastSquares (int numberOfSamples, double **xt, int xOrder, double **yt, int yOrder, double **mt, int checkHomogeneous=1)
void RGBToHSV (float rgb[3], float hsv[3])
void RGBToHSV (float r, float g, float b, float *h, float *s, float *v)
void RGBToHSV (double rgb[3], double hsv[3])
void RGBToHSV (double r, double g, double b, double *h, double *s, double *v)
void HSVToRGB (float hsv[3], float rgb[3])
void HSVToRGB (float h, float s, float v, float *r, float *g, float *b)
void HSVToRGB (double hsv[3], double rgb[3])
void HSVToRGB (double h, double s, double v, double *r, double *g, double *b)
void UninitializeBounds (double bounds[6])
int AreBoundsInitialized (double bounds[6])
void ClampValue (double *value, const double range[2])
void ClampValue (double value, const double range[2], double *clamped_value)
void ClampValues (double *values, int nb_values, const double range[2])
void ClampValues (const double *values, int nb_values, const double range[2], double *clamped_values)

Protected Member Functions

 vtkMath ()
 ~vtkMath ()

Static Protected Attributes

long Seed


Member Typedef Documentation

typedef vtkObject vtkMath::Superclass
 

Reimplemented from vtkObject.

Definition at line 53 of file vtkMath.h.


Constructor & Destructor Documentation

vtkMath::vtkMath  )  [inline, protected]
 

Definition at line 564 of file vtkMath.h.

vtkMath::~vtkMath  )  [inline, protected]
 

Definition at line 565 of file vtkMath.h.


Member Function Documentation

vtkMath* vtkMath::New  )  [static]
 

Create an object with Debug turned off, modified time initialized to zero, and reference counting on.

Reimplemented from vtkObject.

virtual const char* vtkMath::GetClassName  )  [virtual]
 

Reimplemented from vtkObject.

int vtkMath::IsTypeOf const char *  type  )  [static]
 

Return 1 if this class type is the same type of (or a subclass of) the named class. Returns 0 otherwise. This method works in combination with vtkTypeRevisionMacro found in vtkSetGet.h.

Reimplemented from vtkObject.

virtual int vtkMath::IsA const char *  type  )  [virtual]
 

Return 1 if this class is the same type of (or a subclass of) the named class. Returns 0 otherwise. This method works in combination with vtkTypeRevisionMacro found in vtkSetGet.h.

Reimplemented from vtkObject.

vtkMath* vtkMath::SafeDownCast vtkObject o  )  [static]
 

Reimplemented from vtkObject.

void vtkMath::PrintSelf ostream &  os,
vtkIndent  indent
[virtual]
 

Methods invoked by print to print information about the object including superclasses. Typically not called by the user (use Print() instead) but used in the hierarchical print process to combine the output of several classes.

Reimplemented from vtkObject.

float vtkMath::Pi  )  [inline, static]
 

Useful constants.

Definition at line 58 of file vtkMath.h.

float vtkMath::DegreesToRadians  )  [inline, static]
 

Useful constants.

Definition at line 59 of file vtkMath.h.

float vtkMath::RadiansToDegrees  )  [inline, static]
 

Useful constants.

Definition at line 60 of file vtkMath.h.

double vtkMath::DoubleDegreesToRadians  )  [inline, static]
 

Useful constants. (double-precision version)

Definition at line 65 of file vtkMath.h.

double vtkMath::DoublePi  )  [inline, static]
 

Useful constants. (double-precision version)

Definition at line 66 of file vtkMath.h.

double vtkMath::DoubleRadiansToDegrees  )  [inline, static]
 

Useful constants. (double-precision version)

Definition at line 67 of file vtkMath.h.

int vtkMath::Round float  f  )  [inline, static]
 

Rounds a float to the nearest integer.

Definition at line 72 of file vtkMath.h.

int vtkMath::Round double  f  )  [inline, static]
 

Rounds a float to the nearest integer.

Definition at line 74 of file vtkMath.h.

int vtkMath::Floor double  x  )  [inline, static]
 

Definition at line 574 of file vtkMath.h.

Referenced by vtkUnstructuredGridPartialPreIntegration::Psi().

float vtkMath::Dot const float  x[3],
const float  y[3]
[inline, static]
 

Dot product of two 3-vectors (float version).

Definition at line 82 of file vtkMath.h.

double vtkMath::Dot const double  x[3],
const double  y[3]
[inline, static]
 

Dot product of two 3-vectors (double-precision version).

Definition at line 88 of file vtkMath.h.

void vtkMath::Cross const float  x[3],
const float  y[3],
float  z[3]
[inline, static]
 

Cross product of two 3-vectors. Result vector in z[3].

Definition at line 699 of file vtkMath.h.

void vtkMath::Cross const double  x[3],
const double  y[3],
double  z[3]
[inline, static]
 

Cross product of two 3-vectors. Result vector in z[3]. (double-precision version)

Definition at line 709 of file vtkMath.h.

float vtkMath::Norm const float *  x,
int  n
[static]
 

Compute the norm of n-vector.

Referenced by Normalize().

double vtkMath::Norm const double *  x,
int  n
[static]
 

Compute the norm of n-vector.

float vtkMath::Norm const float  x[3]  )  [inline, static]
 

Compute the norm of 3-vector.

Definition at line 107 of file vtkMath.h.

double vtkMath::Norm const double  x[3]  )  [inline, static]
 

Compute the norm of 3-vector (double-precision version).

Definition at line 113 of file vtkMath.h.

float vtkMath::Normalize float  x[3]  )  [inline, static]
 

Normalize (in place) a 3-vector. Returns norm of vector.

Definition at line 592 of file vtkMath.h.

References Norm().

double vtkMath::Normalize double  x[3]  )  [inline, static]
 

Normalize (in place) a 3-vector. Returns norm of vector (double-precision version).

Definition at line 606 of file vtkMath.h.

References Norm().

void vtkMath::Perpendiculars const double  x[3],
double  y[3],
double  z[3],
double  theta
[static]
 

Given a unit vector x, find two unit vectors y and z such that x cross y = z (i.e. the vectors are perpendicular to each other). There is an infinite number of such vectors, specify an angle theta to choose one set. If you want only one perpendicular vector, specify NULL for z.

void vtkMath::Perpendiculars const float  x[3],
float  y[3],
float  z[3],
double  theta
[static]
 

Given a unit vector x, find two unit vectors y and z such that x cross y = z (i.e. the vectors are perpendicular to each other). There is an infinite number of such vectors, specify an angle theta to choose one set. If you want only one perpendicular vector, specify NULL for z.

float vtkMath::Distance2BetweenPoints const float  x[3],
const float  y[3]
[inline, static]
 

Compute distance squared between two points.

Definition at line 676 of file vtkMath.h.

Referenced by vtkTriangle::TriangleArea().

double vtkMath::Distance2BetweenPoints const double  x[3],
const double  y[3]
[inline, static]
 

Compute distance squared between two points (double precision version).

Definition at line 684 of file vtkMath.h.

float vtkMath::Dot2D const float  x[3],
const float  y[3]
[inline, static]
 

Dot product of two 2-vectors. The third (z) component is ignored.

Definition at line 145 of file vtkMath.h.

double vtkMath::Dot2D const double  x[3],
const double  y[3]
[inline, static]
 

Dot product of two 2-vectors. The third (z) component is ignored (double-precision version).

Definition at line 152 of file vtkMath.h.

float vtkMath::Norm2D const float  x[3]  )  [inline, static]
 

Compute the norm of a 2-vector. Ignores z-component.

Definition at line 158 of file vtkMath.h.

Referenced by Normalize2D().

double vtkMath::Norm2D const double  x[3]  )  [inline, static]
 

Compute the norm of a 2-vector. Ignores z-component (double-precision version).

Definition at line 165 of file vtkMath.h.

float vtkMath::Normalize2D float  x[3]  )  [inline, static]
 

Normalize (in place) a 2-vector. Returns norm of vector. Ignores z-component.

Definition at line 620 of file vtkMath.h.

References Norm2D().

double vtkMath::Normalize2D double  x[3]  )  [inline, static]
 

Normalize (in place) a 2-vector. Returns norm of vector. Ignores z-component (double-precision version).

Definition at line 634 of file vtkMath.h.

References Norm2D().

float vtkMath::Determinant2x2 const float  c1[2],
const float  c2[2]
[inline, static]
 

Compute determinant of 2x2 matrix. Two columns of matrix are input.

Definition at line 179 of file vtkMath.h.

Referenced by Determinant3x3().

double vtkMath::Determinant2x2 double  a,
double  b,
double  c,
double  d
[inline, static]
 

Calculate the determinant of a 2x2 matrix: | a b | | c d |

Definition at line 185 of file vtkMath.h.

double vtkMath::Determinant2x2 const double  c1[2],
const double  c2[2]
[inline, static]
 

Calculate the determinant of a 2x2 matrix: | a b | | c d |

Definition at line 187 of file vtkMath.h.

void vtkMath::LUFactor3x3 float  A[3][3],
int  index[3]
[static]
 

LU Factorization of a 3x3 matrix. The diagonal elements are the multiplicative inverse of those in the standard LU factorization.

void vtkMath::LUFactor3x3 double  A[3][3],
int  index[3]
[static]
 

LU Factorization of a 3x3 matrix. The diagonal elements are the multiplicative inverse of those in the standard LU factorization.

void vtkMath::LUSolve3x3 const float  A[3][3],
const int  index[3],
float  x[3]
[static]
 

LU back substitution for a 3x3 matrix. The diagonal elements are the multiplicative inverse of those in the standard LU factorization.

void vtkMath::LUSolve3x3 const double  A[3][3],
const int  index[3],
double  x[3]
[static]
 

LU back substitution for a 3x3 matrix. The diagonal elements are the multiplicative inverse of those in the standard LU factorization.

void vtkMath::LinearSolve3x3 const float  A[3][3],
const float  x[3],
float  y[3]
[static]
 

Solve Ay = x for y and place the result in y. The matrix A is destroyed in the process.

void vtkMath::LinearSolve3x3 const double  A[3][3],
const double  x[3],
double  y[3]
[static]
 

Solve Ay = x for y and place the result in y. The matrix A is destroyed in the process.

void vtkMath::Multiply3x3 const float  A[3][3],
const float  in[3],
float  out[3]
[static]
 

Multiply a vector by a 3x3 matrix. The result is placed in out.

void vtkMath::Multiply3x3 const double  A[3][3],
const double  in[3],
double  out[3]
[static]
 

Multiply a vector by a 3x3 matrix. The result is placed in out.

void vtkMath::Multiply3x3 const float  A[3][3],
const float  B[3][3],
float  C[3][3]
[static]
 

Mutltiply one 3x3 matrix by another according to C = AB.

void vtkMath::Multiply3x3 const double  A[3][3],
const double  B[3][3],
double  C[3][3]
[static]
 

Mutltiply one 3x3 matrix by another according to C = AB.

void vtkMath::Transpose3x3 const float  A[3][3],
float  AT[3][3]
[static]
 

Transpose a 3x3 matrix.

void vtkMath::Transpose3x3 const double  A[3][3],
double  AT[3][3]
[static]
 

Transpose a 3x3 matrix.

void vtkMath::Invert3x3 const float  A[3][3],
float  AI[3][3]
[static]
 

Invert a 3x3 matrix.

void vtkMath::Invert3x3 const double  A[3][3],
double  AI[3][3]
[static]
 

Invert a 3x3 matrix.

void vtkMath::Identity3x3 float  A[3][3]  )  [static]
 

Set A to the identity matrix.

void vtkMath::Identity3x3 double  A[3][3]  )  [static]
 

Set A to the identity matrix.

double vtkMath::Determinant3x3 float  A[3][3]  )  [inline, static]
 

Return the determinant of a 3x3 matrix.

Definition at line 729 of file vtkMath.h.

References vtkDeterminant3x3().

double vtkMath::Determinant3x3 double  A[3][3]  )  [inline, static]
 

Return the determinant of a 3x3 matrix.

Definition at line 735 of file vtkMath.h.

References vtkDeterminant3x3().

float vtkMath::Determinant3x3 const float  c1[3],
const float  c2[3],
const float  c3[3]
[inline, static]
 

Compute determinant of 3x3 matrix. Three columns of matrix are input.

Definition at line 648 of file vtkMath.h.

double vtkMath::Determinant3x3 const double  c1[3],
const double  c2[3],
const double  c3[3]
[inline, static]
 

Compute determinant of 3x3 matrix. Three columns of matrix are input.

Definition at line 657 of file vtkMath.h.

double vtkMath::Determinant3x3 double  a1,
double  a2,
double  a3,
double  b1,
double  b2,
double  b3,
double  c1,
double  c2,
double  c3
[inline, static]
 

Calculate the determinant of a 3x3 matrix in the form: | a1, b1, c1 | | a2, b2, c2 | | a3, b3, c3 |

Definition at line 666 of file vtkMath.h.

References Determinant2x2().

void vtkMath::QuaternionToMatrix3x3 const float  quat[4],
float  A[3][3]
[static]
 

Convert a quaternion to a 3x3 rotation matrix. The quaternion does not have to be normalized beforehand.

void vtkMath::QuaternionToMatrix3x3 const double  quat[4],
double  A[3][3]
[static]
 

Convert a quaternion to a 3x3 rotation matrix. The quaternion does not have to be normalized beforehand.

void vtkMath::Matrix3x3ToQuaternion const float  A[3][3],
float  quat[4]
[static]
 

Convert a 3x3 matrix into a quaternion. This will provide the best possible answer even if the matrix is not a pure rotation matrix. The method used is that of B.K.P. Horn.

void vtkMath::Matrix3x3ToQuaternion const double  A[3][3],
double  quat[4]
[static]
 

Convert a 3x3 matrix into a quaternion. This will provide the best possible answer even if the matrix is not a pure rotation matrix. The method used is that of B.K.P. Horn.

void vtkMath::Orthogonalize3x3 const float  A[3][3],
float  B[3][3]
[static]
 

Orthogonalize a 3x3 matrix and put the result in B. If matrix A has a negative determinant, then B will be a rotation plus a flip i.e. it will have a determinant of -1.

void vtkMath::Orthogonalize3x3 const double  A[3][3],
double  B[3][3]
[static]
 

Orthogonalize a 3x3 matrix and put the result in B. If matrix A has a negative determinant, then B will be a rotation plus a flip i.e. it will have a determinant of -1.

void vtkMath::Diagonalize3x3 const float  A[3][3],
float  w[3],
float  V[3][3]
[static]
 

Diagonalize a symmetric 3x3 matrix and return the eigenvalues in w and the eigenvectors in the columns of V. The matrix V will have a positive determinant, and the three eigenvectors will be aligned as closely as possible with the x, y, and z axes.

void vtkMath::Diagonalize3x3 const double  A[3][3],
double  w[3],
double  V[3][3]
[static]
 

Diagonalize a symmetric 3x3 matrix and return the eigenvalues in w and the eigenvectors in the columns of V. The matrix V will have a positive determinant, and the three eigenvectors will be aligned as closely as possible with the x, y, and z axes.

void vtkMath::SingularValueDecomposition3x3 const float  A[3][3],
float  U[3][3],
float  w[3],
float  VT[3][3]
[static]
 

Perform singular value decomposition on a 3x3 matrix. This is not done using a conventional SVD algorithm, instead it is done using Orthogonalize3x3 and Diagonalize3x3. Both output matrices U and VT will have positive determinants, and the w values will be arranged such that the three rows of VT are aligned as closely as possible with the x, y, and z axes respectively. If the determinant of A is negative, then the three w values will be negative.

void vtkMath::SingularValueDecomposition3x3 const double  A[3][3],
double  U[3][3],
double  w[3],
double  VT[3][3]
[static]
 

Perform singular value decomposition on a 3x3 matrix. This is not done using a conventional SVD algorithm, instead it is done using Orthogonalize3x3 and Diagonalize3x3. Both output matrices U and VT will have positive determinants, and the w values will be arranged such that the three rows of VT are aligned as closely as possible with the x, y, and z axes respectively. If the determinant of A is negative, then the three w values will be negative.

int vtkMath::SolveLinearSystem double **  A,
double *  x,
int  size
[static]
 

Solve linear equations Ax = b using Crout's method. Input is square matrix A and load vector x. Solution x is written over load vector. The dimension of the matrix is specified in size. If error is found, method returns a 0.

int vtkMath::InvertMatrix double **  A,
double **  AI,
int  size
[static]
 

Invert input square matrix A into matrix AI. Note that A is modified during the inversion. The size variable is the dimension of the matrix. Returns 0 if inverse not computed.

int vtkMath::InvertMatrix double **  A,
double **  AI,
int  size,
int *  tmp1Size,
double *  tmp2Size
[static]
 

Thread safe version of InvertMatrix method. Working memory arrays tmp1SIze and tmp2Size of length size must be passed in.

int vtkMath::LUFactorLinearSystem double **  A,
int *  index,
int  size
[static]
 

Factor linear equations Ax = b using LU decomposition A = LU where L is lower triangular matrix and U is upper triangular matrix. Input is square matrix A, integer array of pivot indices index[0->n-1], and size of square matrix n. Output factorization LU is in matrix A. If error is found, method returns 0.

int vtkMath::LUFactorLinearSystem double **  A,
int *  index,
int  size,
double *  tmpSize
[static]
 

Thread safe version of LUFactorLinearSystem method. Working memory array tmpSize of length size must be passed in.

void vtkMath::LUSolveLinearSystem double **  A,
int *  index,
double *  x,
int  size
[static]
 

Solve linear equations Ax = b using LU decomposition A = LU where L is lower triangular matrix and U is upper triangular matrix. Input is factored matrix A=LU, integer array of pivot indices index[0->n-1], load vector x[0->n-1], and size of square matrix n. Note that A=LU and index[] are generated from method LUFactorLinearSystem). Also, solution vector is written directly over input load vector.

double vtkMath::EstimateMatrixCondition double **  A,
int  size
[static]
 

Estimate the condition number of a LU factored matrix. Used to judge the accuracy of the solution. The matrix A must have been previously factored using the method LUFactorLinearSystem. The condition number is the ratio of the infinity matrix norm (i.e., maximum value of matrix component) divided by the minimum diagonal value. (This works for triangular matrices only: see Conte and de Boor, Elementary Numerical Analysis.)

void vtkMath::RandomSeed long  s  )  [static]
 

Initialize seed value. NOTE: Random() has the bad property that the first random number returned after RandomSeed() is called is proportional to the seed value! To help solve this, call RandomSeed() a few times inside seed. This doesn't ruin the repeatability of Random().

double vtkMath::Random  )  [static]
 

Generate random numbers between 0.0 and 1.0. This is used to provide portability across different systems.

Referenced by Random().

double vtkMath::Random double  min,
double  max
[inline, static]
 

Generate random number between (min,max).

Definition at line 692 of file vtkMath.h.

References Random().

int vtkMath::Jacobi float **  a,
float *  w,
float **  v
[static]
 

Jacobi iteration for the solution of eigenvectors/eigenvalues of a 3x3 real symmetric matrix. Square 3x3 matrix a; output eigenvalues in w; and output eigenvectors in v. Resulting eigenvalues/vectors are sorted in decreasing order; eigenvectors are normalized.

int vtkMath::Jacobi double **  a,
double *  w,
double **  v
[static]
 

Jacobi iteration for the solution of eigenvectors/eigenvalues of a 3x3 real symmetric matrix. Square 3x3 matrix a; output eigenvalues in w; and output eigenvectors in v. Resulting eigenvalues/vectors are sorted in decreasing order; eigenvectors are normalized.

int vtkMath::JacobiN float **  a,
int  n,
float *  w,
float **  v
[static]
 

JacobiN iteration for the solution of eigenvectors/eigenvalues of a nxn real symmetric matrix. Square nxn matrix a; size of matrix in n; output eigenvalues in w; and output eigenvectors in v. Resulting eigenvalues/vectors are sorted in decreasing order; eigenvectors are normalized. w and v need to be allocated previously

int vtkMath::JacobiN double **  a,
int  n,
double *  w,
double **  v
[static]
 

JacobiN iteration for the solution of eigenvectors/eigenvalues of a nxn real symmetric matrix. Square nxn matrix a; size of matrix in n; output eigenvalues in w; and output eigenvectors in v. Resulting eigenvalues/vectors are sorted in decreasing order; eigenvectors are normalized. w and v need to be allocated previously

double* vtkMath::SolveCubic double  c0,
double  c1,
double  c2,
double  c3
[static]
 

Solves a cubic equation c0*t^3 + c1*t^2 + c2*t + c3 = 0 when c0, c1, c2, and c3 are REAL. Solution is motivated by Numerical Recipes In C 2nd Ed. Return array contains number of (real) roots (counting multiple roots as one) followed by roots themselves. The value in roots[4] is a integer giving further information about the roots (see return codes for int SolveCubic()).

double* vtkMath::SolveQuadratic double  c0,
double  c1,
double  c2
[static]
 

Solves a quadratic equation c1*t^2 + c2*t + c3 = 0 when c1, c2, and c3 are REAL. Solution is motivated by Numerical Recipes In C 2nd Ed. Return array contains number of (real) roots (counting multiple roots as one) followed by roots themselves. Note that roots[3] contains a return code further describing solution - see documentation for SolveCubic() for meaning of return codes.

double* vtkMath::SolveLinear double  c0,
double  c1
[static]
 

Solves a linear equation c2*t + c3 = 0 when c2 and c3 are REAL. Solution is motivated by Numerical Recipes In C 2nd Ed. Return array contains number of roots followed by roots themselves.

int vtkMath::SolveCubic double  c0,
double  c1,
double  c2,
double  c3,
double *  r1,
double *  r2,
double *  r3,
int *  num_roots
[static]
 

Solves a cubic equation when c0, c1, c2, And c3 Are REAL. Solution is motivated by Numerical Recipes In C 2nd Ed. Roots and number of real roots are stored in user provided variables r1, r2, r3, and num_roots. Note that the function can return the following integer values describing the roots: (0)-no solution; (-1)-infinite number of solutions; (1)-one distinct real root of multiplicity 3 (stored in r1); (2)-two distinct real roots, one of multiplicity 2 (stored in r1 & r2); (3)-three distinct real roots; (-2)-quadratic equation with complex conjugate solution (real part of root returned in r1, imaginary in r2); (-3)-one real root and a complex conjugate pair (real root in r1 and real part of pair in r2 and imaginary in r3).

int vtkMath::SolveQuadratic double  c0,
double  c1,
double  c2,
double *  r1,
double *  r2,
int *  num_roots
[static]
 

Solves A Quadratic Equation c1*t^2 + c2*t + c3 = 0 when c1, c2, and c3 are REAL. Solution is motivated by Numerical Recipes In C 2nd Ed. Roots and number of roots are stored in user provided variables r1, r2, num_roots

int vtkMath::SolveLinear double  c0,
double  c1,
double *  r1,
int *  num_roots
[static]
 

Solves a linear equation c2*t + c3 = 0 when c2 and c3 are REAL. Solution is motivated by Numerical Recipes In C 2nd Ed. Root and number of (real) roots are stored in user provided variables r2 and num_roots.

int vtkMath::SolveHomogeneousLeastSquares int  numberOfSamples,
double **  xt,
int  xOrder,
double **  mt
[static]
 

Solves for the least squares best fit matrix for the homogeneous equation X'M' = 0'. Uses the method described on pages 40-41 of Computer Vision by Forsyth and Ponce, which is that the solution is the eigenvector associated with the minimum eigenvalue of T(X)X, where T(X) is the transpose of X. The inputs and output are transposed matrices. Dimensions: X' is numberOfSamples by xOrder, M' dimension is xOrder by yOrder. M' should be pre-allocated. All matrices are row major. The resultant matrix M' should be pre-multiplied to X' to get 0', or transposed and then post multiplied to X to get 0

int vtkMath::SolveLeastSquares int  numberOfSamples,
double **  xt,
int  xOrder,
double **  yt,
int  yOrder,
double **  mt,
int  checkHomogeneous = 1
[static]
 

Solves for the least squares best fit matrix for the equation X'M' = Y'. Uses pseudoinverse to get the ordinary least squares. The inputs and output are transposed matrices. Dimensions: X' is numberOfSamples by xOrder, Y' is numberOfSamples by yOrder, M' dimension is xOrder by yOrder. M' should be pre-allocated. All matrices are row major. The resultant matrix M' should be pre-multiplied to X' to get Y', or transposed and then post multiplied to X to get Y By default, this method checks for the homogeneous condition where Y==0, and if so, invokes SolveHomogeneousLeastSquares. For better performance when the system is known not to be homogeneous, invoke with checkHomogeneous=0.

void vtkMath::RGBToHSV float  rgb[3],
float  hsv[3]
[inline, static]
 

Convert color in RGB format (Red, Green, Blue) to HSV format (Hue, Saturation, Value). The input color is not modified.

Definition at line 498 of file vtkMath.h.

void vtkMath::RGBToHSV float  r,
float  g,
float  b,
float *  h,
float *  s,
float *  v
[static]
 

Convert color in RGB format (Red, Green, Blue) to HSV format (Hue, Saturation, Value). The input color is not modified.

void vtkMath::RGBToHSV double  rgb[3],
double  hsv[3]
[inline, static]
 

Convert color in RGB format (Red, Green, Blue) to HSV format (Hue, Saturation, Value). The input color is not modified.

Definition at line 504 of file vtkMath.h.

void vtkMath::RGBToHSV double  r,
double  g,
double  b,
double *  h,
double *  s,
double *  v
[static]
 

Convert color in RGB format (Red, Green, Blue) to HSV format (Hue, Saturation, Value). The input color is not modified.

void vtkMath::HSVToRGB float  hsv[3],
float  rgb[3]
[inline, static]
 

Convert color in HSV format (Hue, Saturation, Value) to RGB format (Red, Green, Blue). The input color is not modified.

Definition at line 515 of file vtkMath.h.

void vtkMath::HSVToRGB float  h,
float  s,
float  v,
float *  r,
float *  g,
float *  b
[static]
 

Convert color in HSV format (Hue, Saturation, Value) to RGB format (Red, Green, Blue). The input color is not modified.

void vtkMath::HSVToRGB double  hsv[3],
double  rgb[3]
[inline, static]
 

Convert color in HSV format (Hue, Saturation, Value) to RGB format (Red, Green, Blue). The input color is not modified.

Definition at line 521 of file vtkMath.h.

void vtkMath::HSVToRGB double  h,
double  s,
double  v,
double *  r,
double *  g,
double *  b
[static]
 

Convert color in HSV format (Hue, Saturation, Value) to RGB format (Red, Green, Blue). The input color is not modified.

void vtkMath::UninitializeBounds double  bounds[6]  )  [inline, static]
 

Set the bounds to an uninitialized state

Definition at line 531 of file vtkMath.h.

int vtkMath::AreBoundsInitialized double  bounds[6]  )  [inline, static]
 

Are the bounds initialized?

Definition at line 543 of file vtkMath.h.

void vtkMath::ClampValue double *  value,
const double  range[2]
[inline, static]
 

Clamp some values against a range The method without 'clamped_values' will perform in-place clamping.

Definition at line 741 of file vtkMath.h.

void vtkMath::ClampValue double  value,
const double  range[2],
double *  clamped_value
[inline, static]
 

Clamp some values against a range The method without 'clamped_values' will perform in-place clamping.

Definition at line 757 of file vtkMath.h.

void vtkMath::ClampValues double *  values,
int  nb_values,
const double  range[2]
[static]
 

Clamp some values against a range The method without 'clamped_values' will perform in-place clamping.

void vtkMath::ClampValues const double *  values,
int  nb_values,
const double  range[2],
double *  clamped_values
[static]
 

Clamp some values against a range The method without 'clamped_values' will perform in-place clamping.


Member Data Documentation

long vtkMath::Seed [static, protected]
 

Definition at line 567 of file vtkMath.h.


The documentation for this class was generated from the following file: