bugGNU Octave - Bugs: bug #66739, Reset Zoom is failing when at...

 
 

bug #66739: Reset Zoom is failing when at atomic level sizes. Works usually 8.4.0

Submitter:  None
Submitted:  Thu 30 Jan 2025 07:33:46 PM UTC
   
 
Category:  Plotting Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Other
Status:  None Assigned to:  None
Originator Name:  TJ Fidler Originator Email:  -email is unavailable-
Open/Closed:  * Open Release:  * 9.2.0
Operating System:  * Microsoft Windows Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Thu 30 Jan 2025 09:37:19 PM UTC, comment #1: 

Isn't this caused by OpenGL working with floats (single precision) rather than doubles?

Philip Nienhuis <philipnienhuis>
Group Member
Thu 30 Jan 2025 07:33:46 PM UTC, original submission:  

The following code that uses Reset Zoom usually works in GNU Octave 8.4.0, Windows 10, but more often than not working in 9.2.0 or 9.3.0. Perhaps because of the atomic scale :
fixed_limits = [-5.0e-11, 5.0e-11, -5.0e-11, 5.0e-11];
When moved the limits in the figure axis change to -6.0e9 to 6.0e9 versus e-11

% Define radii and angles for the polar grid
polar_r_min = r_min; % Minimum radius
polar_r_max = r_max; % Maximum radius
polar_radii = polar_r_min:r_steps:polar_r_max; % Define radii based on the min and max
polar_angles = 0:radial_change_deg:360; % Define angular divisions

% Create a matrix for visualization
polar_density_matrix = zeros(length(polar_radii), length(polar_angles)-1);
for i = 1:polar_deg_length
    for j = 1:polar_radial_width
        polar_density_matrix(j, i) = dataPolar1Array{i, j}(3); % Extract density values
    end
end

% Create Figure 3
figure(3);
set(gcf, 'Position', [750, 100, 600, 440]);  % Set position of the first figure
hold on;

% Find maximum density value for normalization
max_density = max(cellfun(@(x) x(3), dataPolar1Array(:)));

% Fill polar regions based on `dataPolar1Array` densities
for i = 1:polar_deg_length
    for j = 1:polar_radial_width
        % Extract density value for the current region
        density_value = dataPolar1Array{i, j}(3);

        if density_value > 0
            % Normalize density value to [0, 1]
            normalized_density = density_value / max_density;

            % Get the corners of the region
            r1 = r_min + (j * r_steps); % Outer radius
            r0 = r1 - r_steps;         % Inner radius
            theta_start = deg2rad((i-1) * radial_change_deg); % Start angle
            theta_end = deg2rad(i * radial_change_deg);       % End angle

            % Define the region coordinates for smooth curves
            theta_region = linspace(theta_start, theta_end, 100);
            x_region = [r0 cos(theta_region), fliplr(r1 cos(theta_region))];
            y_region = [r0 sin(theta_region), fliplr(r1 sin(theta_region))];

            % Fill the region with a color proportional to normalized density
            fill(x_region, y_region, [0, 0, normalized_density], 'EdgeColor', 'none'); % Blue gradient
        end
    end
end

% Draw the polar grid
% Concentric circles
for r = polar_radii
    theta_grid = linspace(0, 2 * pi, 360); % Full circle
    x_grid = r * cos(theta_grid);
    y_grid = r * sin(theta_grid);
    plot(x_grid, y_grid, 'k'); % Plot the circles
end

% Radial lines
for theta = deg2rad(polar_angles)
    x_line = [0, polar_r_max * cos(theta)];
    y_line = [0, polar_r_max * sin(theta)];
    plot(x_line, y_line, 'k'); % Plot the lines
end

% Set fixed axis limits to [-5.0e-11, 5.0e-11]
fixed_limits = [-5.0e-11, 5.0e-11, -5.0e-11, 5.0e-11];
axis(fixed_limits);
set(gca, 'XLim', fixed_limits(1:2), 'YLim', fixed_limits(3:4)); % Enforce axis limits explicitly
daspect([1 1 1]); % Keep equal aspect ratio
grid on;
xlabel('X (m)');
ylabel('Y (m)');
title('Polar Grid with DataPolar1Array Densities');

% Add a reset button to restore axis limits
uicontrol('Style', 'pushbutton', 'String', 'Reset Zoom', ...
    'Position', [30, 20, 120, 30], ...
    'Callback', @(src, event) set(gca, 'XLim', fixed_limits(1:2), 'YLim', fixed_limits(3:4)));

% Add a resize function to enforce axis limits when the figure is resized
set(gcf, 'resizefcn', @(src, event) set(gca, 'XLim', fixed_limits(1:2), 'YLim', fixed_limits(3:4)));

hold off;

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #56835:  atomic_k_basedOn_20250119_goodStart_less_02_forUpload.m added by None (13KiB - application/vnd.wolfram.mathematica.package - Sometimes there is a resize issue in 8.4.0 as well.)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by None (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2025-01-30 None Attached File- Added atomic_k_basedOn_20250119_goodStart_less_02_forUpload.m, #56835

    Back to the top

    Powered by Savane 3.14-9aa3.
    Corresponding source code