Graphics Programs Reference
In-Depth Information
_destinationPositionX = _destinationPositionX +
0.5f;
}
_destinationPositionY = (_slopeZ *
_destinationPositionX) + _interceptY;
}
}
As the motion of the missile is confined in the x-y plane, using the slope-intercept
equation we can interpolate the source position to obtain the destination position at
the end of each frame.
The method filter() in Listing 6-9 is used to adjust the slope. For angles lying
between the X and Y axes ( Figure 6-3 ) , the slope can be directly used to interpolate
the missile source position.
Figure 6-3 . Using the actual value of slope to interpolate the missile source position
But for angles (almost) parallel to X or Y axis, as shown in Figures 6-4 and 6-5 , the
slope cannot be directly used to interpolate the missile source position, which is why
it has to be adjusted.
 
 
 
Search WWH ::




Custom Search