Creating a 3D circular spiral phase plate using geometry nodes.
I'm trying to create different 3D phase plates about 5mm in diameter using geometry nodes that can be 3D printed out. They should look something like this.
Image of my node network
Note: I can create one in Octave, but converting that to geometry nodes is a little different.
For background here's the Octave / Matlab code I used to generate the plot. To run the code online just go to https://octave-online.net/ and paste the code below in the box (you may need to change N=70 to N=20)
% Parameters
N = 70; % Grid size
R = 1; % Radius of the plate
m = 3; % Topological charge (number of 2π phase cycles)
% Create grid
[x, y] = meshgrid(linspace(-R, R, N), linspace(-R, R, N));
% Convert to polar coordinates
r = sqrt(x.^2 + y.^2);
theta = atan2(y, x);
% Create phase plate
phase = mod(m * theta, 2*pi);
% Create height map (z-coordinate)
z = phase / (2*pi) * R;
% Mask the plate to be circular
mask = r <= R;
z = z .* mask;
% Plot the 3D spiral phase plate with black outlines
figure;
surf(x, y, z, phase);%% Plot the 3D spiral phase plate
hold on;
contour3(x, y, z, [0 0], 'k', 'LineWidth', 2);
%
%shading flat; % Set shading to flat for a more "line-art" look
%colormap([1 1 1]); % Set colormap to white
axis equal;
xlabel('X');
ylabel('Y');
zlabel('Z');
title('3D Circular Spiral Phase Plate with Black Outlines');
%view(45, 30);
S
in the image issquareish
and not atrianglesh"
shape. $\endgroup$