Commit 8afeb0df authored by Kyle Lutz's avatar Kyle Lutz Committed by Code Review
Browse files

Merge topic 'vector-features' into master

62d538b5 BUG: Fixed python vtkTuple templated class test.
93862d03 STYLE: Document default vtkTuple constructor.
03b7e041 ENH: Remove default arguments, create empty ctor.
b50701c3 BUG: Fixed type for vtkColor4d.
parents 378a2ad0 62d538b5
......@@ -109,11 +109,11 @@ class TestTemplates(Testing.vtkTest):
# make sure Rect inherits operators
r = vtk.vtkRectf(0, 0, 2, 2)
self.assertEqual(r[2], 2.0)
c = vtk.vtkColor4ub()
c = vtk.vtkColor4ub(0, 0, 0)
self.assertEqual(list(c), [0, 0, 0, 255])
e = vtk.vtkVector['float32', 3]([0.0, 1.0, 2.0])
self.assertEqual(list(e), [0.0, 1.0, 2.0])
i = vtk.vtkVector3['i']()
i = vtk.vtkVector3['i'](0)
self.assertEqual(list(i), [0, 0, 0])
if __name__ == "__main__":
......
......@@ -231,7 +231,7 @@ public:
vtkColor4d() {}
explicit vtkColor4d(double scalar) : vtkColor4<double>(scalar) {}
explicit vtkColor4d(const double* init) : vtkColor4<double>(init) {}
vtkColor4d(double r, double g, double b, float a = 1.0)
vtkColor4d(double r, double g, double b, double a = 1.0)
: vtkColor4<double>(r, g, b, a) {}
};
......
......@@ -30,8 +30,11 @@ template<typename T>
class vtkRect : public vtkVector<T, 4>
{
public:
vtkRect(const T& x = 0, const T& y = 0, const T& width = 0,
const T& height = 0 )
vtkRect()
{
}
vtkRect(const T& x, const T& y, const T& width, const T& height)
{
this->Data[0] = x;
this->Data[1] = y;
......@@ -92,7 +95,8 @@ public:
class vtkRecti : public vtkRect<int>
{
public:
vtkRecti(int x = 0, int y = 0, int width = 0, int height = 0)
vtkRecti() {}
vtkRecti(int x, int y, int width, int height)
: vtkRect<int>(x, y, width, height) {}
explicit vtkRecti(const int *init) : vtkRect<int>(init) {}
};
......@@ -100,7 +104,8 @@ public:
class vtkRectf : public vtkRect<float>
{
public:
vtkRectf(float x = 0.0, float y = 0.0, float width = 0.0, float height = 0.0)
vtkRectf() {}
vtkRectf(float x, float y, float width, float height)
: vtkRect<float>(x, y, width, height) {}
explicit vtkRectf(const float *init) : vtkRect<float>(init) {}
};
......@@ -108,8 +113,8 @@ public:
class vtkRectd : public vtkRect<double>
{
public:
vtkRectd(double x = 0.0, double y = 0.0, double width = 0.0,
double height = 0.0)
vtkRectd() {}
vtkRectd(double x, double y, double width, double height)
: vtkRect<double>(x, y, width, height) {}
explicit vtkRectd(const double *init) : vtkRect<double>(init) {}
};
......
......@@ -27,6 +27,10 @@ template<typename T, int Size>
class vtkTuple
{
public:
// Description:
// The default constructor does not initialize values. If initializtion is
// desired, this should be done explicitly using the constructors for scalar
// initialization, or other suitable constructors taking arguments.
vtkTuple()
{
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment