From: Alex Johns on 15 Mar 2010 20:03 Hi all. So I'm trying to create a very specific 3d graph. I am starting with a "curve" (it's actually a set of line segments) in an x-y plane and I need to rotate the entire graph around the y (vertical) axis to create a 3d graph using cylindrical coordinates. Is there any way in matlab to rotate a 2d graph about an axis to create a 3d graph? Thanks for all the help. Alex
From: Darren Rowland on 16 Mar 2010 01:19 You probably need to provide some more information. Do you have a formula for determining how far into the z-direction each line segment should go?
From: Walter Roberson on 16 Mar 2010 15:43 Alex Johns wrote: > Hi all. So I'm trying to create a very specific 3d graph. I am > starting with a "curve" (it's actually a set of line segments) in an x-y > plane and I need to rotate the entire graph around the y (vertical) axis > to create a 3d graph using cylindrical coordinates. Is there any way in > matlab to rotate a 2d graph about an axis to create a 3d graph? See my reply a moment ago to Richard's topic "Spin a 2D Trace into a 3D Graph"
From: Alex Johns on 16 Mar 2010 23:12 "Darren Rowland" <darrenjremovethisrowland(a)hotmail.com> wrote in message <hnn4c7$p9i$1(a)fred.mathworks.com>... > You probably need to provide some more information. > Do you have a formula for determining how far into the z-direction each line segment should go? Hmm... Well what I have is a set of x-y coordinate pairs in an array. I generate the 2d graph simply by connecting point i to point i+1. So my 2d graph is just a series of connected lines. I need to rotate the entire graph by 2pi about the y-axis. So each line segment will generate a hollow cone segment. In cylindrical coordinates, each x-y pair becomes an r-y pair for all theta in [0, 2pi]. I'm not sure if this is the information you are looking for. Let me know if it's still confusing. Alex
From: Walter Roberson on 17 Mar 2010 03:37 Alex Johns wrote: > Hmm... Well what I have is a set of x-y coordinate pairs in an array. I > generate the 2d graph simply by connecting point i to point i+1. So my > 2d graph is just a series of connected lines. I need to rotate the > entire graph by 2pi about the y-axis. So each line segment will > generate a hollow cone segment. In cylindrical coordinates, each x-y > pair becomes an r-y pair for all theta in [0, 2pi]. R = sqrt(X.^2+Y.^2); Now generate circles of radius R (a vector), with the K'th circle having a constant Y coordinate equal to Y(K) and being in the X-Z plane with radius R(K). If you approximate the circle by an N-gon, then you can pre-calculate the vertices of the N-gon with unit "radius", and then just multiply those vertex coordinates by R(i) to get the new X,Z coordinates. If you think about it that way, then you can vectorize the entire calculation. You'll probably want to draw both the circles and the connecting edges -- easy enough to do once you have calculated all of the coordinates into a simple array.
|
Next
|
Last
Pages: 1 2 Prev: how to clean data set under couple of conditions Next: syntax problem with LOAD and strings |