Filling in a spherical triangle

1 view (last 30 days)
Lorcan O'Connor
Lorcan O'Connor on 2 Apr 2021
Answered: darova on 2 Apr 2021
I have a program that generates and plots the edges of spherical triangles on a unit sphere. How can I fill in the interior of the spherical triangle on the surface? I tried generating a large number of points on the interior but it doesn't look very good - is there a way to turn scattered points like that into a many-sided polygon?

Answers (2)

KSSV on 2 Apr 2021
Read about delaunayTraingulation.

darova on 2 Apr 2021
t = [0; 45; 45]*pi/180;
q = [45; 45; 90]*pi/180;
[x,y,z] = sph2cart([t;t(1)],[q;q(1)],1); % convert angles to cartesian coordinates
% interpolate triangle to create more points
tt = [0; cumsum(sqrt(diff(x).^2+diff(y).^2+diff(z).^2))]; % arclength (parameter)
t1 = linspace(tt(1),tt(end),30); % more points
x1 = interp1(tt,x,t1);
y1 = interp1(tt,y,t1);
z1 = interp1(tt,z,t1);
[X,Y,Z] = deal( zeros(5,30) );
% find approximate center of a triangle
x0 = mean(x1);
y0 = mean(y1);
z0 = mean(z1);
% create internal points
for i = 1:size(Z,2)
X(:,i) = linspace(x0,x1(i),size(X,1));
Y(:,i) = linspace(y0,y1(i),size(Y,1));
Z(:,i) = linspace(z0,z1(i),size(Z,1));
% points are created in a plane
% move them onto sphere
RR = sqrt(X.^2+Y.^2+Z.^2); % distance from sphere center to point. Should be '1'
X = X./RR;
Y = Y./RR;
Z = Z./RR;
[xs,ys,zs] = sphere(10);
See more about 3D curve inteprolation: LINK


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!