patchm vertex ordering?
Afficher commentaires plus anciens
Here I have two triangles with vertices resting on the unit sphere, specified in clockwise order looking at the outer surface of the sphere. Plotting vgood with patchm gives the expected result, a triangle in the projected map. However, vbad is interpreted as the inverse, a polygon covering the entire globe, leaving the triangle as a hole.
Given that both triangles have the same vertex ordering, I would expect them to have the same behavior. What's the problem here?
vbad = [ ...
-0.6375993113323332 -0.20403949778403738 -0.7428559763053484; ...
-0.8500194502416963 0.09199320574455130 -0.5186561330088028; ...
-0.8113166555881062 -0.28694517808882358 -0.5093405041196936];
vgood = [ ...
-0.6375993113323332 -0.20403949778403738 -0.7428559763053484; ...
-0.6518705906365251 0.19086859353491015 -0.7339168298010295; ...
-0.8500194502416963 0.09199320574455130 -0.5186561330088028];
% convert to lat/long
llbad = [-acos(vbad(:,3)) atan2(vbad(:,2),vbad(:,1))]*(360/(2*pi));
llbad(:,1) = llbad(:,1)+90;
llgood = [-acos(vgood(:,3)) atan2(vgood(:,2),vgood(:,1))]*(360/(2*pi));
llgood(:,1) = llgood(:,1)+90;
axesm pcarree;
patchm(llbad(:,1), llbad(:,2), 'FaceColor', 'r', 'EdgeColor', 'k');
patchm(llgood(:,1), llgood(:,2), 'FaceColor', 'g', 'EdgeColor', 'k');
1 commentaire
William
le 24 Avr 2012
Réponses (0)
Catégories
En savoir plus sur Surface and Mesh Plots dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!