我试图找到一个点的轨迹的参数方程,该点在单位球面上的不同点上跳跃,使得:

  • 每次跳跃都很小(pi/4
  • 该点尽可能快且均匀地访问球体的大部分区域
  • 该点沿“方向矢量”行进的距离尽可能小

  • 这就是我尝试过的
    N = 3600;    % number of points
    t = (1:N) * pi / 180;    % parameter
    theta_sph = sqrt(2) * t * pi;    % first angle
    phi_sph = sqrt(3) * t * pi;    % second angle
    rho_sph = 1;    % radius
    % Coordinates of a point on the surface of a sphere
    x_sph = rho_sph * sin(phi_sph) .* cos(theta_sph);
    y_sph = rho_sph * sin(phi_sph) .* sin(theta_sph);
    z_sph = rho_sph * cos(phi_sph);
    
    % Check length of jumps (it is intended that this is valid only for small 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, '.')
    figure
    plot(diff(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
    

    编辑-> 有人可以找到更规则的轨迹,也许更快地(即,跳跃次数最少)且更均匀地覆盖球体吗?有规律的轨迹,它应该平滑而不是急剧地改变方向。审美美是一种奖励。这些点应尽可能均匀地分布在球体的表面上。

    最佳答案

    修改代码的开头以引入基础球体的旋转。这样产生的轨迹不会像两极一样频繁返回极点。可能需要对转速进行一些调整才能看起来“不错”(而且,当它仅绕一个轴而不是全部3个轴旋转时,看起来可能会更好)。 rot_angle1是绕x轴旋转,而rot_angle2rot_angle3是绕y和z轴旋转。也许这至少给您一个主意!

    N = 3600;    % number of points
    t = (1:N) * pi / 180;    % parameter
    theta_sph = sqrt(2) * t * pi;    % first angle
    phi_sph = sqrt(3) * t * pi;    % second angle
    rho_sph = 1;    % radius
    rot_angle1 = sqrt(2) * t * pi;
    rot_angle2 = sqrt(2.5) * t * pi;
    rot_angle3 = sqrt(3) * t * pi;
    % 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);
    
    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;
    

    关于matlab - 球体表面上的最佳轨迹,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/19668398/

    10-09 05:21