Filling in a spherical triangle

4 visualizaciones (últimos 30 días)
Lorcan O'Connor
Lorcan O'Connor el 2 de Abr. de 2021
Respondida: darova el 2 de Abr. de 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?

Respuestas (2)

KSSV
KSSV el 2 de Abr. de 2021
Read about delaunayTraingulation.

darova
darova el 2 de Abr. de 2021
clc,clear
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));
end
% 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);
surf(X,Y,Z)
surface(xs,ys,zs,'facecolor','none')
view(45,45)
See more about 3D curve inteprolation: LINK

Categorías

Más información sobre Surface and Mesh Plots en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by