smoothOperator - %el%Here is an example of what you might...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
function [vecaz vecel] = smoothOperator(stru,chngt) %Show-off! You've finally nailed that bodies of rotation code down and %want to show it off to your family and friends. What you would like to %do is have MATLAB rotate the camera smoothly around your body of %rotation (or other plot) for added effect. You've already written a %function, swivelCamera, that takes in a vector of azimuths and a vector %of elevations that describe angles from which your plot should be %viewed. swivelCamera also takes in a duration in seconds that you %would like to pause between shots (delta t). What you need to do now %is write a function, smoothOperator, which will generate azimuth and %elevation vectors that will move the camera smoothly around your plot. %You have several angles which you would like to view your plot from, %and you would like to visit them at certain times. To keep track of %these angles and times you will use a structure with fields t, az, and
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: %el. %Here is an example of what you might like to accomplish: %At the beginning (t=0) you want to start at az = -37 and el = 30. %After 3 seconds you want to view az = -85, el = -30. %At 8 seconds you want to be looking at az=-134, el = 50. %Finally, after 12 seconds you want to end at az = -165, el = 78. %Use spline to create the az and el vectors for swivelCamera. az and el %are functions of t. t should contain begin at the minimum time and end %at the maximum time from your structure, and your time values should be %delta t apart. %It may be necessary to sort the structure by time before interpolating. [num pos] = sort([stru.t]); %gets the numbers and positions of the values in the field t stru = stru(pos); %indexes only th random = ((stru(end).t-stru(1).t)./chngt)+1; time2 = linspace(stru(1).t,stru(end).t,random); vecaz = spline([stru.t],[],time2); vecel = spline([stru.t],[stru.el],time2); end...
View Full Document

This note was uploaded on 10/21/2010 for the course CS 1371 taught by Professor Stallworth during the Spring '08 term at Georgia Tech.

Ask a homework question - tutors are online