MCPcopy Create free account
hub / github.com/Kitware/VTK / ScaleConeAngle

Method ScaleConeAngle

Interaction/Widgets/vtkLightRepresentation.cxx:409–439  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

407
408//------------------------------------------------------------------------------
409void 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}
440VTK_ABI_NAMESPACE_END

Callers 1

WidgetInteractionMethod · 0.95

Calls 4

SetConeAngleMethod · 0.95
ProjectVectorFunction · 0.85
PiFunction · 0.85
SubtractFunction · 0.50

Tested by

no test coverage detected