Filter löschen
Filter löschen

patchm vertex ordering?

4 Ansichten (letzte 30 Tage)
William
William am 23 Apr. 2012
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 Kommentar
William
William am 24 Apr. 2012
Looks like this is a bug, there is a bug report on this same issue that is claimed to be fixed in 2010b, however I'm using 2011a and I am having the same problems.
http://www.mathworks.com/support/bugreports/641390

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by