VTK
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Attributes | List of all members
vtkMath Class Reference

performs common math operations More...

#include <vtkMath.h>

Inheritance diagram for vtkMath:
[legend]
Collaboration diagram for vtkMath:
[legend]

Public Types

typedef vtkObject Superclass
 
- Public Types inherited from vtkObject
typedef vtkObjectBase Superclass
 

Public Member Functions

virtual int IsA (const char *type)
 
vtkMathNewInstance () const
 
void PrintSelf (ostream &os, vtkIndent indent)
 
- Public Member Functions inherited from vtkObject
vtkObjectNewInstance () const
 
virtual void DebugOn ()
 
virtual void DebugOff ()
 
bool GetDebug ()
 
void SetDebug (bool debugFlag)
 
virtual void Modified ()
 
virtual unsigned long GetMTime ()
 
unsigned long AddObserver (unsigned long event, vtkCommand *, float priority=0.0f)
 
unsigned long AddObserver (const char *event, vtkCommand *, float priority=0.0f)
 
vtkCommandGetCommand (unsigned long tag)
 
void RemoveObserver (vtkCommand *)
 
void RemoveObservers (unsigned long event, vtkCommand *)
 
void RemoveObservers (const char *event, vtkCommand *)
 
int HasObserver (unsigned long event, vtkCommand *)
 
int HasObserver (const char *event, vtkCommand *)
 
void RemoveObserver (unsigned long tag)
 
void RemoveObservers (unsigned long event)
 
void RemoveObservers (const char *event)
 
void RemoveAllObservers ()
 
int HasObserver (unsigned long event)
 
int HasObserver (const char *event)
 
template<class U , class T >
unsigned long AddObserver (unsigned long event, U observer, void(T::*callback)(), float priority=0.0f)
 
template<class U , class T >
unsigned long AddObserver (unsigned long event, U observer, void(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f)
 
template<class U , class T >
unsigned long AddObserver (unsigned long event, U observer, bool(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f)
 
int InvokeEvent (unsigned long event, void *callData)
 
int InvokeEvent (const char *event, void *callData)
 
int InvokeEvent (unsigned long event)
 
int InvokeEvent (const char *event)
 
- Public Member Functions inherited from vtkObjectBase
const char * GetClassName () const
 
virtual void Delete ()
 
virtual void FastDelete ()
 
void Print (ostream &os)
 
virtual void Register (vtkObjectBase *o)
 
virtual void UnRegister (vtkObjectBase *o)
 
void SetReferenceCount (int)
 
void PrintRevisions (ostream &)
 
virtual void PrintHeader (ostream &os, vtkIndent indent)
 
virtual void PrintTrailer (ostream &os, vtkIndent indent)
 
int GetReferenceCount ()
 

Static Public Member Functions

static vtkMathNew ()
 
static int IsTypeOf (const char *type)
 
static vtkMathSafeDownCast (vtkObjectBase *o)
 
static double Pi ()
 
static int Floor (double x)
 
static int Ceil (double x)
 
static int CeilLog2 (vtkTypeUInt64 x)
 
static bool IsPowerOfTwo (vtkTypeUInt64 x)
 
static int NearestPowerOfTwo (int x)
 
static vtkTypeInt64 Factorial (int N)
 
static vtkTypeInt64 Binomial (int m, int n)
 
static intBeginCombination (int m, int n)
 
static int NextCombination (int m, int n, int *combination)
 
static void FreeCombination (int *combination)
 
static void RandomSeed (int s)
 
static int GetSeed ()
 
static double Random ()
 
static double Random (double min, double max)
 
static double Gaussian ()
 
static double Gaussian (double mean, double std)
 
static void Cross (const float x[3], const float y[3], float z[3])
 
static void Cross (const double x[3], const double y[3], double z[3])
 
static float Normalize (float x[3])
 
static double Normalize (double x[3])
 
static float Distance2BetweenPoints (const float x[3], const float y[3])
 
static double Distance2BetweenPoints (const double x[3], const double y[3])
 
static double AngleBetweenVectors (const double v1[3], const double v2[3])
 
static double GaussianAmplitude (const double variance, const double distanceFromMean)
 
static double GaussianAmplitude (const double mean, const double variance, const double position)
 
static double GaussianWeight (const double variance, const double distanceFromMean)
 
static double GaussianWeight (const double mean, const double variance, const double position)
 
static float Normalize2D (float x[2])
 
static double Normalize2D (double x[2])
 
static int SolveLinearSystem (double **A, double *x, int size)
 
static int InvertMatrix (double **A, double **AI, int size)
 
static int LUFactorLinearSystem (double **A, int *index, int size)
 
static double EstimateMatrixCondition (double **A, int size)
 
static int ExtentIsWithinOtherExtent (int extent1[6], int extent2[6])
 
static int BoundsIsWithinOtherBounds (double bounds1[6], double bounds2[6], double delta[3])
 
static int PointIsWithinBounds (double point[3], double bounds[6], double delta[3])
 
static double Solve3PointCircle (const double p1[3], const double p2[3], const double p3[3], double center[3])
 
static double Inf ()
 
static double NegInf ()
 
static double Nan ()
 
static int IsInf (double x)
 
static int IsNan (double x)
 
static bool IsFinite (double x)
 
static float RadiansFromDegrees (float degrees)
 
static double RadiansFromDegrees (double degrees)
 
static float DegreesFromRadians (float radians)
 
static double DegreesFromRadians (double radians)
 
static int Round (float f)
 
static int Round (double f)
 
static void Add (const float a[3], const float b[3], float c[3])
 
static void Add (const double a[3], const double b[3], double c[3])
 
static void Subtract (const float a[3], const float b[3], float c[3])
 
static void Subtract (const double a[3], const double b[3], double c[3])
 
static void MultiplyScalar (float a[3], float s)
 
static void MultiplyScalar2D (float a[2], float s)
 
static void MultiplyScalar (double a[3], double s)
 
static void MultiplyScalar2D (double a[2], double s)
 
static float Dot (const float x[3], const float y[3])
 
static double Dot (const double x[3], const double y[3])
 
static void Outer (const float x[3], const float y[3], float A[3][3])
 
static void Outer (const double x[3], const double y[3], double A[3][3])
 
static float Norm (const float *x, int n)
 
static double Norm (const double *x, int n)
 
static float Norm (const float x[3])
 
static double Norm (const double x[3])
 
static void Perpendiculars (const double x[3], double y[3], double z[3], double theta)
 
static void Perpendiculars (const float x[3], float y[3], float z[3], double theta)
 
static bool ProjectVector (const float a[3], const float b[3], float projection[3])
 
static bool ProjectVector (const double a[3], const double b[3], double projection[3])
 
static bool ProjectVector2D (const float a[2], const float b[2], float projection[2])
 
static bool ProjectVector2D (const double a[2], const double b[2], double projection[2])
 
static float Dot2D (const float x[2], const float y[2])
 
static double Dot2D (const double x[2], const double y[2])
 
static void Outer2D (const float x[2], const float y[2], float A[2][2])
 
static void Outer2D (const double x[2], const double y[2], double A[2][2])
 
static float Norm2D (const float x[2])
 
static double Norm2D (const double x[2])
 
static float Determinant2x2 (const float c1[2], const float c2[2])
 
static double Determinant2x2 (double a, double b, double c, double d)
 
static double Determinant2x2 (const double c1[2], const double c2[2])
 
static void LUFactor3x3 (float A[3][3], int index[3])
 
static void LUFactor3x3 (double A[3][3], int index[3])
 
static void LUSolve3x3 (const float A[3][3], const int index[3], float x[3])
 
static void LUSolve3x3 (const double A[3][3], const int index[3], double x[3])
 
static void LinearSolve3x3 (const float A[3][3], const float x[3], float y[3])
 
static void LinearSolve3x3 (const double A[3][3], const double x[3], double y[3])
 
static void Multiply3x3 (const float A[3][3], const float in[3], float out[3])
 
static void Multiply3x3 (const double A[3][3], const double in[3], double out[3])
 
static void Multiply3x3 (const float A[3][3], const float B[3][3], float C[3][3])
 
static void Multiply3x3 (const double A[3][3], const double B[3][3], double C[3][3])
 
static void MultiplyMatrix (double **A, double **B, unsigned int rowA, unsigned int colA, unsigned int rowB, unsigned int colB, double **C)
 
static void Transpose3x3 (const float A[3][3], float AT[3][3])
 
static void Transpose3x3 (const double A[3][3], double AT[3][3])
 
static void Invert3x3 (const float A[3][3], float AI[3][3])
 
static void Invert3x3 (const double A[3][3], double AI[3][3])
 
static void Identity3x3 (float A[3][3])
 
static void Identity3x3 (double A[3][3])
 
static double Determinant3x3 (float A[3][3])
 
static double Determinant3x3 (double A[3][3])
 
static float Determinant3x3 (const float c1[3], const float c2[3], const float c3[3])
 
static double Determinant3x3 (const double c1[3], const double c2[3], const double c3[3])
 
static double Determinant3x3 (double a1, double a2, double a3, double b1, double b2, double b3, double c1, double c2, double c3)
 
static void QuaternionToMatrix3x3 (const float quat[4], float A[3][3])
 
static void QuaternionToMatrix3x3 (const double quat[4], double A[3][3])
 
static void Matrix3x3ToQuaternion (const float A[3][3], float quat[4])
 
static void Matrix3x3ToQuaternion (const double A[3][3], double quat[4])
 
static void MultiplyQuaternion (const float q1[4], const float q2[4], float q[4])
 
static void MultiplyQuaternion (const double q1[4], const double q2[4], double q[4])
 
static void Orthogonalize3x3 (const float A[3][3], float B[3][3])
 
static void Orthogonalize3x3 (const double A[3][3], double B[3][3])
 
static void Diagonalize3x3 (const float A[3][3], float w[3], float V[3][3])
 
static void Diagonalize3x3 (const double A[3][3], double w[3], double V[3][3])
 
static void SingularValueDecomposition3x3 (const float A[3][3], float U[3][3], float w[3], float VT[3][3])
 
static void SingularValueDecomposition3x3 (const double A[3][3], double U[3][3], double w[3], double VT[3][3])
 
static int InvertMatrix (double **A, double **AI, int size, int *tmp1Size, double *tmp2Size)
 
static int LUFactorLinearSystem (double **A, int *index, int size, double *tmpSize)
 
static void LUSolveLinearSystem (double **A, int *index, double *x, int size)
 
static int Jacobi (float **a, float *w, float **v)
 
static int Jacobi (double **a, double *w, double **v)
 
static int JacobiN (float **a, int n, float *w, float **v)
 
static int JacobiN (double **a, int n, double *w, double **v)
 
static int SolveHomogeneousLeastSquares (int numberOfSamples, double **xt, int xOrder, double **mt)
 
static int SolveLeastSquares (int numberOfSamples, double **xt, int xOrder, double **yt, int yOrder, double **mt, int checkHomogeneous=1)
 
static void RGBToHSV (const float rgb[3], float hsv[3])
 
static void RGBToHSV (float r, float g, float b, float *h, float *s, float *v)
 
static doubleRGBToHSV (const double rgb[3])
 
static doubleRGBToHSV (double r, double g, double b)
 
static void RGBToHSV (const double rgb[3], double hsv[3])
 
static void RGBToHSV (double r, double g, double b, double *h, double *s, double *v)
 
static void HSVToRGB (const float hsv[3], float rgb[3])
 
static void HSVToRGB (float h, float s, float v, float *r, float *g, float *b)
 
static doubleHSVToRGB (const double hsv[3])
 
static doubleHSVToRGB (double h, double s, double v)
 
static void HSVToRGB (const double hsv[3], double rgb[3])
 
static void HSVToRGB (double h, double s, double v, double *r, double *g, double *b)
 
static void LabToXYZ (const double lab[3], double xyz[3])
 
static void LabToXYZ (double L, double a, double b, double *x, double *y, double *z)
 
static doubleLabToXYZ (const double lab[3])
 
static void XYZToLab (const double xyz[3], double lab[3])
 
static void XYZToLab (double x, double y, double z, double *L, double *a, double *b)
 
static doubleXYZToLab (const double xyz[3])
 
static void XYZToRGB (const double xyz[3], double rgb[3])
 
static void XYZToRGB (double x, double y, double z, double *r, double *g, double *b)
 
static doubleXYZToRGB (const double xyz[3])
 
static void RGBToXYZ (const double rgb[3], double xyz[3])
 
static void RGBToXYZ (double r, double g, double b, double *x, double *y, double *z)
 
static doubleRGBToXYZ (const double rgb[3])
 
static void RGBToLab (const double rgb[3], double lab[3])
 
static void RGBToLab (double red, double green, double blue, double *L, double *a, double *b)
 
static doubleRGBToLab (const double rgb[3])
 
static void LabToRGB (const double lab[3], double rgb[3])
 
static void LabToRGB (double L, double a, double b, double *red, double *green, double *blue)
 
static doubleLabToRGB (const double lab[3])
 
static void UninitializeBounds (double bounds[6])
 
static int AreBoundsInitialized (double bounds[6])
 
static void ClampValue (double *value, const double range[2])
 
static void ClampValue (double value, const double range[2], double *clamped_value)
 
static void ClampValues (double *values, int nb_values, const double range[2])
 
static void ClampValues (const double *values, int nb_values, const double range[2], double *clamped_values)
 
static double ClampAndNormalizeValue (double value, const double range[2])
 
static int GetScalarTypeFittingRange (double range_min, double range_max, double scale=1.0, double shift=0.0)
 
static int GetAdjustedScalarRange (vtkDataArray *array, int comp, double range[2])
 
- Static Public Member Functions inherited from vtkObject
static int IsTypeOf (const char *type)
 
static vtkObjectSafeDownCast (vtkObjectBase *o)
 
static vtkObjectNew ()
 
static void BreakOnError ()
 
static void SetGlobalWarningDisplay (int val)
 
static void GlobalWarningDisplayOn ()
 
static void GlobalWarningDisplayOff ()
 
static int GetGlobalWarningDisplay ()
 
- Static Public Member Functions inherited from vtkObjectBase
static int IsTypeOf (const char *name)
 
static vtkObjectBaseNew ()
 

Protected Member Functions

virtual vtkObjectBaseNewInstanceInternal () const
 
 vtkMath ()
 
 ~vtkMath ()
 
- Protected Member Functions inherited from vtkObject
 vtkObject ()
 
virtual ~vtkObject ()
 
virtual void RegisterInternal (vtkObjectBase *, int check)
 
virtual void UnRegisterInternal (vtkObjectBase *, int check)
 
void InternalGrabFocus (vtkCommand *mouseEvents, vtkCommand *keypressEvents=NULL)
 
void InternalReleaseFocus ()
 
- Protected Member Functions inherited from vtkObjectBase
 vtkObjectBase ()
 
virtual ~vtkObjectBase ()
 
virtual void CollectRevisions (ostream &)
 
virtual void ReportReferences (vtkGarbageCollector *)
 
 vtkObjectBase (const vtkObjectBase &)
 
void operator= (const vtkObjectBase &)
 

Static Protected Attributes

static vtkMathInternal Internal
 

Additional Inherited Members

- Protected Attributes inherited from vtkObject
bool Debug
 
vtkTimeStamp MTime
 
vtkSubjectHelper * SubjectHelper
 
- Protected Attributes inherited from vtkObjectBase
vtkAtomicInt32 ReferenceCount
 
vtkWeakPointerBase ** WeakPointers
 

Detailed Description

performs common math operations

vtkMath 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; univariate polynomial solvers; and for random number generation (for backward compatibility only).

See also
vtkMinimalStandardRandomSequence, vtkBoxMuellerRandomSequence, vtkQuaternion
Examples:
vtkMath (Examples)
Tests:
vtkMath (Tests)

Definition at line 80 of file vtkMath.h.

Member Typedef Documentation

Definition at line 84 of file vtkMath.h.

Constructor & Destructor Documentation

vtkMath::vtkMath ( )
inlineprotected

Definition at line 962 of file vtkMath.h.

vtkMath::~vtkMath ( )
inlineprotected

Definition at line 963 of file vtkMath.h.

Member Function Documentation

static vtkMath* vtkMath::New ( )
static
static int vtkMath::IsTypeOf ( const char *  type)
static
virtual int vtkMath::IsA ( const char *  name)
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 vtkTypeMacro found in vtkSetGet.h.

Reimplemented from vtkObject.

static vtkMath* vtkMath::SafeDownCast ( vtkObjectBase o)
static
virtual vtkObjectBase* vtkMath::NewInstanceInternal ( ) const
protectedvirtual

Reimplemented from vtkObject.

vtkMath* vtkMath::NewInstance ( ) const
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.

static double vtkMath::Pi ( )
inlinestatic

A mathematical constant. This version is atan(1.0) * 4.0

Definition at line 88 of file vtkMath.h.

float vtkMath::RadiansFromDegrees ( float  degrees)
inlinestatic

Convert degrees into radians

Definition at line 972 of file vtkMath.h.

double vtkMath::RadiansFromDegrees ( double  degrees)
inlinestatic

Convert degrees into radians

Definition at line 978 of file vtkMath.h.

float vtkMath::DegreesFromRadians ( float  radians)
inlinestatic

Convert radians into degrees

Definition at line 984 of file vtkMath.h.

double vtkMath::DegreesFromRadians ( double  radians)
inlinestatic

Convert radians into degrees

Definition at line 990 of file vtkMath.h.

static int vtkMath::Round ( float  f)
inlinestatic

Rounds a float to the nearest integer.

Definition at line 104 of file vtkMath.h.

static int vtkMath::Round ( double  f)
inlinestatic

Rounds a float to the nearest integer.

Definition at line 106 of file vtkMath.h.

int vtkMath::Floor ( double  x)
inlinestatic

Rounds a double to the nearest integer not greater than itself. This is faster than floor() but provides undefined output on overflow.

Definition at line 1017 of file vtkMath.h.

int vtkMath::Ceil ( double  x)
inlinestatic

Rounds a double to the nearest integer not less than itself. This is faster than ceil() but provides undefined output on overflow.

Definition at line 1026 of file vtkMath.h.

static int vtkMath::CeilLog2 ( vtkTypeUInt64  x)
static

Gives the exponent of the lowest power of two not less than x. Or in mathspeak, return the smallest "i" for which 2^i >= x. If x is zero, then the return value will be zero.

bool vtkMath::IsPowerOfTwo ( vtkTypeUInt64  x)
inlinestatic

Returns true if integer is a power of two.

Definition at line 996 of file vtkMath.h.

int vtkMath::NearestPowerOfTwo ( int  x)
inlinestatic

Compute the nearest power of two that is not less than x. The return value is 1 if x is less than or equal to zero, and is VTK_INT_MIN if result is too large to fit in an int.

Definition at line 1003 of file vtkMath.h.

static vtkTypeInt64 vtkMath::Factorial ( int  N)
static

Compute N factorial, N! = N*(N-1) * (N-2)...*3*2*1. 0! is taken to be

static vtkTypeInt64 vtkMath::Binomial ( int  m,
int  n 
)
static

The number of combinations of n objects from a pool of m objects (m>n). This is commonly known as "m choose n" and sometimes denoted $_mC_n$ or $\left(\begin{array}{c}m \\ n\end{array}\right)$.

static int* vtkMath::BeginCombination ( int  m,
int  n 
)
static

Start iterating over "m choose n" objects. This function returns an array of n integers, each from 0 to m-1. These integers represent the n items chosen from the set [0,m[. You are responsible for calling vtkMath::FreeCombination() once the iterator is no longer needed. Warning: this gets large very quickly, especially when n nears m/2! (Hint: think of Pascal's triangle.)

static int vtkMath::NextCombination ( int  m,
int  n,
int combination 
)
static

Given m, n, and a valid combination of n integers in the range [0,m[, this function alters the integers into the next combination in a sequence of all combinations of n items from a pool of m. If the combination is the last item in the sequence on input, then combination is unaltered and 0 is returned. Otherwise, 1 is returned and combination is updated.

static void vtkMath::FreeCombination ( int combination)
static

Free the "iterator" array created by vtkMath::BeginCombination.

static void vtkMath::RandomSeed ( int  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(). DON'T USE Random(), RandomSeed(), GetSeed(), Gaussian() THIS IS STATIC SO THIS IS PRONE TO ERRORS (SPECIALLY FOR REGRESSION TESTS) THIS IS HERE FOR BACKWARD COMPATIBILITY ONLY. Instead, for a sequence of random numbers with a uniform distribution create a vtkMinimalStandardRandomSequence object. For a sequence of random numbers with a gaussian/normal distribution create a vtkBoxMuellerRandomSequence object.

static int vtkMath::GetSeed ( )
static

Return the current seed used by the random number generator. DON'T USE Random(), RandomSeed(), GetSeed(), Gaussian() THIS IS STATIC SO THIS IS PRONE TO ERRORS (SPECIALLY FOR REGRESSION TESTS) THIS IS HERE FOR BACKWARD COMPATIBILITY ONLY. Instead, for a sequence of random numbers with a uniform distribution create a vtkMinimalStandardRandomSequence object. For a sequence of random numbers with a gaussian/normal distribution create a vtkBoxMuellerRandomSequence object.

static double vtkMath::Random ( )
static

Generate pseudo-random numbers distributed according to the uniform distribution between 0.0 and 1.0. This is used to provide portability across different systems. DON'T USE Random(), RandomSeed(), GetSeed(), Gaussian() THIS IS STATIC SO THIS IS PRONE TO ERRORS (SPECIALLY FOR REGRESSION TESTS) THIS IS HERE FOR BACKWARD COMPATIBILITY ONLY. Instead, for a sequence of random numbers with a uniform distribution create a vtkMinimalStandardRandomSequence object. For a sequence of random numbers with a gaussian/normal distribution create a vtkBoxMuellerRandomSequence object.

static double vtkMath::Random ( double  min,
double  max 
)
static

Generate pseudo-random numbers distributed according to the uniform distribution between min and max. DON'T USE Random(), RandomSeed(), GetSeed(), Gaussian() THIS IS STATIC SO THIS IS PRONE TO ERRORS (SPECIALLY FOR REGRESSION TESTS) THIS IS HERE FOR BACKWARD COMPATIBILITY ONLY. Instead, for a sequence of random numbers with a uniform distribution create a vtkMinimalStandardRandomSequence object. For a sequence of random numbers with a gaussian/normal distribution create a vtkBoxMuellerRandomSequence object.

static double vtkMath::Gaussian ( )
static

Generate pseudo-random numbers distributed according to the standard normal distribution. DON'T USE Random(), RandomSeed(), GetSeed(), Gaussian() THIS IS STATIC SO THIS IS PRONE TO ERRORS (SPECIALLY FOR REGRESSION TESTS) THIS IS HERE FOR BACKWARD COMPATIBILITY ONLY. Instead, for a sequence of random numbers with a uniform distribution create a vtkMinimalStandardRandomSequence object. For a sequence of random numbers with a gaussian/normal distribution create a vtkBoxMuellerRandomSequence object.

static double vtkMath::Gaussian ( double  mean,
double  std 
)
static

Generate pseudo-random numbers distributed according to the Gaussian distribution with mean mean and standard deviation std. DON'T USE Random(), RandomSeed(), GetSeed(), Gaussian() THIS IS STATIC SO THIS IS PRONE TO ERRORS (SPECIALLY FOR REGRESSION TESTS) THIS IS HERE FOR BACKWARD COMPATIBILITY ONLY. Instead, for a sequence of random numbers with a uniform distribution create a vtkMinimalStandardRandomSequence object. For a sequence of random numbers with a gaussian/normal distribution create a vtkBoxMuellerRandomSequence object.

static void vtkMath::Add ( const float  a[3],
const float  b[3],
float  c[3] 
)
inlinestatic

Addition of two 3-vectors (float version). Result is stored in c.

Definition at line 226 of file vtkMath.h.

static void vtkMath::Add ( const double  a[3],
const double  b[3],
double  c[3] 
)
inlinestatic

Addition of two 3-vectors (double version). Result is stored in c.

Definition at line 234 of file vtkMath.h.

static void vtkMath::Subtract ( const float  a[3],
const float  b[3],
float  c[3] 
)
inlinestatic

Subtraction of two 3-vectors (float version). Result is stored in c according to c = a - b.

Definition at line 243 of file vtkMath.h.

static void vtkMath::Subtract ( const double  a[3],
const double  b[3],
double  c[3] 
)
inlinestatic

Subtraction of two 3-vectors (double version). Result is stored in c according to c = a - b.

Definition at line 252 of file vtkMath.h.

static void vtkMath::MultiplyScalar ( float  a[3],
float  s 
)
inlinestatic

Multiplies a 3-vector by a scalar (float version). This modifies the input 3-vector.

Definition at line 261 of file vtkMath.h.

static void vtkMath::MultiplyScalar2D ( float  a[2],
float  s 
)
inlinestatic

Multiplies a 2-vector by a scalar (float version). This modifies the input 2-vector.

Definition at line 270 of file vtkMath.h.

static void vtkMath::MultiplyScalar ( double  a[3],
double  s 
)
inlinestatic

Multiplies a 3-vector by a scalar (double version). This modifies the input 3-vector.

Definition at line 279 of file vtkMath.h.

static void vtkMath::MultiplyScalar2D ( double  a[2],
double  s 
)
inlinestatic

Multiplies a 2-vector by a scalar (double version). This modifies the input 2-vector.

Definition at line 288 of file vtkMath.h.

static float vtkMath::Dot ( const float  x[3],
const float  y[3] 
)
inlinestatic

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

Definition at line 296 of file vtkMath.h.

static double vtkMath::Dot ( const double  x[3],
const double  y[3] 
)
inlinestatic

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

Definition at line 302 of file vtkMath.h.

static void vtkMath::Outer ( const float  x[3],
const float  y[3],
float  A[3][3] 
)
inlinestatic

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

Definition at line 308 of file vtkMath.h.

static void vtkMath::Outer ( const double  x[3],
const double  y[3],
double  A[3][3] 
)
inlinestatic

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

Definition at line 316 of file vtkMath.h.

void vtkMath::Cross ( const float  x[3],
const float  y[3],
float  z[3] 
)
inlinestatic

Cross product of two 3-vectors. Result (a x b) is stored in z.

Definition at line 1136 of file vtkMath.h.

void vtkMath::Cross ( const double  x[3],
const double  y[3],
double  z[3] 
)
inlinestatic

Cross product of two 3-vectors. Result (a x b) is stored in z. (double-precision version)

Definition at line 1146 of file vtkMath.h.

static float vtkMath::Norm ( const float x,
int  n 
)
static

Compute the norm of n-vector. x is the vector, n is its length.

static double vtkMath::Norm ( const double x,
int  n 
)
static

Compute the norm of n-vector. x is the vector, n is its length.

static float vtkMath::Norm ( const float  x[3])
inlinestatic

Compute the norm of 3-vector.

Definition at line 338 of file vtkMath.h.

static double vtkMath::Norm ( const double  x[3])
inlinestatic

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

Definition at line 344 of file vtkMath.h.

float vtkMath::Normalize ( float  x[3])
inlinestatic

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

Definition at line 1033 of file vtkMath.h.

double vtkMath::Normalize ( double  x[3])
inlinestatic

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

Definition at line 1047 of file vtkMath.h.

static 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.

static 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.

static bool vtkMath::ProjectVector ( const float  a[3],
const float  b[3],
float  projection[3] 
)
static

Compute the projection of vector a on vector b and return it in projection[3]. If b is a zero vector, the function returns false and 'projection' is invalid. Otherwise, it returns true.

static bool vtkMath::ProjectVector ( const double  a[3],
const double  b[3],
double  projection[3] 
)
static

Compute the projection of vector a on vector b and return it in projection[3]. If b is a zero vector, the function returns false and 'projection' is invalid. Otherwise, it returns true.

static bool vtkMath::ProjectVector2D ( const float  a[2],
const float  b[2],
float  projection[2] 
)
static

Compute the projection of 2D vector 'a' on 2D vector 'b' and returns the result in projection[2]. If b is a zero vector, the function returns false and 'projection' is invalid. Otherwise, it returns true.

static bool vtkMath::ProjectVector2D ( const double  a[2],
const double  b[2],
double  projection[2] 
)
static

Compute the projection of 2D vector 'a' on 2D vector 'b' and returns the result in projection[2]. If b is a zero vector, the function returns false and 'projection' is invalid. Otherwise, it returns true.

float vtkMath::Distance2BetweenPoints ( const float  x[3],
const float  y[3] 
)
inlinestatic

Compute distance squared between two points x and y.

Definition at line 1117 of file vtkMath.h.

double vtkMath::Distance2BetweenPoints ( const double  x[3],
const double  y[3] 
)
inlinestatic

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

Definition at line 1126 of file vtkMath.h.

static double vtkMath::AngleBetweenVectors ( const double  v1[3],
const double  v2[3] 
)
static

Compute angle in radians between two vectors.

static double vtkMath::GaussianAmplitude ( const double  variance,
const double  distanceFromMean 
)
static

Compute the amplitude of a Gaussian function with mean=0 and specified variance. That is, 1./(sqrt(2 Pi * variance)) * exp(-distanceFromMean^2/(2.*variance)).

static double vtkMath::GaussianAmplitude ( const double  mean,
const double  variance,
const double  position 
)
static

Compute the amplitude of a Gaussian function with specified mean and variance. That is, 1./(sqrt(2 Pi * variance)) * exp(-(position - mean)^2/(2.*variance)).

static double vtkMath::GaussianWeight ( const double  variance,
const double  distanceFromMean 
)
static

Compute the amplitude of an unnormalized Gaussian function with mean=0 and specified variance. That is, exp(-distanceFromMean^2/(2.*variance)). When distanceFromMean = 0, this function returns 1.

static double vtkMath::GaussianWeight ( const double  mean,
const double  variance,
const double  position 
)
static

Compute the amplitude of an unnormalized Gaussian function with specified mean and variance. That is, exp(-(position - mean)^2/(2.*variance)). When the distance from 'position' to 'mean' is 0, this function returns 1.

static float vtkMath::Dot2D ( const float  x[2],
const float  y[2] 
)
inlinestatic

Dot product of two 2-vectors.

Definition at line 418 of file vtkMath.h.

static double vtkMath::Dot2D ( const double  x[2],
const double  y[2] 
)
inlinestatic

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

Definition at line 424 of file vtkMath.h.

static void vtkMath::Outer2D ( const float  x[2],
const float  y[2],
float  A[2][2] 
)
inlinestatic

Outer product of two 2-vectors (float version).

Definition at line 430 of file vtkMath.h.

static void vtkMath::Outer2D ( const double  x[2],
const double  y[2],
double  A[2][2] 
)
inlinestatic

Outer product of two 2-vectors (float version).

Definition at line 443 of file vtkMath.h.

static float vtkMath::Norm2D ( const float  x[2])
inlinestatic

Compute the norm of a 2-vector.

Definition at line 457 of file vtkMath.h.

static double vtkMath::Norm2D ( const double  x[2])
inlinestatic

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

Definition at line 463 of file vtkMath.h.

static float vtkMath::Normalize2D ( float  x[2])
static

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

static double vtkMath::Normalize2D ( double  x[2])
static

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

static float vtkMath::Determinant2x2 ( const float  c1[2],
const float  c2[2] 
)
inlinestatic

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

Definition at line 476 of file vtkMath.h.

static double vtkMath::Determinant2x2 ( double  a,
double  b,
double  c,
double  d 
)
inlinestatic

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

Definition at line 482 of file vtkMath.h.

static double vtkMath::Determinant2x2 ( const double  c1[2],
const double  c2[2] 
)
inlinestatic

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

Definition at line 484 of file vtkMath.h.

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

LU Factorization of a 3x3 matrix.

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

LU Factorization of a 3x3 matrix.

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

LU back substitution for a 3x3 matrix.

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

LU back substitution for a 3x3 matrix.

static 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.

static 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.

static 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.

static 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.

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

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

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

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

static void vtkMath::MultiplyMatrix ( double **  A,
double **  B,
unsigned int  rowA,
unsigned int  colA,
unsigned int  rowB,
unsigned int  colB,
double **  C 
)
static

General matrix multiplication. You must allocate output storage. colA == rowB and matrix C is rowA x colB

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

Transpose a 3x3 matrix. The input matrix is A. The output is stored in AT.

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

Transpose a 3x3 matrix. The input matrix is A. The output is stored in AT.

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

Invert a 3x3 matrix. The input matrix is A. The output is stored in AI.

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

Invert a 3x3 matrix. The input matrix is A. The output is stored in AI.

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

Set A to the identity matrix.

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

Set A to the identity matrix.

double vtkMath::Determinant3x3 ( float  A[3][3])
inlinestatic

Return the determinant of a 3x3 matrix.

Definition at line 1166 of file vtkMath.h.

double vtkMath::Determinant3x3 ( double  A[3][3])
inlinestatic

Return the determinant of a 3x3 matrix.

Definition at line 1172 of file vtkMath.h.

float vtkMath::Determinant3x3 ( const float  c1[3],
const float  c2[3],
const float  c3[3] 
)
inlinestatic

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

Definition at line 1089 of file vtkMath.h.

double vtkMath::Determinant3x3 ( const double  c1[3],
const double  c2[3],
const double  c3[3] 
)
inlinestatic

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

Definition at line 1098 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 
)
inlinestatic

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

Definition at line 1107 of file vtkMath.h.

static 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. The quaternion must be in the form [w, x, y, z].

See also
Matrix3x3ToQuaternion() MultiplyQuaternion()
vtkQuaternion
static 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. The quaternion must be in the form [w, x, y, z].

See also
Matrix3x3ToQuaternion() MultiplyQuaternion()
vtkQuaternion
static 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 quaternion is in the form [w, x, y, z]. The method used is that of B.K.P. Horn.

See also
QuaternionToMatrix3x3() MultiplyQuaternion()
vtkQuaternion
static 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 quaternion is in the form [w, x, y, z]. The method used is that of B.K.P. Horn.

See also
QuaternionToMatrix3x3() MultiplyQuaternion()
vtkQuaternion
static void vtkMath::MultiplyQuaternion ( const float  q1[4],
const float  q2[4],
float  q[4] 
)
static

Multiply two quaternions. This is used to concatenate rotations. Quaternions are in the form [w, x, y, z].

See also
Matrix3x3ToQuaternion() QuaternionToMatrix3x3()
vtkQuaternion
static void vtkMath::MultiplyQuaternion ( const double  q1[4],
const double  q2[4],
double  q[4] 
)
static

Multiply two quaternions. This is used to concatenate rotations. Quaternions are in the form [w, x, y, z].

See also
Matrix3x3ToQuaternion() QuaternionToMatrix3x3()
vtkQuaternion
static 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.

static 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.

static 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.

static 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.

static 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.

static 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.

static 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.

static 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.

static 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.

static int vtkMath::LUFactorLinearSystem ( double **  A,
int index,
int  size 
)
static

Factor linear equations Ax = b using LU decomposition into the form A = LU where L is a unit lower triangular matrix and U is upper triangular matrix. The input is a square matrix A, an integer array of pivot indices index[0->n-1], and the size, n, of the square matrix. The output is provided by overwriting the input A with a matrix of the same size as A containing all of the information about L and U. If the output matrix is $ A* = \left( \begin{array}{cc} a & b \\ % c & d \end{array} \right)$ then L and U can be obtained as: $ L = \left( \begin{array}{cc} 1 & 0 \\ % c & 1 \end{array} \right)$ $ U = \left( \begin{array}{cc} a & b \\ % 0 & d \end{array} \right)$ That is, the diagonal of the resulting A* is the diagonal of U. The upper right triangle of A is the upper right triangle of U. The lower left triangle of A is the lower left triangle of L (and since L is unit lower triangular, the diagonal of L is all 1's). If an error is found, the function returns 0.

static 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.

static 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.

static 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.)

static 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. NOTE: the input matirx a is modified during the solution

static 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. NOTE: the input matirx a is modified during the solution

static 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 NOTE: the input matirx a is modified during the solution

static 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 NOTE: the input matirx a is modified during the solution

static 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

static 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.

static void vtkMath::RGBToHSV ( const float  rgb[3],
float  hsv[3] 
)
inlinestatic

Convert color in RGB format (Red, Green, Blue) to HSV format (Hue, Saturation, Value). The input color is not modified. The input RGB must be float values in the range [0,1]. The output ranges are hue [0, 1], saturation [0, 1], and value [0, 1].

Definition at line 764 of file vtkMath.h.

static 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. The input RGB must be float values in the range [0,1]. The output ranges are hue [0, 1], saturation [0, 1], and value [0, 1].

static double* vtkMath::RGBToHSV ( const double  rgb[3])
static

Convert color in RGB format (Red, Green, Blue) to HSV format (Hue, Saturation, Value). The input color is not modified. The input RGB must be float values in the range [0,1]. The output ranges are hue [0, 1], saturation [0, 1], and value [0, 1].

static double* vtkMath::RGBToHSV ( double  r,
double  g,
double  b 
)
static

Convert color in RGB format (Red, Green, Blue) to HSV format (Hue, Saturation, Value). The input color is not modified. The input RGB must be float values in the range [0,1]. The output ranges are hue [0, 1], saturation [0, 1], and value [0, 1].

static void vtkMath::RGBToHSV ( const double  rgb[3],
double  hsv[3] 
)
inlinestatic

Convert color in RGB format (Red, Green, Blue) to HSV format (Hue, Saturation, Value). The input color is not modified. The input RGB must be float values in the range [0,1]. The output ranges are hue [0, 1], saturation [0, 1], and value [0, 1].

Definition at line 769 of file vtkMath.h.

static 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. The input RGB must be float values in the range [0,1]. The output ranges are hue [0, 1], saturation [0, 1], and value [0, 1].

static void vtkMath::HSVToRGB ( const float  hsv[3],
float  rgb[3] 
)
inlinestatic

Convert color in HSV format (Hue, Saturation, Value) to RGB format (Red, Green, Blue). The input color is not modified. The input 'hsv' must be float values in the range [0,1]. The elements of each component of the output 'rgb' are in the range [0, 1].

Definition at line 779 of file vtkMath.h.

static 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. The input 'hsv' must be float values in the range [0,1]. The elements of each component of the output 'rgb' are in the range [0, 1].

static double* vtkMath::HSVToRGB ( const double  hsv[3])
static

Convert color in HSV format (Hue, Saturation, Value) to RGB format (Red, Green, Blue). The input color is not modified. The input 'hsv' must be float values in the range [0,1]. The elements of each component of the output 'rgb' are in the range [0, 1].

static double* vtkMath::HSVToRGB ( double  h,
double  s,
double  v 
)
static

Convert color in HSV format (Hue, Saturation, Value) to RGB format (Red, Green, Blue). The input color is not modified. The input 'hsv' must be float values in the range [0,1]. The elements of each component of the output 'rgb' are in the range [0, 1].

static void vtkMath::HSVToRGB ( const double  hsv[3],
double  rgb[3] 
)
inlinestatic

Convert color in HSV format (Hue, Saturation, Value) to RGB format (Red, Green, Blue). The input color is not modified. The input 'hsv' must be float values in the range [0,1]. The elements of each component of the output 'rgb' are in the range [0, 1].

Definition at line 784 of file vtkMath.h.

static 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. The input 'hsv' must be float values in the range [0,1]. The elements of each component of the output 'rgb' are in the range [0, 1].

static void vtkMath::LabToXYZ ( const double  lab[3],
double  xyz[3] 
)
inlinestatic

Convert color from the CIE-L*ab system to CIE XYZ.

Definition at line 791 of file vtkMath.h.

static void vtkMath::LabToXYZ ( double  L,
double  a,
double  b,
double x,
double y,
double z 
)
static

Convert color from the CIE-L*ab system to CIE XYZ.

static double* vtkMath::LabToXYZ ( const double  lab[3])
static

Convert color from the CIE-L*ab system to CIE XYZ.

static void vtkMath::XYZToLab ( const double  xyz[3],
double  lab[3] 
)
inlinestatic

Convert Color from the CIE XYZ system to CIE-L*ab.

Definition at line 801 of file vtkMath.h.

static void vtkMath::XYZToLab ( double  x,
double  y,
double  z,
double L,
double a,
double b 
)
static

Convert Color from the CIE XYZ system to CIE-L*ab.

static double* vtkMath::XYZToLab ( const double  xyz[3])
static

Convert Color from the CIE XYZ system to CIE-L*ab.

static void vtkMath::XYZToRGB ( const double  xyz[3],
double  rgb[3] 
)
inlinestatic

Convert color from the CIE XYZ system to RGB.

Definition at line 811 of file vtkMath.h.

static void vtkMath::XYZToRGB ( double  x,
double  y,
double  z,
double r,
double g,
double b 
)
static

Convert color from the CIE XYZ system to RGB.

static double* vtkMath::XYZToRGB ( const double  xyz[3])
static

Convert color from the CIE XYZ system to RGB.

static void vtkMath::RGBToXYZ ( const double  rgb[3],
double  xyz[3] 
)
inlinestatic

Convert color from the RGB system to CIE XYZ.

Definition at line 821 of file vtkMath.h.

static void vtkMath::RGBToXYZ ( double  r,
double  g,
double  b,
double x,
double y,
double z 
)
static

Convert color from the RGB system to CIE XYZ.

static double* vtkMath::RGBToXYZ ( const double  rgb[3])
static

Convert color from the RGB system to CIE XYZ.

static void vtkMath::RGBToLab ( const double  rgb[3],
double  lab[3] 
)
inlinestatic

Convert color from the RGB system to CIE-L*ab. The input RGB must be values in the range [0,1]. The output ranges of 'L' is [0, 100]. The output range of 'a' and 'b' are approximately [-110, 110].

Definition at line 833 of file vtkMath.h.

static void vtkMath::RGBToLab ( double  red,
double  green,
double  blue,
double L,
double a,
double b 
)
static

Convert color from the RGB system to CIE-L*ab. The input RGB must be values in the range [0,1]. The output ranges of 'L' is [0, 100]. The output range of 'a' and 'b' are approximately [-110, 110].

static double* vtkMath::RGBToLab ( const double  rgb[3])
static

Convert color from the RGB system to CIE-L*ab. The input RGB must be values in the range [0,1]. The output ranges of 'L' is [0, 100]. The output range of 'a' and 'b' are approximately [-110, 110].

static void vtkMath::LabToRGB ( const double  lab[3],
double  rgb[3] 
)
inlinestatic

Convert color from the CIE-L*ab system to RGB.

Definition at line 843 of file vtkMath.h.

static void vtkMath::LabToRGB ( double  L,
double  a,
double  b,
double red,
double green,
double blue 
)
static

Convert color from the CIE-L*ab system to RGB.

static double* vtkMath::LabToRGB ( const double  lab[3])
static

Convert color from the CIE-L*ab system to RGB.

static void vtkMath::UninitializeBounds ( double  bounds[6])
inlinestatic

Set the bounds to an uninitialized state

Definition at line 853 of file vtkMath.h.

static int vtkMath::AreBoundsInitialized ( double  bounds[6])
inlinestatic

Are the bounds initialized?

Definition at line 865 of file vtkMath.h.

void vtkMath::ClampValue ( double value,
const double  range[2] 
)
inlinestatic

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

Definition at line 1178 of file vtkMath.h.

void vtkMath::ClampValue ( double  value,
const double  range[2],
double clamped_value 
)
inlinestatic

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

Definition at line 1194 of file vtkMath.h.

static 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.

static 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.

double vtkMath::ClampAndNormalizeValue ( double  value,
const double  range[2] 
)
inlinestatic

Clamp a value against a range and then normalized it between 0 and 1. If range[0]==range[1], the result is 0.

Precondition
valid_range: range[0]<=range[1]
Postcondition
valid_result: result>=0.0 && result<=1.0

Definition at line 1215 of file vtkMath.h.

static int vtkMath::GetScalarTypeFittingRange ( double  range_min,
double  range_max,
double  scale = 1.0,
double  shift = 0.0 
)
static

Return the scalar type that is most likely to have enough precision to store a given range of data once it has been scaled and shifted (i.e. [range_min * scale + shift, range_max * scale + shift]. If any one of the parameters is not an integer number (decimal part != 0), the search will default to float types only (float or double) Return -1 on error or no scalar type found.

static int vtkMath::GetAdjustedScalarRange ( vtkDataArray array,
int  comp,
double  range[2] 
)
static

Get a vtkDataArray's scalar range for a given component. If the vtkDataArray's data type is unsigned char (VTK_UNSIGNED_CHAR) the range is adjusted to the whole data type range [0, 255.0]. Same goes for unsigned short (VTK_UNSIGNED_SHORT) but the upper bound is also adjusted down to 4095.0 if was between ]255, 4095.0]. Return 1 on success, 0 otherwise.

static int vtkMath::ExtentIsWithinOtherExtent ( int  extent1[6],
int  extent2[6] 
)
static

Return true if first 3D extent is within second 3D extent Extent is x-min, x-max, y-min, y-max, z-min, z-max

static int vtkMath::BoundsIsWithinOtherBounds ( double  bounds1[6],
double  bounds2[6],
double  delta[3] 
)
static

Return true if first 3D bounds is within the second 3D bounds Bounds is x-min, x-max, y-min, y-max, z-min, z-max Delta is the error margin along each axis (usually a small number)

static int vtkMath::PointIsWithinBounds ( double  point[3],
double  bounds[6],
double  delta[3] 
)
static

Return true if point is within the given 3D bounds Bounds is x-min, x-max, y-min, y-max, z-min, z-max Delta is the error margin along each axis (usually a small number)

static double vtkMath::Solve3PointCircle ( const double  p1[3],
const double  p2[3],
const double  p3[3],
double  center[3] 
)
static

In Euclidean space, there is a unique circle passing through any given three non-collinear points P1, P2, and P3. Using Cartesian coordinates to represent these points as spatial vectors, it is possible to use the dot product and cross product to calculate the radius and center of the circle. See: http://en.wikipedia.org/wiki/Circumscribed_circle and more specifically the section Barycentric coordinates from cross- and dot-products

static double vtkMath::Inf ( )
static

Special IEEE-754 number used to represent positive infinity.

static double vtkMath::NegInf ( )
static

Special IEEE-754 number used to represent negative infinity.

static double vtkMath::Nan ( )
static

Special IEEE-754 number used to represent Not-A-Number (Nan).

static int vtkMath::IsInf ( double  x)
static

Test if a number is equal to the special floating point value infinity.

static int vtkMath::IsNan ( double  x)
static

Test if a number is equal to the special floating point value Not-A-Number (Nan).

static bool vtkMath::IsFinite ( double  x)
static

Test if a number has finite value i.e. it is normal, subnormal or zero, but not infinite or Nan.

Member Data Documentation

vtkMathInternal vtkMath::Internal
staticprotected

Definition at line 965 of file vtkMath.h.


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