| 194 | } |
| 195 | |
| 196 | void vtkCollisionDetectionFilter::SetMatrix(int i, vtkMatrix4x4* matrix) |
| 197 | { |
| 198 | if (i > 1 || i < 0) |
| 199 | { |
| 200 | vtkErrorMacro(<< "Index " << i << " is out of range in SetMatrix. Only two matrices allowed!"); |
| 201 | return; |
| 202 | } |
| 203 | |
| 204 | if (matrix == this->Matrix[i]) |
| 205 | { |
| 206 | return; |
| 207 | } |
| 208 | |
| 209 | if (this->Transform[i]) |
| 210 | { |
| 211 | this->Transform[i]->Delete(); |
| 212 | this->Transform[i] = nullptr; |
| 213 | } |
| 214 | |
| 215 | if (this->Matrix[i]) |
| 216 | { |
| 217 | this->Matrix[i]->Delete(); |
| 218 | this->Matrix[i] = nullptr; |
| 219 | } |
| 220 | vtkDebugMacro(<< "Setting matrix: " << i << " to point to " << matrix << endl); |
| 221 | |
| 222 | if (matrix) |
| 223 | { |
| 224 | this->Matrix[i] = matrix; |
| 225 | } |
| 226 | matrix->Register(this); |
| 227 | vtkMatrixToLinearTransform* transform = vtkMatrixToLinearTransform::New(); |
| 228 | // Consistent Register and UnRegisters. |
| 229 | transform->Register(this); |
| 230 | transform->Delete(); |
| 231 | transform->SetInput(matrix); |
| 232 | this->Transform[i] = transform; |
| 233 | vtkDebugMacro(<< "Setting Transform " << i << " to points to: " << transform << endl); |
| 234 | this->Modified(); |
| 235 | } |
| 236 | |
| 237 | vtkMatrix4x4* vtkCollisionDetectionFilter::GetMatrix(int i) |
| 238 | { |