How can we save the color affected to a point and affect this color to another point (in 3D plot) ?

2 ビュー (過去 30 日間)
Hello,
I am currently working with a list of points (3d coordinates). At the beginning, I have this list of coordinates (x list, y list, z list) in a local frame and when I plot it (with plot3k for instance) I have a color assigned to each point, depending on the z-value. Then, I rotate and translate these points and I plot them again, but I want to have the same color on each point than previously (it cannot be done with plot3k directly because the color depends on the new z-value).
I was thinking of saving the color assigned to each points in the local frame (so I will have a list of colors with the same length than the list of coordinates) and then assign again to each points its color after the rotation and translation. But I don't know how to do that exactly.
Could you help me ?
At the end, my functions will look like
function color_list = getColor(z_list_frame1)
%get the color code for each z-value
end
and
function my_plot3(x_list_frame2,y_list_frame2,z_list_frame2,color_list)
%plot each point with the corresponding color
end
Thank you in advance for your help !
  2 件のコメント
Image Analyst
Image Analyst 2017 年 11 月 14 日
I don't understand your definition of "affected". The normal English definition of affected doesn't fit the context of your sentences. Just what does "affected" mean to you?
N.
N. 2017 年 11 月 14 日
Hello,
Yes sorry I did not translate well, I think the word "assigned" is better.
Thank you!

サインインしてコメントする。

採用された回答

N.
N. 2017 年 11 月 14 日
Hello,
I found the solution I was looking for : with scatter3. I can directly do scatter3(x_list_frame2,y_list_frame2,z_list_frame2,2,z_list_frame1).
Thank you anyway.

その他の回答 (1 件)

KSSV
KSSV 2017 年 11 月 14 日
Use delaunay triangulation....to plot what you want.
dt = delaunayTriangulation(x,y) ;
REad about triplot and trisurf.
  3 件のコメント
KSSV
KSSV 2017 年 11 月 15 日
There are two ways to put a color......plot a mesh/ surface and put color or plot points and put color......for the first delaunay triangulation helps., for the second scatter helps.
N.
N. 2017 年 11 月 15 日
Hello,
Yes, finally scatter was the solution.
Thank you for your help.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by