Intersection points between a line and trisurf plot

7 ビュー (過去 30 日間)
John Doe
John Doe 2015 年 8 月 19 日
編集済み: John Doe 2015 年 8 月 27 日
I am looking to draw a random line on a trisurf plot and get intersection coordinates and property data about the elements which lie along this line.
For example I have data which looks like the following:
close all
% trisurf plot with random properties
[x,y] = meshgrid(1:19,1:19);
tri = delaunay(x,y);
z = zeros(size(x));
[m,n] = size(x);
F = randi([2,5],1,1);
C = randi([1,F],m*n,1);
trisurf(tri,x,y,z,C)
axis ([0,20,0,20])
colormap colorcube
hold on
%generate random intersection line
G = [0 20];
A = [randi([0,20],1,1) G(randi(2))];
B = [G(randi(2)) randi([0,20],1,1)];
plot(A,B,'Color','r','LineWidth',2)
I was expecting an output in the format of matrix of x and y coordinate intersections and properties either side of intersection point eg [xcoord,ycoord,prop1,prop2]. Otherwise the property matrix can be done separately and just be a list of each element property along the randomly generated line.
Hope that makes sense. Thank you for your help.

回答 (1 件)

Dasharath Gulvady
Dasharath Gulvady 2015 年 8 月 21 日
編集済み: Dasharath Gulvady 2015 年 8 月 21 日
  1 件のコメント
John Doe
John Doe 2015 年 8 月 27 日
編集済み: John Doe 2015 年 8 月 27 日
This doesn't explain how property data/values could be extracted from the mesh/plot

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

カテゴリ

Help Center および File ExchangeVisual Exploration についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by