Skip to content

Commit d9c5ca0

Browse files
committed
Mark legacy methods as "legacy".
These methods are undocumented and many of them, such as the ones that take a pass-by-reference vtkMatrix4x4 parameter, are very much out of place in VTK.
1 parent d0ecfc3 commit d9c5ca0

File tree

3 files changed

+87
-21
lines changed

3 files changed

+87
-21
lines changed

Common/Math/vtkMatrix4x4.cxx

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,22 +80,91 @@ void vtkMatrix4x4::MultiplyPoint(const double Elements[16],
8080
}
8181

8282
//----------------------------------------------------------------------------
83+
#ifndef VTK_LEGACY_REMOVE
84+
double *vtkMatrix4x4::operator[](const unsigned int i)
85+
{
86+
VTK_LEGACY_BODY(vtkMatrix4x4::operator[], "VTK 7.1");
87+
return &(this->Element[i][0]);
88+
}
89+
#endif
90+
91+
//----------------------------------------------------------------------------
92+
#ifndef VTK_LEGACY_REMOVE
93+
const double *vtkMatrix4x4::operator[](unsigned int i) const
94+
{
95+
VTK_LEGACY_BODY(vtkMatrix4x4::operator[], "VTK 7.1");
96+
return &(this->Element[i][0]);
97+
}
98+
#endif
99+
100+
//----------------------------------------------------------------------------
101+
#ifndef VTK_LEGACY_REMOVE
102+
void vtkMatrix4x4::Adjoint(vtkMatrix4x4 &in, vtkMatrix4x4 &out)
103+
{
104+
VTK_LEGACY_BODY(vtkMatrix4x4::Adjoint, "VTK 7.1");
105+
this->Adjoint(&in, &out);
106+
}
107+
#endif
108+
109+
//----------------------------------------------------------------------------
110+
#ifndef VTK_LEGACY_REMOVE
111+
double vtkMatrix4x4::Determinant(vtkMatrix4x4 &in)
112+
{
113+
VTK_LEGACY_BODY(vtkMatrix4x4::Determinant, "VTK 7.1");
114+
return this->Determinant(&in);
115+
}
116+
#endif
117+
118+
//----------------------------------------------------------------------------
119+
#ifndef VTK_LEGACY_REMOVE
120+
double vtkMatrix4x4::Determinant(vtkMatrix4x4 *in)
121+
{
122+
VTK_LEGACY_BODY(vtkMatrix4x4::Determinant, "VTK 7.1");
123+
return vtkMatrix4x4::Determinant(*in->Element);
124+
}
125+
#endif
126+
127+
//----------------------------------------------------------------------------
128+
#ifndef VTK_LEGACY_REMOVE
129+
void vtkMatrix4x4::Invert(vtkMatrix4x4 &in, vtkMatrix4x4 &out)
130+
{
131+
VTK_LEGACY_BODY(vtkMatrix4x4::Invert, "VTK 7.1");
132+
this->Invert(&in, &out);
133+
}
134+
#endif
135+
136+
//----------------------------------------------------------------------------
137+
#ifndef VTK_LEGACY_REMOVE
138+
void vtkMatrix4x4::Transpose(vtkMatrix4x4 &in, vtkMatrix4x4 &out)
139+
{
140+
VTK_LEGACY_BODY(vtkMatrix4x4::Transpose, "VTK 7.1");
141+
this->Transpose(&in, &out);
142+
}
143+
#endif
144+
145+
//----------------------------------------------------------------------------
146+
#ifndef VTK_LEGACY_REMOVE
83147
void vtkMatrix4x4::PointMultiply(const double Elements[16],
84148
const float in[4], float result[4])
85149
{
150+
VTK_LEGACY_BODY(vtkMatrix4x4::PointMultiply, "VTK 7.1");
86151
double newElements[16];
87152
vtkMatrix4x4::Transpose(Elements, newElements);
88153
vtkMatrix4x4::MultiplyPoint(newElements, in, result);
89154
}
155+
#endif
90156

91157
//----------------------------------------------------------------------------
158+
#ifndef VTK_LEGACY_REMOVE
92159
void vtkMatrix4x4::PointMultiply(const double Elements[16],
93160
const double in[4], double result[4])
94161
{
162+
VTK_LEGACY_BODY(vtkMatrix4x4::PointMultiply, "VTK 7.1");
95163
double newElements[16];
96164
vtkMatrix4x4::Transpose(Elements, newElements);
97165
vtkMatrix4x4::MultiplyPoint(newElements, in, result);
98166
}
167+
#endif
99168

100169
//----------------------------------------------------------------------------
101170
// Matrix Inversion (adapted from Richard Carling in "Graphics Gems,"

Common/Math/vtkMatrix4x4.h

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -135,24 +135,19 @@ class VTKCOMMONMATH_EXPORT vtkMatrix4x4 : public vtkObject
135135
double GetElement(int i, int j) const
136136
{return this->Element[i][j];}
137137

138-
double *operator[](const unsigned int i)
139-
{return &(this->Element[i][0]);}
140-
const double *operator[](unsigned int i) const
141-
{ return &(this->Element[i][0]); }
142-
void Adjoint(vtkMatrix4x4 &in,vtkMatrix4x4 &out)
143-
{this->Adjoint(&in,&out);}
144-
double Determinant(vtkMatrix4x4 &in)
145-
{return this->Determinant(&in);}
146-
double Determinant(vtkMatrix4x4 *in)
147-
{return vtkMatrix4x4::Determinant(*in->Element);}
148-
void Invert(vtkMatrix4x4 &in,vtkMatrix4x4 &out)
149-
{this->Invert(&in,&out);}
150-
void Transpose(vtkMatrix4x4 &in,vtkMatrix4x4 &out)
151-
{this->Transpose(&in,&out);}
152-
static void PointMultiply(const double Elements[16],
153-
const float in[4], float out[4]);
154-
static void PointMultiply(const double Elements[16],
155-
const double in[4], double out[4]);
138+
// Description:
139+
// Legacy methods. Do not use.
140+
VTK_LEGACY(double *operator[](const unsigned int i));
141+
VTK_LEGACY(const double *operator[](unsigned int i) const);
142+
VTK_LEGACY(void Adjoint(vtkMatrix4x4 &in,vtkMatrix4x4 &out));
143+
VTK_LEGACY(double Determinant(vtkMatrix4x4 &in));
144+
VTK_LEGACY(double Determinant(vtkMatrix4x4 *));
145+
VTK_LEGACY(void Invert(vtkMatrix4x4 &in,vtkMatrix4x4 &out));
146+
VTK_LEGACY(void Transpose(vtkMatrix4x4 &in,vtkMatrix4x4 &out));
147+
VTK_LEGACY(static void PointMultiply(const double [16],
148+
const float [4], float [4]));
149+
VTK_LEGACY(static void PointMultiply(const double [16],
150+
const double [4], double [4]));
156151

157152
protected:
158153
vtkMatrix4x4() { vtkMatrix4x4::Identity(*this->Element); };

Interaction/Widgets/vtkPolygonalHandleRepresentation3D.cxx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,11 @@ void vtkPolygonalHandleRepresentation3D::SetWorldPosition(double p[3])
5050
this->HandleTransformMatrix->SetElement(1, 3, p[1] - this->Offset[1]);
5151
this->HandleTransformMatrix->SetElement(2, 3, p[2] - this->Offset[2]);
5252

53-
this->WorldPosition->SetValue( (*(this->HandleTransformMatrix))[0][3],
54-
(*(this->HandleTransformMatrix))[1][3],
55-
(*(this->HandleTransformMatrix))[2][3] );
53+
this->WorldPosition->SetValue(
54+
this->HandleTransformMatrix->GetElement(0, 3),
55+
this->HandleTransformMatrix->GetElement(1, 3),
56+
this->HandleTransformMatrix->GetElement(2, 3));
57+
5658
this->WorldPositionTime.Modified();
5759
}
5860
}

0 commit comments

Comments
 (0)