------------------------------------------------------------------------------
| 407 | |
| 408 | //------------------------------------------------------------------------------ |
| 409 | void vtkLightRepresentation::ScaleConeAngle(double* pickPoint, double* lastPickPoint) |
| 410 | { |
| 411 | double vecOrig[3]; |
| 412 | double vecCur[3]; |
| 413 | double vecPrev[3]; |
| 414 | double project[3]; |
| 415 | |
| 416 | // Compute the squated distance from the picked point |
| 417 | vtkMath::Subtract(this->FocalPoint, this->LightPosition, vecOrig); |
| 418 | vtkMath::Subtract(pickPoint, this->LightPosition, vecCur); |
| 419 | vtkMath::Subtract(lastPickPoint, this->LightPosition, vecPrev); |
| 420 | vtkMath::ProjectVector(vecCur, vecOrig, project); |
| 421 | double distance2 = vtkMath::Distance2BetweenPoints(pickPoint, project); |
| 422 | |
| 423 | // If a squared distance has been computed before, the angle has changed |
| 424 | if (this->LastScalingDistance2 != -1) |
| 425 | { |
| 426 | // Compute the direction of the angle change |
| 427 | double factor = this->LastScalingDistance2 < distance2 ? 1 : -1; |
| 428 | |
| 429 | // Compute the difference of the change |
| 430 | double deltaAngle = |
| 431 | factor * 180 * vtkMath::AngleBetweenVectors(vecCur, vecPrev) / vtkMath::Pi(); |
| 432 | |
| 433 | // Add it to the current angle |
| 434 | this->SetConeAngle(this->ConeAngle + deltaAngle); |
| 435 | } |
| 436 | |
| 437 | // Store the last scaling squared distance |
| 438 | this->LastScalingDistance2 = distance2; |
| 439 | } |
| 440 | VTK_ABI_NAMESPACE_END |
no test coverage detected