MCPcopy Create free account
hub / github.com/Kitware/ParaView / UpdateValue

Method UpdateValue

Remoting/Animation/vtkPVExponentialKeyFrame.cxx:26–77  ·  view source on GitHub ↗

---------------------------------------------------------------------------- remember that currenttime is 0 at the KeyTime of this key frame and 1 and the KeyTime of the next key frame. Hence, currenttime belongs to the interval [0,1).

Source from the content-addressed store, hash-verified

24// and 1 and the KeyTime of the next key frame. Hence,
25// currenttime belongs to the interval [0,1).
26void vtkPVExponentialKeyFrame::UpdateValue(
27 double currenttime, vtkPVAnimationCue* cue, vtkPVKeyFrame* next)
28{
29 if (!next)
30 {
31 return;
32 }
33
34 if (this->Base == 1)
35 {
36 vtkErrorMacro("Exponential with base 1");
37 }
38
39 // Do some computation
40 int animated_element = cue->GetAnimatedElement();
41 double tcur =
42 pow(this->Base, this->StartPower + currenttime * (this->EndPower - this->StartPower));
43 double tmin = pow(this->Base, this->StartPower);
44 double tmax = pow(this->Base, this->EndPower);
45 double t = (this->Base != 1) ? (tcur - tmin) / (tmax - tmin) : 0;
46
47 // Apply changes
48 cue->BeginUpdateAnimationValues();
49 if (animated_element != -1)
50 {
51 double vmax = next->GetKeyValue();
52 double vmin = this->GetKeyValue();
53 double value = vmin + t * (vmax - vmin);
54 cue->SetAnimationValue(animated_element, value);
55 }
56 else
57 {
58 unsigned int start_novalues = this->GetNumberOfKeyValues();
59 unsigned int end_novalues = next->GetNumberOfKeyValues();
60 unsigned int min = (start_novalues < end_novalues) ? start_novalues : end_novalues;
61 unsigned int i;
62 // interpolate common indices.
63 for (i = 0; i < min; i++)
64 {
65 double vmax = next->GetKeyValue(i);
66 double vmin = this->GetKeyValue(i);
67 double value = vmin + t * (vmax - vmin);
68 cue->SetAnimationValue(i, value);
69 }
70 // add any additional indices in start key frame.
71 for (i = min; i < start_novalues; i++)
72 {
73 cue->SetAnimationValue(i, this->GetKeyValue(i));
74 }
75 }
76 cue->EndUpdateAnimationValues();
77}
78
79//----------------------------------------------------------------------------
80void vtkPVExponentialKeyFrame::PrintSelf(ostream& os, vtkIndent indent)

Callers

nothing calls this directly

Calls 6

GetKeyValueMethod · 0.80
GetNumberOfKeyValuesMethod · 0.80
powFunction · 0.50
SetAnimationValueMethod · 0.45

Tested by

no test coverage detected