Obtaining 3-d polygon in Matlab, by picking points.

조회 수: 3 (최근 30일)
Archak Goel
Archak Goel 2014년 2월 2일
편집: Matt J 2014년 2월 2일
I need to plot am extensive framework of 3d polygons in Matlab. putting point values and then drawing is a very cumbersome task. Is there any way that I can do this thing by either picking points in 3-d (like in paintbrush) ? Or any other alternate software and then export in matlab?

답변 (3개)

Shivaputra Narke
Shivaputra Narke 2014년 2월 2일
NumOfPoints=10; hax=gca; axis([0 10 0 5]) [x y] =ginput(NumOfPoints); plot(x,y);
  댓글 수: 2
Archak Goel
Archak Goel 2014년 2월 2일
편집: Archak Goel 2014년 2월 2일
Thanks Mr. Narke. But can I do for 3-d space? This technique is limited to 2-d selection. I tried to modify your code for 3-d, the result was whatever I was selecting it was getting selected at z = 1 plane. Is there any way to define the plane in which we want to do the selection? How can I view the points as I am doing selection?
Shivaputra Narke
Shivaputra Narke 2014년 2월 2일
Yes you can do it for 3-D also but you have to write 'ButtonDownFcn' for axes that you are going to use.That involves pretty much lengthy code.
for your second question that is viewing selected points...
use following code,
NumOfPoints=10; hax=gca; axis([0 10 0 5]) ; hold on; allX=zeros(1,NumOfPoints); allY=zeros(1,NumOfPoints); vertices=[]; for i=1:NumOfPoints [x y] =ginput(1); plot(x,y,'ro'); vertices=[vertices;x y]; end cla; plot(vertices(:,1),vertices(:,2));

댓글을 달려면 로그인하십시오.


Shivaputra Narke
Shivaputra Narke 2014년 2월 2일
Hope this help you... use following code... function MainPlotPoly global POINTS POINTS=[]; hax=gca; axis([0 10 0 10 -5 5]) set(hax,'NextPlot','add'); grid on; set(hax,'ButtonDownFcn',@PlotPoly);
function PlotPoly(varargin)
global POINTS Cp=get(varargin{1},'CurrentPoint'); POINTS=[POINTS;Cp]; plot3(POINTS(:,1),POINTS(:,2),POINTS(:,3),'Marker','O');

Matt J
Matt J 2014년 2월 2일
편집: Matt J 2014년 2월 2일
You can use PLOTREGION, possibly in conjunction with VERT2LCON , if you don't know the polyhedron in inequality form.

카테고리

Help CenterFile Exchange에서 Data Exploration에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by