------------------------------------------------------------------------------ Description: Scale each dimension of the box by some given factor. If the box is not valid, it stays unchanged. If the scalar factor is negative, bounds are flipped: for example, if (xMin,xMax)=(-2,4) and sx=-3, (xMin,xMax) becomes (-12,6).
| 386 | // If the scalar factor is negative, bounds are flipped: for example, |
| 387 | // if (xMin,xMax)=(-2,4) and sx=-3, (xMin,xMax) becomes (-12,6). |
| 388 | void vtkBoundingBox::Scale(double sx, double sy, double sz) |
| 389 | { |
| 390 | if (this->IsValid()) |
| 391 | { |
| 392 | if (sx >= 0.0) |
| 393 | { |
| 394 | this->MinPnt[0] *= sx; |
| 395 | this->MaxPnt[0] *= sx; |
| 396 | } |
| 397 | else |
| 398 | { |
| 399 | double tmp = this->MinPnt[0]; |
| 400 | this->MinPnt[0] = sx * this->MaxPnt[0]; |
| 401 | this->MaxPnt[0] = sx * tmp; |
| 402 | } |
| 403 | |
| 404 | if (sy >= 0.0) |
| 405 | { |
| 406 | this->MinPnt[1] *= sy; |
| 407 | this->MaxPnt[1] *= sy; |
| 408 | } |
| 409 | else |
| 410 | { |
| 411 | double tmp = this->MinPnt[1]; |
| 412 | this->MinPnt[1] = sy * this->MaxPnt[1]; |
| 413 | this->MaxPnt[1] = sy * tmp; |
| 414 | } |
| 415 | |
| 416 | if (sz >= 0.0) |
| 417 | { |
| 418 | this->MinPnt[2] *= sz; |
| 419 | this->MaxPnt[2] *= sz; |
| 420 | } |
| 421 | else |
| 422 | { |
| 423 | double tmp = this->MinPnt[2]; |
| 424 | this->MinPnt[2] = sz * this->MaxPnt[2]; |
| 425 | this->MaxPnt[2] = sz * tmp; |
| 426 | } |
| 427 | } |
| 428 | } |
| 429 | |
| 430 | //------------------------------------------------------------------------------ |
| 431 | void vtkBoundingBox::Scale(double s[3]) |