Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I edit here because it's a long code. After the hints from David and kalhartt, I have tried this:</p> <pre><code>N = 3600; % number of points t = (1:N) * pi / 180; % parameter % theta_sph much faster than phi_sph to avoid overly visiting the poles theta_sph = sqrt(20.01) * t * pi; % first angle phi_sph = sqrt(.02) * t * pi; % second angle rho_sph = 1; % radius % Coordinates of a point on the surface of a sphere x_sph0 = rho_sph * sin(phi_sph) .* cos(theta_sph); y_sph0 = rho_sph * sin(phi_sph) .* sin(theta_sph); z_sph0 = rho_sph * cos(phi_sph); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Use David's hint to rotate axes (but only the first now): rot_angle1 = t * pi / 10; rot_angle2 = 0; rot_angle3 = 0; x_sph1 = x_sph0; y_sph1 = y_sph0.*cos(rot_angle1)-z_sph0.*sin(rot_angle1); z_sph1 = y_sph0.*sin(rot_angle1)+z_sph0.*cos(rot_angle1); x_sph2 = x_sph1.*cos(rot_angle2)+z_sph1.*sin(rot_angle2); y_sph2 = y_sph1; z_sph2 = -x_sph1.*sin(rot_angle2)+z_sph1.*cos(rot_angle2); x_sph = x_sph2.*cos(rot_angle3)-y_sph2.*sin(rot_angle3); y_sph = x_sph2.*sin(rot_angle3)+y_sph2.*cos(rot_angle3); z_sph = z_sph2; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Check length of jumps aa = [x_sph(1:(N-1)); y_sph(1:(N-1)); z_sph(1:(N-1))]; bb = [x_sph(2:N); y_sph(2:N); z_sph(2:N)]; cc = cross(aa, bb); d = rho_sph * atan2(arrayfun(@(n) norm(cc(:, n)), 1:size(cc,2)), dot(aa, bb)); figure plot(d, '.') % Check trajectory on the surface of the sphere figure hh = 1; h_plot3 = plot3(x_sph(hh), y_sph(hh), z_sph(hh), '-'); hold on axis square % axis off set(gca, 'XLim', [-1 1]) set(gca, 'YLim', [-1 1]) set(gca, 'ZLim', [-1 1]) for hh = 1:N h_point3 = plot3(x_sph(hh), y_sph(hh), z_sph(hh), ... 'o', 'MarkerFaceColor', 'r', 'MarkerEdgeColor', 'r'); drawnow delete(h_point3) set(h_plot3, 'XData', x_sph(1:hh)) set(h_plot3, 'YData', y_sph(1:hh)) set(h_plot3, 'ZData', z_sph(1:hh)) end </code></pre> <p>I think it's much better than before! Two things that I have found to be important: 1. theta_sph must be much faster than phi_sph to avoid visiting two opposite poles too often; 2. if theta_sph goes faster than phi_sph, then you have to slowly rotate over either rot_angle1 or rot_angle2 in order to obtain a trajectory that is not too messy. I'm still open to any other hints to improve the result.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload