|  | VTK
    9.0.1
    | 
 
 
 
Go to the documentation of this file.
   42 #include "vtkCommonCoreModule.h"  
   47 #include "vtkMathConfigure.h"  
   53 #define VTK_DBL_MIN 2.2250738585072014e-308 
   55 #define VTK_DBL_MIN DBL_MIN 
   59 #define VTK_DBL_EPSILON 2.2204460492503131e-16 
   61 #define VTK_DBL_EPSILON DBL_EPSILON 
   64 #ifndef VTK_DBL_EPSILON 
   66 #define VTK_DBL_EPSILON 2.2204460492503131e-16 
   68 #define VTK_DBL_EPSILON DBL_EPSILON 
   70 #endif // VTK_DBL_EPSILON 
   74 class vtkMathInternal;
 
   81 template <
typename OutT>
 
   95   static double Pi() { 
return 3.141592653589793; }
 
  101   static float RadiansFromDegrees(
float degrees);
 
  102   static double RadiansFromDegrees(
double degrees);
 
  109   static float DegreesFromRadians(
float radians);
 
  110   static double DegreesFromRadians(
double radians);
 
  117   static int Round(
float f) { 
return static_cast<int>(f + (f >= 0.0 ? 0.5 : -0.5)); }
 
  118   static int Round(
double f) { 
return static_cast<int>(f + (f >= 0.0 ? 0.5 : -0.5)); }
 
  125   template <
typename OutT>
 
  138   static int Floor(
double x);
 
  145   static int Ceil(
double x);
 
  152   static int CeilLog2(vtkTypeUInt64 x);
 
  159   static T Min(
const T& a, 
const T& b);
 
  166   static T Max(
const T& a, 
const T& b);
 
  171   static bool IsPowerOfTwo(vtkTypeUInt64 x);
 
  178   static int NearestPowerOfTwo(
int x);
 
  184   static vtkTypeInt64 Factorial(
int N);
 
  191   static vtkTypeInt64 Binomial(
int m, 
int n);
 
  204   static int* BeginCombination(
int m, 
int n);
 
  216   static int NextCombination(
int m, 
int n, 
int* combination);
 
  221   static void FreeCombination(
int* combination);
 
  238   static void RandomSeed(
int s);
 
  251   static int GetSeed();
 
  266   static double Random();
 
  280   static double Random(
double min, 
double max);
 
  294   static double Gaussian();
 
  308   static double Gaussian(
double mean, 
double std);
 
  313   static void Add(
const float a[3], 
const float b[3], 
float c[3])
 
  315     for (
int i = 0; i < 3; ++i)
 
  324   static void Add(
const double a[3], 
const double b[3], 
double c[3])
 
  326     for (
int i = 0; i < 3; ++i)
 
  335   static void Subtract(
const float a[3], 
const float b[3], 
float c[3])
 
  337     for (
int i = 0; i < 3; ++i)
 
  346   static void Subtract(
const double a[3], 
const double b[3], 
double c[3])
 
  348     for (
int i = 0; i < 3; ++i)
 
  360     for (
int i = 0; i < 3; ++i)
 
  372     for (
int i = 0; i < 2; ++i)
 
  384     for (
int i = 0; i < 3; ++i)
 
  396     for (
int i = 0; i < 2; ++i)
 
  405   static float Dot(
const float a[3], 
const float b[3])
 
  407     return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
 
  413   static double Dot(
const double a[3], 
const double b[3])
 
  415     return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
 
  421   static void Outer(
const float a[3], 
const float b[3], 
float c[3][3])
 
  423     for (
int i = 0; i < 3; ++i)
 
  425       for (
int j = 0; j < 3; ++j)
 
  427         c[i][j] = a[i] * b[j];
 
  435   static void Outer(
const double a[3], 
const double b[3], 
double c[3][3])
 
  437     for (
int i = 0; i < 3; ++i)
 
  439       for (
int j = 0; j < 3; ++j)
 
  441         c[i][j] = a[i] * b[j];
 
  450   static void Cross(
const float a[3], 
const float b[3], 
float c[3]);
 
  456   static void Cross(
const double a[3], 
const double b[3], 
double c[3]);
 
  462   static float Norm(
const float* x, 
int n);
 
  463   static double Norm(
const double* x, 
int n);
 
  469   static float Norm(
const float v[3]) { 
return std::sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]); }
 
  474   static double Norm(
const double v[3])
 
  476     return std::sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]);
 
  483   static float Normalize(
float v[3]);
 
  489   static double Normalize(
double v[3]);
 
  499   static void Perpendiculars(
const double v1[3], 
double v2[3], 
double v3[3], 
double theta);
 
  500   static void Perpendiculars(
const float v1[3], 
float v2[3], 
float v3[3], 
double theta);
 
  509   static bool ProjectVector(
const float a[3], 
const float b[3], 
float projection[3]);
 
  510   static bool ProjectVector(
const double a[3], 
const double b[3], 
double projection[3]);
 
  520   static bool ProjectVector2D(
const float a[2], 
const float b[2], 
float projection[2]);
 
  521   static bool ProjectVector2D(
const double a[2], 
const double b[2], 
double projection[2]);
 
  528   static float Distance2BetweenPoints(
const float p1[3], 
const float p2[3]);
 
  534   static double Distance2BetweenPoints(
const double p1[3], 
const double p2[3]);
 
  539   static double AngleBetweenVectors(
const double v1[3], 
const double v2[3]);
 
  545   static double GaussianAmplitude(
const double variance, 
const double distanceFromMean);
 
  551   static double GaussianAmplitude(
const double mean, 
const double variance, 
const double position);
 
  558   static double GaussianWeight(
const double variance, 
const double distanceFromMean);
 
  565   static double GaussianWeight(
const double mean, 
const double variance, 
const double position);
 
  570   static float Dot2D(
const float x[2], 
const float y[2]) { 
return x[0] * y[0] + x[1] * y[1]; }
 
  575   static double Dot2D(
const double x[2], 
const double y[2]) { 
return x[0] * y[0] + x[1] * y[1]; }
 
  580   static void Outer2D(
const float x[2], 
const float y[2], 
float A[2][2])
 
  582     for (
int i = 0; i < 2; ++i)
 
  584       for (
int j = 0; j < 2; ++j)
 
  586         A[i][j] = x[i] * y[j];
 
  594   static void Outer2D(
const double x[2], 
const double y[2], 
double A[2][2])
 
  596     for (
int i = 0; i < 2; ++i)
 
  598       for (
int j = 0; j < 2; ++j)
 
  600         A[i][j] = x[i] * y[j];
 
  609   static float Norm2D(
const float x[2]) { 
return std::sqrt(x[0] * x[0] + x[1] * x[1]); }
 
  615   static double Norm2D(
const double x[2]) { 
return std::sqrt(x[0] * x[0] + x[1] * x[1]); }
 
  621   static float Normalize2D(
float v[2]);
 
  627   static double Normalize2D(
double v[2]);
 
  634     return c1[0] * c2[1] - c2[0] * c1[1];
 
  641   static double Determinant2x2(
double a, 
double b, 
double c, 
double d) { 
return a * d - b * c; }
 
  644     return c1[0] * c2[1] - c2[0] * c1[1];
 
  652   static void LUFactor3x3(
float A[3][3], 
int index[3]);
 
  653   static void LUFactor3x3(
double A[3][3], 
int index[3]);
 
  660   static void LUSolve3x3(
const float A[3][3], 
const int index[3], 
float x[3]);
 
  661   static void LUSolve3x3(
const double A[3][3], 
const int index[3], 
double x[3]);
 
  669   static void LinearSolve3x3(
const float A[3][3], 
const float x[3], 
float y[3]);
 
  670   static void LinearSolve3x3(
const double A[3][3], 
const double x[3], 
double y[3]);
 
  677   static void Multiply3x3(
const float A[3][3], 
const float in[3], 
float out[3]);
 
  678   static void Multiply3x3(
const double A[3][3], 
const double in[3], 
double out[3]);
 
  685   static void Multiply3x3(
const float A[3][3], 
const float B[3][3], 
float C[3][3]);
 
  686   static void Multiply3x3(
const double A[3][3], 
const double B[3][3], 
double C[3][3]);
 
  694   static void MultiplyMatrix(
const double* 
const* A, 
const double* 
const* B, 
unsigned int rowA,
 
  695     unsigned int colA, 
unsigned int rowB, 
unsigned int colB, 
double** C);
 
  702   static void Transpose3x3(
const float A[3][3], 
float AT[3][3]);
 
  703   static void Transpose3x3(
const double A[3][3], 
double AT[3][3]);
 
  711   static void Invert3x3(
const float A[3][3], 
float AI[3][3]);
 
  712   static void Invert3x3(
const double A[3][3], 
double AI[3][3]);
 
  719   static void Identity3x3(
float A[3][3]);
 
  720   static void Identity3x3(
double A[3][3]);
 
  727   static double Determinant3x3(
const float A[3][3]);
 
  728   static double Determinant3x3(
const double A[3][3]);
 
  734   static float Determinant3x3(
const float c1[3], 
const float c2[3], 
const float c3[3]);
 
  739   static double Determinant3x3(
const double c1[3], 
const double c2[3], 
const double c3[3]);
 
  747   static double Determinant3x3(
double a1, 
double a2, 
double a3, 
double b1, 
double b2, 
double b3,
 
  748     double c1, 
double c2, 
double c3);
 
  758   static void QuaternionToMatrix3x3(
const float quat[4], 
float A[3][3]);
 
  759   static void QuaternionToMatrix3x3(
const double quat[4], 
double A[3][3]);
 
  772   static void Matrix3x3ToQuaternion(
const float A[3][3], 
float quat[4]);
 
  773   static void Matrix3x3ToQuaternion(
const double A[3][3], 
double quat[4]);
 
  783   static void MultiplyQuaternion(
const float q1[4], 
const float q2[4], 
float q[4]);
 
  784   static void MultiplyQuaternion(
const double q1[4], 
const double q2[4], 
double q[4]);
 
  792   static void RotateVectorByNormalizedQuaternion(
const float v[3], 
const float q[4], 
float r[3]);
 
  793   static void RotateVectorByNormalizedQuaternion(
const double v[3], 
const double q[4], 
double r[3]);
 
  801   static void RotateVectorByWXYZ(
const float v[3], 
const float q[4], 
float r[3]);
 
  802   static void RotateVectorByWXYZ(
const double v[3], 
const double q[4], 
double r[3]);
 
  811   static void Orthogonalize3x3(
const float A[3][3], 
float B[3][3]);
 
  812   static void Orthogonalize3x3(
const double A[3][3], 
double B[3][3]);
 
  822   static void Diagonalize3x3(
const float A[3][3], 
float w[3], 
float V[3][3]);
 
  823   static void Diagonalize3x3(
const double A[3][3], 
double w[3], 
double V[3][3]);
 
  836   static void SingularValueDecomposition3x3(
 
  837     const float A[3][3], 
float U[3][3], 
float w[3], 
float VT[3][3]);
 
  838   static void SingularValueDecomposition3x3(
 
  839     const double A[3][3], 
double U[3][3], 
double w[3], 
double VT[3][3]);
 
  864     double** A, 
double** AI, 
int size, 
int* tmp1Size, 
double* tmp2Size);
 
  905   static void LUSolveLinearSystem(
double** A, 
int* 
index, 
double* x, 
int size);
 
  915   static double EstimateMatrixCondition(
const double* 
const* A, 
int size);
 
  926   static vtkTypeBool Jacobi(
float** a, 
float* w, 
float** v);
 
  927   static vtkTypeBool Jacobi(
double** a, 
double* w, 
double** v);
 
  940   static vtkTypeBool JacobiN(
float** a, 
int n, 
float* w, 
float** v);
 
  941   static vtkTypeBool JacobiN(
double** a, 
int n, 
double* w, 
double** v);
 
  958     int numberOfSamples, 
double** xt, 
int xOrder, 
double** mt);
 
  974   static vtkTypeBool SolveLeastSquares(
int numberOfSamples, 
double** xt, 
int xOrder, 
double** yt,
 
  975     int yOrder, 
double** mt, 
int checkHomogeneous = 1);
 
  985   static void RGBToHSV(
const float rgb[3], 
float hsv[3])
 
  987     RGBToHSV(rgb[0], rgb[1], rgb[2], hsv, hsv + 1, hsv + 2);
 
  989   static void RGBToHSV(
float r, 
float g, 
float b, 
float* 
h, 
float* s, 
float* v);
 
  990   static void RGBToHSV(
const double rgb[3], 
double hsv[3])
 
  992     RGBToHSV(rgb[0], rgb[1], rgb[2], hsv, hsv + 1, hsv + 2);
 
  994   static void RGBToHSV(
double r, 
double g, 
double b, 
double* 
h, 
double* s, 
double* v);
 
 1007     HSVToRGB(hsv[0], hsv[1], hsv[2], rgb, rgb + 1, rgb + 2);
 
 1009   static void HSVToRGB(
float h, 
float s, 
float v, 
float* r, 
float* g, 
float* b);
 
 1010   static void HSVToRGB(
const double hsv[3], 
double rgb[3])
 
 1012     HSVToRGB(hsv[0], hsv[1], hsv[2], rgb, rgb + 1, rgb + 2);
 
 1014   static void HSVToRGB(
double h, 
double s, 
double v, 
double* r, 
double* g, 
double* b);
 
 1021   static void LabToXYZ(
const double lab[3], 
double xyz[3])
 
 1023     LabToXYZ(lab[0], lab[1], lab[2], xyz + 0, xyz + 1, xyz + 2);
 
 1025   static void LabToXYZ(
double L, 
double a, 
double b, 
double* x, 
double* y, 
double* z);
 
 1032   static void XYZToLab(
const double xyz[3], 
double lab[3])
 
 1034     XYZToLab(xyz[0], xyz[1], xyz[2], lab + 0, lab + 1, lab + 2);
 
 1036   static void XYZToLab(
double x, 
double y, 
double z, 
double* L, 
double* a, 
double* b);
 
 1043   static void XYZToRGB(
const double xyz[3], 
double rgb[3])
 
 1045     XYZToRGB(xyz[0], xyz[1], xyz[2], rgb + 0, rgb + 1, rgb + 2);
 
 1047   static void XYZToRGB(
double x, 
double y, 
double z, 
double* r, 
double* g, 
double* b);
 
 1054   static void RGBToXYZ(
const double rgb[3], 
double xyz[3])
 
 1056     RGBToXYZ(rgb[0], rgb[1], rgb[2], xyz + 0, xyz + 1, xyz + 2);
 
 1058   static void RGBToXYZ(
double r, 
double g, 
double b, 
double* x, 
double* y, 
double* z);
 
 1068   static void RGBToLab(
const double rgb[3], 
double lab[3])
 
 1070     RGBToLab(rgb[0], rgb[1], rgb[2], lab + 0, lab + 1, lab + 2);
 
 1072   static void RGBToLab(
double red, 
double green, 
double blue, 
double* L, 
double* a, 
double* b);
 
 1079   static void LabToRGB(
const double lab[3], 
double rgb[3])
 
 1081     LabToRGB(lab[0], lab[1], lab[2], rgb + 0, rgb + 1, rgb + 2);
 
 1083   static void LabToRGB(
double L, 
double a, 
double b, 
double* red, 
double* green, 
double* blue);
 
 1107     if (bounds[1] - bounds[0] < 0.0)
 
 1120   static T ClampValue(
const T& 
value, 
const T& min, 
const T& 
max);
 
 1127   static void ClampValue(
double* 
value, 
const double range[2]);
 
 1128   static void ClampValue(
double value, 
const double range[2], 
double* clamped_value);
 
 1129   static void ClampValues(
double* values, 
int nb_values, 
const double range[2]);
 
 1130   static void ClampValues(
 
 1131     const double* values, 
int nb_values, 
const double range[2], 
double* clamped_values);
 
 1140   static double ClampAndNormalizeValue(
double value, 
const double range[2]);
 
 1146   template <
class T1, 
class T2>
 
 1147   static void TensorFromSymmetricTensor(
const T1 symmTensor[6], T2 tensor[9]);
 
 1155   static void TensorFromSymmetricTensor(T tensor[9]);
 
 1165   static int GetScalarTypeFittingRange(
 
 1166     double range_min, 
double range_max, 
double scale = 1.0, 
double shift = 0.0);
 
 1182   static vtkTypeBool ExtentIsWithinOtherExtent(
const int extent1[6], 
const int extent2[6]);
 
 1190     const double bounds1[6], 
const double bounds2[6], 
const double delta[3]);
 
 1198     const double point[3], 
const double bounds[6], 
const double delta[3]);
 
 1209   static int PlaneIntersectsAABB(
 
 1210     const double bounds[6], 
const double normal[3], 
const double point[3]);
 
 1221   static double Solve3PointCircle(
 
 1222     const double p1[3], 
const double p2[3], 
const double p3[3], 
double center[3]);
 
 1227   static double Inf();
 
 1232   static double NegInf();
 
 1237   static double Nan();
 
 1253   static bool IsFinite(
double x);
 
 1259   static int QuadraticRoot(
double a, 
double b, 
double c, 
double min, 
double max, 
double* u);
 
 1269   void operator=(
const vtkMath&) = 
delete;
 
 1275   return x * 0.017453292f;
 
 1281   return x * 0.017453292519943295;
 
 1287   return x * 57.2957795131f;
 
 1293   return x * 57.29577951308232;
 
 1299   return ((x != 0) & ((x & (x - 1)) == 0));
 
 1306   unsigned int z = 
static_cast<unsigned int>(((x > 0) ? x - 1 : 0));
 
 1312   return static_cast<int>(z + 1);
 
 1320   int i = 
static_cast<int>(x);
 
 1329   int i = 
static_cast<int>(x);
 
 1337   return (b <= a ? b : a);
 
 1344   return (b > a ? b : a);
 
 1353     for (
int i = 0; i < 3; ++i)
 
 1367     for (
int i = 0; i < 3; ++i)
 
 1381     for (
int i = 0; i < 2; ++i)
 
 1395     for (
int i = 0; i < 2; ++i)
 
 1406   return c1[0] * c2[1] * c3[2] + c2[0] * c3[1] * c1[2] + c3[0] * c1[1] * c2[2] -
 
 1407     c1[0] * c3[1] * c2[2] - c2[0] * c1[1] * c3[2] - c3[0] * c2[1] * c1[2];
 
 1413   return c1[0] * c2[1] * c3[2] + c2[0] * c3[1] * c1[2] + c3[0] * c1[1] * c2[2] -
 
 1414     c1[0] * c3[1] * c2[2] - c2[0] * c1[1] * c3[2] - c3[0] * c2[1] * c1[2];
 
 1419   double a1, 
double a2, 
double a3, 
double b1, 
double b2, 
double b3, 
double c1, 
double c2, 
double c3)
 
 1428   return ((p1[0] - p2[0]) * (p1[0] - p2[0]) + (p1[1] - p2[1]) * (p1[1] - p2[1]) +
 
 1429     (p1[2] - p2[2]) * (p1[2] - p2[2]));
 
 1435   return ((p1[0] - p2[0]) * (p1[0] - p2[0]) + (p1[1] - p2[1]) * (p1[1] - p2[1]) +
 
 1436     (p1[2] - p2[2]) * (p1[2] - p2[2]));
 
 1443   float Cx = a[1] * b[2] - a[2] * b[1];
 
 1444   float Cy = a[2] * b[0] - a[0] * b[2];
 
 1445   float Cz = a[0] * b[1] - a[1] * b[0];
 
 1455   double Cx = a[1] * b[2] - a[2] * b[1];
 
 1456   double Cy = a[2] * b[0] - a[0] * b[2];
 
 1457   double Cz = a[0] * b[1] - a[1] * b[0];
 
 1467   return A[0][0] * A[1][1] * A[2][2] + A[1][0] * A[2][1] * A[0][2] + A[2][0] * A[0][1] * A[1][2] -
 
 1468     A[0][0] * A[2][1] * A[1][2] - A[1][0] * A[0][1] * A[2][2] - A[2][0] * A[1][1] * A[0][2];
 
 1487   assert(
"pre: valid_range" && min <= 
max);
 
 1489 #if __cplusplus >= 201703L 
 1490   return std::clamp(
value, min, 
max);
 
 1495   return (v < 
max ? v : 
max);
 
 1504     assert(
"pre: valid_range" && 
range[0] <= 
range[1]);
 
 1513   if (
range && clamped_value)
 
 1515     assert(
"pre: valid_range" && 
range[0] <= 
range[1]);
 
 1524   assert(
"pre: valid_range" && 
range[0] <= 
range[1]);
 
 1540   assert(
"post: valid_result" && result >= 0.0 && result <= 1.0);
 
 1546 template <
class T1, 
class T2>
 
 1549   for (
int i = 0; i < 3; ++i)
 
 1551     tensor[4 * i] = symmTensor[i];
 
 1553   tensor[1] = tensor[3] = symmTensor[3];
 
 1554   tensor[2] = tensor[6] = symmTensor[5];
 
 1555   tensor[5] = tensor[7] = symmTensor[4];
 
 1562   tensor[6] = tensor[5]; 
 
 1563   tensor[7] = tensor[4]; 
 
 1564   tensor[8] = tensor[2]; 
 
 1565   tensor[4] = tensor[1]; 
 
 1566   tensor[5] = tensor[7]; 
 
 1567   tensor[2] = tensor[6]; 
 
 1568   tensor[1] = tensor[3]; 
 
 1574 template <
typename OutT>
 
 1582     *ret = 
static_cast<OutT
>((val >= 0.0) ? (val + 0.5) : (val - 0.5));
 
 1600     *retVal = 
static_cast<float>(val);
 
 1608 #if defined(VTK_HAS_ISINF) || defined(VTK_HAS_STD_ISINF) 
 1609 #define VTK_MATH_ISINF_IS_INLINE 
 1612 #if defined(VTK_HAS_STD_ISINF) 
 1613   return std::isinf(x);
 
 1615   return (isinf(x) != 0);    
 
 1621 #if defined(VTK_HAS_ISNAN) || defined(VTK_HAS_STD_ISNAN) 
 1622 #define VTK_MATH_ISNAN_IS_INLINE 
 1625 #if defined(VTK_HAS_STD_ISNAN) 
 1628   return (
isnan(x) != 0);    
 
 1634 #if defined(VTK_HAS_ISFINITE) || defined(VTK_HAS_STD_ISFINITE) || defined(VTK_HAS_FINITE) 
 1635 #define VTK_MATH_ISFINITE_IS_INLINE 
 1638 #if defined(VTK_HAS_STD_ISFINITE) 
 1639   return std::isfinite(x);
 
 1640 #elif defined(VTK_HAS_ISFINITE) 
 1641   return (isfinite(x) != 0); 
 
 1643   return (finite(x) != 0); 
 
  
represent and manipulate 3D points
static int Ceil(double x)
Rounds a double to the nearest integer not less than itself.
static void RGBToLab(const double rgb[3], double lab[3])
Convert color from the RGB system to CIE-L*ab.
static void MultiplyScalar(double a[3], double s)
Multiplies a 3-vector by a scalar (double version).
static float Norm(const float *x, int n)
Compute the norm of n-vector.
static void RGBToHSV(const double rgb[3], double hsv[3])
static int Floor(double x)
Rounds a double to the nearest integer not greater than itself.
static double Dot(const double a[3], const double b[3])
Dot product of two 3-vectors (double version).
Park and Miller Sequence of pseudo random numbers.
static vtkTypeBool IsNan(double x)
Test if a number is equal to the special floating point value Not-A-Number (Nan).
Template defining traits of native types used by VTK.
static int NearestPowerOfTwo(int x)
Compute the nearest power of two that is not less than x.
static float Normalize(float v[3])
Normalize (in place) a 3-vector.
static double Determinant2x2(double a, double b, double c, double d)
Calculate the determinant of a 2x2 matrix: | a b | | c d |.
static void RGBToHSV(const float rgb[3], float hsv[3])
Convert color in RGB format (Red, Green, Blue) to HSV format (Hue, Saturation, Value).
static vtkTypeBool IsInf(double x)
Test if a number is equal to the special floating point value infinity.
static void UninitializeBounds(double bounds[6])
Set the bounds to an uninitialized state.
static float Dot2D(const float x[2], const float y[2])
Dot product of two 2-vectors.
static float DegreesFromRadians(float radians)
Convert radians into degrees.
static T Max(const T &a, const T &b)
Returns the maximum of the two arguments provided.
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
static double Norm2D(const double x[2])
Compute the norm of a 2-vector.
static void HSVToRGB(const double hsv[3], double rgb[3])
static float RadiansFromDegrees(float degrees)
Convert degrees into radians.
static void XYZToRGB(const double xyz[3], double rgb[3])
Convert color from the CIE XYZ system to RGB.
abstract base class for most VTK objects
static double Determinant3x3(const float A[3][3])
Return the determinant of a 3x3 matrix.
static void MultiplyScalar(float a[3], float s)
Multiplies a 3-vector by a scalar (float version).
static void Subtract(const float a[3], const float b[3], float c[3])
Subtraction of two 3-vectors (float version).
abstract superclass for arrays of numeric data
static void LabToRGB(const double lab[3], double rgb[3])
Convert color from the CIE-L*ab system to RGB.
static float Norm(const float v[3])
Compute the norm of 3-vector (float version).
void RoundDoubleToIntegralIfNecessary(double val, OutT *ret)
static double ClampAndNormalizeValue(double value, const double range[2])
Clamp a value against a range and then normalize it between 0 and 1.
static void HSVToRGB(const float hsv[3], float rgb[3])
Convert color in HSV format (Hue, Saturation, Value) to RGB format (Red, Green, Blue).
static void Subtract(const double a[3], const double b[3], double c[3])
Subtraction of two 3-vectors (double version).
static void LabToXYZ(const double lab[3], double xyz[3])
Convert color from the CIE-L*ab system to CIE XYZ.
static void MultiplyScalar2D(float a[2], float s)
Multiplies a 2-vector by a scalar (float version).
static void Add(const double a[3], const double b[3], double c[3])
Addition of two 3-vectors (double version).
static void Outer(const double a[3], const double b[3], double c[3][3])
Outer product of two 3-vectors (double version).
static T ClampValue(const T &value, const T &min, const T &max)
Clamp some value against a range, return the result.
static void RoundDoubleToIntegralIfNecessary(double val, OutT *ret)
Round a double to type OutT if OutT is integral, otherwise simply clamp the value to the output range...
static float Normalize2D(float v[2])
Normalize (in place) a 2-vector.
static float Norm2D(const float x[2])
Compute the norm of a 2-vector.
static double Pi()
A mathematical constant.
static void MultiplyScalar2D(double a[2], double s)
Multiplies a 2-vector by a scalar (double version).
static void TensorFromSymmetricTensor(const T1 symmTensor[6], T2 tensor[9])
Convert a 6-Component symmetric tensor into a 9-Component tensor, no allocation performed.
static T Min(const T &a, const T &b)
Returns the minimum of the two arguments provided.
a simple class to control print indentation
double vtkDeterminant3x3(const T A[3][3])
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
static void Outer2D(const double x[2], const double y[2], double A[2][2])
Outer product of two 2-vectors (double version).
static float Determinant2x2(const float c1[2], const float c2[2])
Compute determinant of 2x2 matrix.
static void Outer(const float a[3], const float b[3], float c[3][3])
Outer product of two 3-vectors (float version).
Gaussian sequence of pseudo random numbers implemented with the Box-Mueller transform.
static double Determinant2x2(const double c1[2], const double c2[2])
performs common math operations
static bool IsPowerOfTwo(vtkTypeUInt64 x)
Returns true if integer is a power of two.
static void Cross(const float a[3], const float b[3], float c[3])
Cross product of two 3-vectors.
static int Round(double f)
static void XYZToLab(const double xyz[3], double lab[3])
Convert Color from the CIE XYZ system to CIE-L*ab.
static void RGBToXYZ(const double rgb[3], double xyz[3])
Convert color from the RGB system to CIE XYZ.
static int Round(float f)
Rounds a float to the nearest integer.
static float Distance2BetweenPoints(const float p1[3], const float p2[3])
Compute distance squared between two points p1 and p2.
static bool IsFinite(double x)
Test if a number has finite value i.e.
static double Dot2D(const double x[2], const double y[2])
Dot product of two 2-vectors.
static void Outer2D(const float x[2], const float y[2], float A[2][2])
Outer product of two 2-vectors (float version).
static void Add(const float a[3], const float b[3], float c[3])
Addition of two 3-vectors (float version).
static double Norm(const double v[3])
Compute the norm of 3-vector (double version).
static float Dot(const float a[3], const float b[3])
Dot product of two 3-vectors (float version).
static vtkTypeBool AreBoundsInitialized(const double bounds[6])
Are the bounds initialized?
static vtkSmartPointer< vtkMathInternal > Internal