Direction of Arrows in Quiver (2D)
Show older comments
this is related to the question asked here:
so I did make to seperate quivers for the inwards and outwards arrows. the new problem is, that some of my arrows that i think should be pointing outwards are pointing inwards.
here is how i created this, tell me where you think i am wrong:
-
-
% find slope of profile
m_profile(2:45, :)=diff(z1)./diff(x1);
m_profile(1,:)=1.7612;
m_profile(29,:)=0;
-
-
%find arrow slope according to m2=-1/m1
m_arrow=-1./m_profile; theta=atand(m_arrow);
-
%create mark vector - indicating which arrows should point inweard(negative cp values)
for j=1:num
for i=1:45
if cp_norm(j,i)<0
mark(i,j)=1; %mark arrows pointing inwards
end end end
% sort flagged control points - create 2 matrixes - one for inwards(flag) and one for outward (nflag) arrows
k=1; l=1;
flag=[];
nflag=[];
for i=1:45
if mark(i,j)==1
flag(k,1)=x1(i,j);
flag(k,2)=z1(i,j);
flag(k,3)=cp_norm(j,i)*cosd(theta(i,j));
flag(k,4)=cp_norm(j,i)*sind(theta(i,j));
k=k+1;
else
nflag(l,1)=x1(i,j);
nflag(l,2)=z1(i,j);
nflag(l,3)=cp_norm(j,i)*cosd(theta(i,j));
nflag(l,4)=cp_norm(j,i)*sind(theta(i,j));
l=l+1;
end
end
still the result is some of the arrows are pointing inwards as you can see, where am i wrong?
thanks,
Noa
Accepted Answer
More Answers (0)
Categories
Find more on Vector Fields in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!