SlideShare a Scribd company logo
1 of 2
Part 3 Your animation should contain at least the following: Translation and/or scaling
Solution
%% The story is a pretty simple one. A ship is trying to travel through universe through a
wormhole
clc
close all
clear all
myaxes=axes('xlim',[-5 5],'ylim',[-5 15],'zlim',[-4 4]);
view(3);
grid on;
axis equal;
hold on;
%% Wormhole coordinates
t = 0:pi/10:2*pi;
[wormhole_x,wormhole_y,wormhole_z] = cylinder(2.2+2*cos(t));
%% Genaerating coordinates of cylinder , sphere and ellipse
[cylinder_x cylinder_y cylinder_z]=cylinder([1 1]);
[sphere_x sphere_y sphere_z]=sphere();
[elp_x elp_y elp_z]=ellipsoid(0,0,0,2,.5,.5);
%% This is the ship
h(1)=surface(cylinder_y,cylinder_z,cylinder_x);
h(2)=surface(sphere_y,sphere_z,sphere_x);
h(3)=surface(elp_y,elp_z,elp_x);
h(4)=surface(elp_x,elp_z,elp_y);
h(5)=surface(sphere_y,sphere_z+1,sphere_x);
%%This is the wormhole and few stars
scene1=surface(wormhole_y,wormhole_z*5+8,wormhole_x);
scene2=surface(sphere_x*0.1-10,sphere_y*0.1,sphere_z*0.1+1);
scene3=surface(sphere_x*0.1+5,sphere_y*0.1,sphere_z*0.1+1);
scene4=surface(sphere_x*0.3-3,sphere_y*0.3-6,sphere_z*0.3+2);
scene5=surface(sphere_x*0.3+3,sphere_y*0.3-1,sphere_z*0.3+2);
scene6=surface(sphere_x*0.5-3,sphere_y*0.5-6,sphere_z*0.5+4);
%%Creating a group object
combinedobject=hgtransform('parent',myaxes);
set(h,'parent',combinedobject)
drawnow
%% Defining its rotation and translation
X=zeros(21);
Y=0:20/20:20;
Z=zeros(21);
A=0:2*pi/20:4*pi;
%% Actually doing the animation
for i=1:length(X)
translation=makehgtform('translate',...
[X(i) Y(i) Z(i)]);
resize=makehgtform('scale',1-i/40);
rotation=makehgtform('yrotate',A(i));
set(combinedobject,'matrix',rotation*resize*translation);
pause(0.2);
end

More Related Content

More from carold11

The following accounts were taken from ABC CompanySolutionCalculation (1).docx
The following accounts were taken from ABC CompanySolutionCalculation (1).docxThe following accounts were taken from ABC CompanySolutionCalculation (1).docx
The following accounts were taken from ABC CompanySolutionCalculation (1).docxcarold11
 
The fiscal 2012 financial statements of Barney Services shows average.docx
The fiscal 2012 financial statements of Barney Services shows average.docxThe fiscal 2012 financial statements of Barney Services shows average.docx
The fiscal 2012 financial statements of Barney Services shows average.docxcarold11
 
The equity sections from Atticus Group The equity sections from.docx
The equity sections from Atticus Group        The equity sections from.docxThe equity sections from Atticus Group        The equity sections from.docx
The equity sections from Atticus Group The equity sections from.docxcarold11
 
The executive officers of Rouse Corporation have a performance-based c.docx
The executive officers of Rouse Corporation have a performance-based c.docxThe executive officers of Rouse Corporation have a performance-based c.docx
The executive officers of Rouse Corporation have a performance-based c.docxcarold11
 
The Federal Reserve had to resort to non-standard methods to try to st.docx
The Federal Reserve had to resort to non-standard methods to try to st.docxThe Federal Reserve had to resort to non-standard methods to try to st.docx
The Federal Reserve had to resort to non-standard methods to try to st.docxcarold11
 
The EU recently admitted the Eastern European countries- How do you as.docx
The EU recently admitted the Eastern European countries- How do you as.docxThe EU recently admitted the Eastern European countries- How do you as.docx
The EU recently admitted the Eastern European countries- How do you as.docxcarold11
 
The Esposito Import Company had 1 million shares of common stock outst.docx
The Esposito Import Company had 1 million shares of common stock outst.docxThe Esposito Import Company had 1 million shares of common stock outst.docx
The Esposito Import Company had 1 million shares of common stock outst.docxcarold11
 
The energy levels of electrons are related to their- a) Position on t.docx
The energy levels of electrons are related to their-  a) Position on t.docxThe energy levels of electrons are related to their-  a) Position on t.docx
The energy levels of electrons are related to their- a) Position on t.docxcarold11
 
The Electron in a Hydrogen Atom transforms from its n-1 state to its n.docx
The Electron in a Hydrogen Atom transforms from its n-1 state to its n.docxThe Electron in a Hydrogen Atom transforms from its n-1 state to its n.docx
The Electron in a Hydrogen Atom transforms from its n-1 state to its n.docxcarold11
 
The enqueue operation on the Queue ADT adds a new item to the back of (1).docx
The enqueue operation on the Queue ADT adds a new item to the back of (1).docxThe enqueue operation on the Queue ADT adds a new item to the back of (1).docx
The enqueue operation on the Queue ADT adds a new item to the back of (1).docxcarold11
 
The Fed follows the theory of bureaucratic behavior in what sense-.docx
The Fed follows the theory of bureaucratic behavior in what sense-.docxThe Fed follows the theory of bureaucratic behavior in what sense-.docx
The Fed follows the theory of bureaucratic behavior in what sense-.docxcarold11
 
Pay structures Union contracts Wage and price contracts Levels of reve.docx
Pay structures Union contracts Wage and price contracts Levels of reve.docxPay structures Union contracts Wage and price contracts Levels of reve.docx
Pay structures Union contracts Wage and price contracts Levels of reve.docxcarold11
 
Pat ts oints Give all answers to the corret number of significant figu.docx
Pat ts oints Give all answers to the corret number of significant figu.docxPat ts oints Give all answers to the corret number of significant figu.docx
Pat ts oints Give all answers to the corret number of significant figu.docxcarold11
 
Partial balance sheets and additional iformation are listed below for.docx
Partial balance sheets and additional iformation are listed below for.docxPartial balance sheets and additional iformation are listed below for.docx
Partial balance sheets and additional iformation are listed below for.docxcarold11
 
PART ONE- Briefly explain and illustrate how the unemployment rate and.docx
PART ONE- Briefly explain and illustrate how the unemployment rate and.docxPART ONE- Briefly explain and illustrate how the unemployment rate and.docx
PART ONE- Briefly explain and illustrate how the unemployment rate and.docxcarold11
 
Part K (There is no common name for this species-) CHO Spell out the f.docx
Part K (There is no common name for this species-) CHO Spell out the f.docxPart K (There is no common name for this species-) CHO Spell out the f.docx
Part K (There is no common name for this species-) CHO Spell out the f.docxcarold11
 
Part I- Avoid claims rejections A payer may delay or deny payment beca.docx
Part I- Avoid claims rejections A payer may delay or deny payment beca.docxPart I- Avoid claims rejections A payer may delay or deny payment beca.docx
Part I- Avoid claims rejections A payer may delay or deny payment beca.docxcarold11
 
Part B 1- (2 pts-) Write the reaction equation of ammonium ions with s.docx
Part B 1- (2 pts-) Write the reaction equation of ammonium ions with s.docxPart B 1- (2 pts-) Write the reaction equation of ammonium ions with s.docx
Part B 1- (2 pts-) Write the reaction equation of ammonium ions with s.docxcarold11
 
Part A Prepare an income statement and a statement of retained earning.docx
Part A Prepare an income statement and a statement of retained earning.docxPart A Prepare an income statement and a statement of retained earning.docx
Part A Prepare an income statement and a statement of retained earning.docxcarold11
 
Part 3 Put it all together- Calculate the concentrations of all speci.docx
Part 3  Put it all together- Calculate the concentrations of all speci.docxPart 3  Put it all together- Calculate the concentrations of all speci.docx
Part 3 Put it all together- Calculate the concentrations of all speci.docxcarold11
 

More from carold11 (20)

The following accounts were taken from ABC CompanySolutionCalculation (1).docx
The following accounts were taken from ABC CompanySolutionCalculation (1).docxThe following accounts were taken from ABC CompanySolutionCalculation (1).docx
The following accounts were taken from ABC CompanySolutionCalculation (1).docx
 
The fiscal 2012 financial statements of Barney Services shows average.docx
The fiscal 2012 financial statements of Barney Services shows average.docxThe fiscal 2012 financial statements of Barney Services shows average.docx
The fiscal 2012 financial statements of Barney Services shows average.docx
 
The equity sections from Atticus Group The equity sections from.docx
The equity sections from Atticus Group        The equity sections from.docxThe equity sections from Atticus Group        The equity sections from.docx
The equity sections from Atticus Group The equity sections from.docx
 
The executive officers of Rouse Corporation have a performance-based c.docx
The executive officers of Rouse Corporation have a performance-based c.docxThe executive officers of Rouse Corporation have a performance-based c.docx
The executive officers of Rouse Corporation have a performance-based c.docx
 
The Federal Reserve had to resort to non-standard methods to try to st.docx
The Federal Reserve had to resort to non-standard methods to try to st.docxThe Federal Reserve had to resort to non-standard methods to try to st.docx
The Federal Reserve had to resort to non-standard methods to try to st.docx
 
The EU recently admitted the Eastern European countries- How do you as.docx
The EU recently admitted the Eastern European countries- How do you as.docxThe EU recently admitted the Eastern European countries- How do you as.docx
The EU recently admitted the Eastern European countries- How do you as.docx
 
The Esposito Import Company had 1 million shares of common stock outst.docx
The Esposito Import Company had 1 million shares of common stock outst.docxThe Esposito Import Company had 1 million shares of common stock outst.docx
The Esposito Import Company had 1 million shares of common stock outst.docx
 
The energy levels of electrons are related to their- a) Position on t.docx
The energy levels of electrons are related to their-  a) Position on t.docxThe energy levels of electrons are related to their-  a) Position on t.docx
The energy levels of electrons are related to their- a) Position on t.docx
 
The Electron in a Hydrogen Atom transforms from its n-1 state to its n.docx
The Electron in a Hydrogen Atom transforms from its n-1 state to its n.docxThe Electron in a Hydrogen Atom transforms from its n-1 state to its n.docx
The Electron in a Hydrogen Atom transforms from its n-1 state to its n.docx
 
The enqueue operation on the Queue ADT adds a new item to the back of (1).docx
The enqueue operation on the Queue ADT adds a new item to the back of (1).docxThe enqueue operation on the Queue ADT adds a new item to the back of (1).docx
The enqueue operation on the Queue ADT adds a new item to the back of (1).docx
 
The Fed follows the theory of bureaucratic behavior in what sense-.docx
The Fed follows the theory of bureaucratic behavior in what sense-.docxThe Fed follows the theory of bureaucratic behavior in what sense-.docx
The Fed follows the theory of bureaucratic behavior in what sense-.docx
 
Pay structures Union contracts Wage and price contracts Levels of reve.docx
Pay structures Union contracts Wage and price contracts Levels of reve.docxPay structures Union contracts Wage and price contracts Levels of reve.docx
Pay structures Union contracts Wage and price contracts Levels of reve.docx
 
Pat ts oints Give all answers to the corret number of significant figu.docx
Pat ts oints Give all answers to the corret number of significant figu.docxPat ts oints Give all answers to the corret number of significant figu.docx
Pat ts oints Give all answers to the corret number of significant figu.docx
 
Partial balance sheets and additional iformation are listed below for.docx
Partial balance sheets and additional iformation are listed below for.docxPartial balance sheets and additional iformation are listed below for.docx
Partial balance sheets and additional iformation are listed below for.docx
 
PART ONE- Briefly explain and illustrate how the unemployment rate and.docx
PART ONE- Briefly explain and illustrate how the unemployment rate and.docxPART ONE- Briefly explain and illustrate how the unemployment rate and.docx
PART ONE- Briefly explain and illustrate how the unemployment rate and.docx
 
Part K (There is no common name for this species-) CHO Spell out the f.docx
Part K (There is no common name for this species-) CHO Spell out the f.docxPart K (There is no common name for this species-) CHO Spell out the f.docx
Part K (There is no common name for this species-) CHO Spell out the f.docx
 
Part I- Avoid claims rejections A payer may delay or deny payment beca.docx
Part I- Avoid claims rejections A payer may delay or deny payment beca.docxPart I- Avoid claims rejections A payer may delay or deny payment beca.docx
Part I- Avoid claims rejections A payer may delay or deny payment beca.docx
 
Part B 1- (2 pts-) Write the reaction equation of ammonium ions with s.docx
Part B 1- (2 pts-) Write the reaction equation of ammonium ions with s.docxPart B 1- (2 pts-) Write the reaction equation of ammonium ions with s.docx
Part B 1- (2 pts-) Write the reaction equation of ammonium ions with s.docx
 
Part A Prepare an income statement and a statement of retained earning.docx
Part A Prepare an income statement and a statement of retained earning.docxPart A Prepare an income statement and a statement of retained earning.docx
Part A Prepare an income statement and a statement of retained earning.docx
 
Part 3 Put it all together- Calculate the concentrations of all speci.docx
Part 3  Put it all together- Calculate the concentrations of all speci.docxPart 3  Put it all together- Calculate the concentrations of all speci.docx
Part 3 Put it all together- Calculate the concentrations of all speci.docx
 

Recently uploaded

Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting DataJhengPantaleon
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 

Recently uploaded (20)

Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 

Part 3 Your animation should contain at least the following- Translati.docx

  • 1. Part 3 Your animation should contain at least the following: Translation and/or scaling Solution %% The story is a pretty simple one. A ship is trying to travel through universe through a wormhole clc close all clear all myaxes=axes('xlim',[-5 5],'ylim',[-5 15],'zlim',[-4 4]); view(3); grid on; axis equal; hold on; %% Wormhole coordinates t = 0:pi/10:2*pi; [wormhole_x,wormhole_y,wormhole_z] = cylinder(2.2+2*cos(t)); %% Genaerating coordinates of cylinder , sphere and ellipse [cylinder_x cylinder_y cylinder_z]=cylinder([1 1]); [sphere_x sphere_y sphere_z]=sphere(); [elp_x elp_y elp_z]=ellipsoid(0,0,0,2,.5,.5); %% This is the ship h(1)=surface(cylinder_y,cylinder_z,cylinder_x); h(2)=surface(sphere_y,sphere_z,sphere_x); h(3)=surface(elp_y,elp_z,elp_x); h(4)=surface(elp_x,elp_z,elp_y); h(5)=surface(sphere_y,sphere_z+1,sphere_x); %%This is the wormhole and few stars scene1=surface(wormhole_y,wormhole_z*5+8,wormhole_x); scene2=surface(sphere_x*0.1-10,sphere_y*0.1,sphere_z*0.1+1); scene3=surface(sphere_x*0.1+5,sphere_y*0.1,sphere_z*0.1+1); scene4=surface(sphere_x*0.3-3,sphere_y*0.3-6,sphere_z*0.3+2); scene5=surface(sphere_x*0.3+3,sphere_y*0.3-1,sphere_z*0.3+2); scene6=surface(sphere_x*0.5-3,sphere_y*0.5-6,sphere_z*0.5+4);
  • 2. %%Creating a group object combinedobject=hgtransform('parent',myaxes); set(h,'parent',combinedobject) drawnow %% Defining its rotation and translation X=zeros(21); Y=0:20/20:20; Z=zeros(21); A=0:2*pi/20:4*pi; %% Actually doing the animation for i=1:length(X) translation=makehgtform('translate',... [X(i) Y(i) Z(i)]); resize=makehgtform('scale',1-i/40); rotation=makehgtform('yrotate',A(i)); set(combinedobject,'matrix',rotation*resize*translation); pause(0.2); end