Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Plot lines in 3d as cylinders

  1. May 29, 2009 #1

    How can i do that? Can anyone of you help me?


    Last edited: May 29, 2009
  2. jcsd
  3. May 29, 2009 #2


    User Avatar
    Science Advisor
    Homework Helper

    You're posting in the Software section, so I assume you want to do it using a computer program, but you didn't tell us which one.

    Also, how do you mean: plotting lines as cylinders? You mean you want to draw a cylinder of radius r along a line?
  4. May 29, 2009 #3
    Sry. The data-file contains start and end-point of the cylinders (lines). I want to create a huge number of cylinders with external data.
    How can I do that?
    I dont know how to format the external data and how I have to do the command in mathematica.
  5. May 29, 2009 #4
    I tired to do with
    list = Partition[Import["Sites/IWS/testFile.txt", "Table"], 2]
    • ]

      but in that way I am not able to change the cylinder-radius. How can I add this parameter in my list?
  6. May 30, 2009 #5


    User Avatar
    Science Advisor
    Homework Helper

    From the help,
    Code (Text):
    Cylinder[{{Subscript[x, 1],Subscript[y, 1],Subscript[z, \
    1]},{Subscript[x, 2],Subscript[y, 2],Subscript[z, 2]}},r]
    represents a cylinder of radius r around the line from (Subscript[x, \
    1],Subscript[y, 1],Subscript[z, 1]) to (Subscript[x, 2],Subscript[y, \
    2],Subscript[z, 2]).
    So you could simply use that command.

    How you would convert to that from your raw data depends on the version of Mathematica (I suspect you are using 6.0+) and the precise format of the text file.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook