Clear Filters
Clear Filters

How to do a 3d vector cone plot for non-grid data? (3xN shaped matrix)

1 view (last 30 days)
I want to plot the vector map that has position and vector value with CONEPLOT. the matrix of vector value like this :
Number of data(vector point) : N,
VECTOR POSITION : NX3 matrix, VECTOR VALUE :Nx3 matrix
// two vector point
val=[1,2,3;2,3,4]; //vector's value is [1,2,3] and [2,3,4]
pos=[1,0,0;1,0,3]; //vector's position is [1,0,0]and [1,0,3]
Talking more specific, I am trying to divide the vectors to tangential/orthogonal components each over isosurface.
just plotting the vector values over the isosurfaces are okay :
XYZ : meshgrid(datasize : e.g 500x500x200 for each)
uvw : 3d vector element map for each axis(X,Y and Z)(datasize : e.g. 500x500x200 for each)
// meshgrid XYZ, vector value uvw, desired plotting point cxcycz
f=CONEPLOT(X,Y,Z,u,v,w,cx,cy,cz,Weight);
//isosurface of some volume
g=ISOSURFACE(X,Y,Z,imagevolume,3);
g=REDUCEPATCH(g,0.01);
p=patch(g);
//plot interpolated vector values over isosurface
selVertices=g.vertices;
qs = coneplot(X,Y,Z,u,v,w,selVertices(:,1),selVertices(:,2),selVertices(:,3),absVectors,sizeWeightCellSurf,'spline');
From here, I am trying to export the vector values over surfaces by using INTERP3. results are a Nx3 shaped matrix
//interpolating vector values over isosurfaces(g)
VerticesVector(:,1) = interp3(X,Y,Z,u,selVertices(:,1),selVertices(:,2),selVertices(:,3),'spline');
VerticesVector(:,2) = interp3(X,Y,Z,v,selVertices(:,1),selVertices(:,2),selVertices(:,3),'spline');
VerticesVector(:,3) = interp3(X,Y,Z,w,selVertices(:,1),selVertices(:,2),selVertices(:,3),'spline');
and to compute the surface normal componenet over isosurface, I am using ISONORMAL like below
iso=isonormals(imgaussfilt3(im_stack,5),p);
from the data 'iso' and 'VerticesVector', I can calculate the normal and tangential component by using dot products
surface unit normal Vector= normal vector of (iso)
V_normal=(surface unit normal Vector).*(surface Vector value);
V_tangential=(surface Vector value)-V_normal;
//data type : Nx3 matrix
but after that, I cannot plot this vector values for each position vector by using coneplot, because it is not a grid data shape. How should I process this data to make a CONEPLOT? or, is there any better way to compute / plot the normal/tangential vectors over specific points?
Regards,

Answers (0)

Community Treasure Hunt

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

Start Hunting!