Changeset 20179
- Timestamp:
- 02/16/16 15:11:27 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/exp/exp2levelsetfunction.m
r20178 r20179 43 43 w=[segment.w.x segment.w.y]; 44 44 verts=[x y]; 45 t=[x-v(1) y-v(2)]*(w-v)'/norm(w-v)^2; %projection of verts on line defined by v and w 45 dist_vw2=norm(w-v)^2; 46 if(dist_vw2==0.), t=zeros(size(x)); %cover case where segment has length 0 47 else t=[x-v(1) y-v(2)]*(w-v)'/dist_vw2; end %projection of verts on line defined by v and w 46 48 dist_vec=(ones(length(x),1)*v+max(0,min(1,t))*(w-v))-verts; %vector of shortest distance between verts and segment v-w 47 49 dist=sqrt(sum(abs(dist_vec).^2,2));
Note:
See TracChangeset
for help on using the changeset viewer.