Prev: IMA ADPCm files format
Next: urlread problem
From: Eddie Kwan on 13 Jul 2010 02:54 Hi all, I'm trying to figure out the coordinates(x,y,z) of the nodes of a triangular mesh that I created using the trimesh function. Does anyone know of an easy way to figure out where the nodes are? Also, I need to know which nodes are connected to all the other nodes. My shape is circular and thus I had to use polar coordinates to start with, otherwise I would have the corners of the square mesh sticking out. c_0=.207; c_1=2.0; c_2=-1.123; R_0=3.91; [r,t]=meshgrid(0:.391:3.91,0:pi/50:2*pi); tri=delaunay(r,t); x=r.*cos(t); y=r.*sin(t); z1=.5*R_0*((1-((x.^2+y.^2)/(R_0^2))).^.5).*(c_0+c_1*((x.^2+y.^2)/(R_0^2))+c_2*((x.^2+y.^2)/(R_0^2)).^2); z2=-.5*R_0*((1-((x.^2+y.^2)/(R_0^2))).^.5).*(c_0+c_1*((x.^2+y.^2)/(R_0^2))+c_2*((x.^2+y.^2)/(R_0^2)).^2); trimesh(tri,x,y,z1); hold on; trimesh(tri,x,y,z2); hold off;
From: John D'Errico on 13 Jul 2010 05:32 "Eddie Kwan" <edkwan88(a)hotmail.com> wrote in message <i1h2ib$3l7$1(a)fred.mathworks.com>... > Hi all, > > I'm trying to figure out the coordinates(x,y,z) of the nodes of a triangular mesh that I created using the trimesh function. Does anyone know of an easy way to figure out where the nodes are? Also, I need to know which nodes are connected to all the other nodes. My shape is circular and thus I had to use polar coordinates to start with, otherwise I would have the corners of the square mesh sticking out. > > c_0=.207; > c_1=2.0; > c_2=-1.123; > R_0=3.91; > > [r,t]=meshgrid(0:.391:3.91,0:pi/50:2*pi); > tri=delaunay(r,t); > > x=r.*cos(t); > y=r.*sin(t); > > z1=.5*R_0*((1-((x.^2+y.^2)/(R_0^2))).^.5).*(c_0+c_1*((x.^2+y.^2)/(R_0^2))+c_2*((x.^2+y.^2)/(R_0^2)).^2); > z2=-.5*R_0*((1-((x.^2+y.^2)/(R_0^2))).^.5).*(c_0+c_1*((x.^2+y.^2)/(R_0^2))+c_2*((x.^2+y.^2)/(R_0^2)).^2); > > trimesh(tri,x,y,z1); > hold on; > trimesh(tri,x,y,z2); > hold off; I am absolutely confused by this question. The nodes are defined by your code! They lie in the arrays that you have created. And tri tells you how things are connected, as you should surely know IF you wrote the code. So what is your question? Perhaps you did not actually write this code, and you have no idea what it does or how it works? John
From: Steven Lord on 13 Jul 2010 10:05 "John D'Errico" <woodchips(a)rochester.rr.com> wrote in message news:i1hbql$fos$1(a)fred.mathworks.com... > "Eddie Kwan" <edkwan88(a)hotmail.com> wrote in message > <i1h2ib$3l7$1(a)fred.mathworks.com>... >> Hi all, >> >> I'm trying to figure out the coordinates(x,y,z) of the nodes of a >> triangular mesh that I created using the trimesh function. Does anyone >> know of an easy way to figure out where the nodes are? Also, I need to >> know which nodes are connected to all the other nodes. My shape is >> circular and thus I had to use polar coordinates to start with, otherwise >> I would have the corners of the square mesh sticking out. *snip* > I am absolutely confused by this question. The nodes > are defined by your code! They lie in the arrays that > you have created. > > And tri tells you how things are connected, as you > should surely know IF you wrote the code. > > So what is your question? > > Perhaps you did not actually write this code, and > you have no idea what it does or how it works? Or perhaps the OP ran the code to generate the figure, saved the figure, and closed down MATLAB (or cleared the variables) and now wants to regenerate the data from the figure. If that's the case, obtain a handle to the graphics objects created by the TRIMESH calls (use FINDOBJ to do so) then look at the properties for those objects using GET. The XData, YData, and ZData properties are probably going to be of particular interest to the OP. -- Steve Lord slord(a)mathworks.com comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ To contact Technical Support use the Contact Us link on http://www.mathworks.com
|
Pages: 1 Prev: IMA ADPCm files format Next: urlread problem |