| 1289 | } |
| 1290 | |
| 1291 | void vtkBoxWidget::SetTransform(vtkTransform* t) |
| 1292 | { |
| 1293 | if (!t) |
| 1294 | { |
| 1295 | vtkErrorMacro(<< "vtkTransform t must be non-nullptr"); |
| 1296 | return; |
| 1297 | } |
| 1298 | |
| 1299 | double* pts = static_cast<vtkDoubleArray*>(this->Points->GetData())->GetPointer(0); |
| 1300 | double xIn[3]; |
| 1301 | // make sure the transform is up-to-date before using it |
| 1302 | t->Update(); |
| 1303 | |
| 1304 | // Position the eight points of the box and then update the |
| 1305 | // position of the other handles. |
| 1306 | double* bounds = this->InitialBounds; |
| 1307 | |
| 1308 | xIn[0] = bounds[0]; |
| 1309 | xIn[1] = bounds[2]; |
| 1310 | xIn[2] = bounds[4]; |
| 1311 | t->InternalTransformPoint(xIn, pts); |
| 1312 | |
| 1313 | xIn[0] = bounds[1]; |
| 1314 | xIn[1] = bounds[2]; |
| 1315 | xIn[2] = bounds[4]; |
| 1316 | t->InternalTransformPoint(xIn, pts + 3); |
| 1317 | |
| 1318 | xIn[0] = bounds[1]; |
| 1319 | xIn[1] = bounds[3]; |
| 1320 | xIn[2] = bounds[4]; |
| 1321 | t->InternalTransformPoint(xIn, pts + 6); |
| 1322 | |
| 1323 | xIn[0] = bounds[0]; |
| 1324 | xIn[1] = bounds[3]; |
| 1325 | xIn[2] = bounds[4]; |
| 1326 | t->InternalTransformPoint(xIn, pts + 9); |
| 1327 | |
| 1328 | xIn[0] = bounds[0]; |
| 1329 | xIn[1] = bounds[2]; |
| 1330 | xIn[2] = bounds[5]; |
| 1331 | t->InternalTransformPoint(xIn, pts + 12); |
| 1332 | |
| 1333 | xIn[0] = bounds[1]; |
| 1334 | xIn[1] = bounds[2]; |
| 1335 | xIn[2] = bounds[5]; |
| 1336 | t->InternalTransformPoint(xIn, pts + 15); |
| 1337 | |
| 1338 | xIn[0] = bounds[1]; |
| 1339 | xIn[1] = bounds[3]; |
| 1340 | xIn[2] = bounds[5]; |
| 1341 | t->InternalTransformPoint(xIn, pts + 18); |
| 1342 | |
| 1343 | xIn[0] = bounds[0]; |
| 1344 | xIn[1] = bounds[3]; |
| 1345 | xIn[2] = bounds[5]; |
| 1346 | t->InternalTransformPoint(xIn, pts + 21); |
| 1347 | |
| 1348 | this->PositionHandles(); |