Answered step by step
Verified Expert Solution
Question
00
1 Approved Answer
In 1.1 it's already converted to Cartesian. The code: Thanks! Part 1: Generating a Point Cloud Sphere Fill in the missing code part for sphere
In 1.1 it's already converted to Cartesian.
The code:
Thanks!
Part 1: Generating a Point Cloud Sphere Fill in the missing code part for sphere generation. The random generation code for spherical coordinates (radial, azimuthal, polar) has already been provided. Fill in the missing code to: (1) Convert the spherical coordinates into cartesian coordinate system (x, y, z). (2) Convert the cartesian coordinate into homogeneous coordinate system. Part 2: 3D Translation, Non-Uniform Scaling Fill in the missing code to: (1) Apply a random translat (2) Apply a random translation, followed by a non-uniform scaling on the original sphere, on on the original sphere, named as "sphere_1". named as "sphere 2" (3) Apply 3D rotations in x, y, z directions on sphere 2", named as "sphere 3" clear all; close all; % Generate random spherical coordinates( radial, azimuthal, polar) 4 5 - N 5000; radial 8*(rand (N,1)); azimuthal 2*pi*rand (N,1); polar pirand (N,1); % Convert to cartesian x - radial.xcos(azimuthal).*sin(polar); y - radial.*sin(azimuthal).xsin(polar); z - radial.cos (polar); 10 12 13 14 15 16 17 18 19- M1 20-size(M1) 21 % Convert to Homogeneous Coordinate sphere [; % 3D Translation, on Original Sphere % sphere-MI- ; % 3D Translation with Non-uniform scaling, on Original Sphere 23 24- M2 25-size(M2) 26 27 28 29 30 31 32 % sphere-M2- ; % 3D Rotations on Sphere M2 % theta! sphere_R[; 34 35s: 36 37 38 39 40 41-figure(1) 42 43 % Composite Transformation sphere M - % Check the norm after applying two equivalent transformations fprintf("Norm: %1 ', norm (sphere-R- sphere-M)) % plot 45 46 47 48 49-grid on; 50-xlabel X, ylabel Y, zlabel Z 51 -hold off; hold on; scatter3(x, y, z, 2, 'filled', 'r') % scatter3 ( sphere-M 1 ( 1, :) , sphere.M 1 (2, :), sphere-M1(3, :), % scatter3 (sphere.M2(1..), sphere.M2(2, :), sphere. .M2(3, :), % scatter3 (sphere-R( 1, :), sphere-R ( 2,:), sphere-R ( 3, :), 2, % scatter3 ( sphere-M ( 1, :), sphere.M ( 2,;), sphere.M ( 3, :), 2, axis vis3d equal 2, "filled', 'b') 2, 'filled', 'y') 'filled', .g.) 'filled', .p') Part 1: Generating a Point Cloud Sphere Fill in the missing code part for sphere generation. The random generation code for spherical coordinates (radial, azimuthal, polar) has already been provided. Fill in the missing code to: (1) Convert the spherical coordinates into cartesian coordinate system (x, y, z). (2) Convert the cartesian coordinate into homogeneous coordinate system. Part 2: 3D Translation, Non-Uniform Scaling Fill in the missing code to: (1) Apply a random translat (2) Apply a random translation, followed by a non-uniform scaling on the original sphere, on on the original sphere, named as "sphere_1". named as "sphere 2" (3) Apply 3D rotations in x, y, z directions on sphere 2", named as "sphere 3" clear all; close all; % Generate random spherical coordinates( radial, azimuthal, polar) 4 5 - N 5000; radial 8*(rand (N,1)); azimuthal 2*pi*rand (N,1); polar pirand (N,1); % Convert to cartesian x - radial.xcos(azimuthal).*sin(polar); y - radial.*sin(azimuthal).xsin(polar); z - radial.cos (polar); 10 12 13 14 15 16 17 18 19- M1 20-size(M1) 21 % Convert to Homogeneous Coordinate sphere [; % 3D Translation, on Original Sphere % sphere-MI- ; % 3D Translation with Non-uniform scaling, on Original Sphere 23 24- M2 25-size(M2) 26 27 28 29 30 31 32 % sphere-M2- ; % 3D Rotations on Sphere M2 % theta! sphere_R[; 34 35s: 36 37 38 39 40 41-figure(1) 42 43 % Composite Transformation sphere M - % Check the norm after applying two equivalent transformations fprintf("Norm: %1 ', norm (sphere-R- sphere-M)) % plot 45 46 47 48 49-grid on; 50-xlabel X, ylabel Y, zlabel Z 51 -hold off; hold on; scatter3(x, y, z, 2, 'filled', 'r') % scatter3 ( sphere-M 1 ( 1, :) , sphere.M 1 (2, :), sphere-M1(3, :), % scatter3 (sphere.M2(1..), sphere.M2(2, :), sphere. .M2(3, :), % scatter3 (sphere-R( 1, :), sphere-R ( 2,:), sphere-R ( 3, :), 2, % scatter3 ( sphere-M ( 1, :), sphere.M ( 2,;), sphere.M ( 3, :), 2, axis vis3d equal 2, "filled', 'b') 2, 'filled', 'y') 'filled', .g.) 'filled', .p')Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started