Lines3D

There are a few file readers that can accept 3D curves, though the "Lines" reader is the easiest to use if you only need the curve geometry. The file format consists of lines where each line contains 3 comma-separated floating point numbers which correspond to an x,y,z point. You can have multiple lines in the same file by adding line names separating the blocks of coordinates in the file that make up each line. If you add names, the names will also identify the lines in VisIt's Subset window.

To open the file via the command line, you can enter the following command:

visit -assume_format Lines -o example.lines

Note that -assume_format is deprecated -- you can tell VisIt which plugin to use by adding a comma after the file name, i.e.:

visit -o example.lines,Lines

The VTK reader can also accept 3D curves but creating the file is more difficult.

Code

The following Python code can create an example file:

import math

maxY = 5.
rad = 2.5
maxAngle = 3. * 2. * math.pi
nsteps = 100

f = open("example.lines", "wt")
for i in xrange(nsteps):
    t = float(i) / float(nsteps-1)
    angle = -t * maxAngle
    x = rad * math.cos(angle)
    y = t * maxY
    z = rad * math.sin(angle)
    f.write("%g, %g, %g\n" % (x,y,z))
f.close()

File

A rendering of example.lines
  2.5, 0, 0
  2.45482, 0.0505051, 0.473128
  2.32092, 0.10101, 0.929156
  2.10313, 0.151515, 1.3516
  1.80934, 0.20202, 1.7252
  1.45014, 0.252525, 2.03644
  1.03854, 0.30303, 2.27408
  0.589397, 0.353535, 2.42953
  0.118955, 0.40404, 2.49717
  -0.355787, 0.454545, 2.47455
  -0.81767, 0.505051, 2.3625
  -1.25, 0.555556, 2.16506
  -1.63715, 0.606061, 1.88937
  -1.96513, 0.656566, 1.5454
  -2.22209, 0.707071, 1.14557
  -2.39873, 0.757576, 0.704331
  -2.48868, 0.808081, 0.23764
  -2.48868, 0.858586, -0.23764
  -2.39873, 0.909091, -0.704331
  -2.22209, 0.959596, -1.14557
  -1.96513, 1.0101, -1.5454
  -1.63715, 1.06061, -1.88937
  -1.25, 1.11111, -2.16506
  -0.81767, 1.16162, -2.3625
  -0.355787, 1.21212, -2.47455
  0.118955, 1.26263, -2.49717
  0.589397, 1.31313, -2.42953
  1.03854, 1.36364, -2.27408
  1.45014, 1.41414, -2.03644
  1.80934, 1.46465, -1.7252
  2.10313, 1.51515, -1.3516
  2.32092, 1.56566, -0.929156
  2.45482, 1.61616, -0.473128
  2.5, 1.66667, -6.12303e-16
  2.45482, 1.71717, 0.473128
  2.32092, 1.76768, 0.929156
  2.10313, 1.81818, 1.3516
  1.80934, 1.86869, 1.7252
  1.45014, 1.91919, 2.03644
  1.03854, 1.9697, 2.27408
  0.589397, 2.0202, 2.42953
  0.118955, 2.07071, 2.49717
  -0.355787, 2.12121, 2.47455
  -0.81767, 2.17172, 2.3625
  -1.25, 2.22222, 2.16506
  -1.63715, 2.27273, 1.88937
  -1.96513, 2.32323, 1.5454
  -2.22209, 2.37374, 1.14557
  -2.39873, 2.42424, 0.704331
  -2.48868, 2.47475, 0.23764
  -2.48868, 2.52525, -0.23764
  -2.39873, 2.57576, -0.704331
  -2.22209, 2.62626, -1.14557
  -1.96513, 2.67677, -1.5454
  -1.63715, 2.72727, -1.88937
  -1.25, 2.77778, -2.16506
  -0.81767, 2.82828, -2.3625
  -0.355787, 2.87879, -2.47455
  0.118955, 2.92929, -2.49717
  0.589397, 2.9798, -2.42953
  1.03854, 3.0303, -2.27408
  1.45014, 3.08081, -2.03644
  1.80934, 3.13131, -1.7252
  2.10313, 3.18182, -1.3516
  2.32092, 3.23232, -0.929156
  2.45482, 3.28283, -0.473128
  2.5, 3.33333, -1.22461e-15
  2.45482, 3.38384, 0.473128
  2.32092, 3.43434, 0.929156
  2.10313, 3.48485, 1.3516
  1.80934, 3.53535, 1.7252
  1.45014, 3.58586, 2.03644
  1.03854, 3.63636, 2.27408
  0.589397, 3.68687, 2.42953
  0.118955, 3.73737, 2.49717
  -0.355787, 3.78788, 2.47455
  -0.81767, 3.83838, 2.3625
  -1.25, 3.88889, 2.16506
  -1.63715, 3.93939, 1.88937
  -1.96513, 3.9899, 1.5454
  -2.22209, 4.0404, 1.14557
  -2.39873, 4.09091, 0.704331
  -2.48868, 4.14141, 0.23764
  -2.48868, 4.19192, -0.23764
  -2.39873, 4.24242, -0.704331
  -2.22209, 4.29293, -1.14557
  -1.96513, 4.34343, -1.5454
  -1.63715, 4.39394, -1.88937
  -1.25, 4.44444, -2.16506
  -0.81767, 4.49495, -2.3625
  -0.355787, 4.54545, -2.47455
  0.118955, 4.59596, -2.49717
  0.589397, 4.64646, -2.42953
  1.03854, 4.69697, -2.27408
  1.45014, 4.74747, -2.03644
  1.80934, 4.79798, -1.7252
  2.10313, 4.84848, -1.3516
  2.32092, 4.89899, -0.929156
  2.45482, 4.94949, -0.473128
  2.5, 5, -1.83691e-15

Improving the rendering

If you use the Mesh plot to render the lines, you will be limited to a thin line drawing. To improve the rendering:

  • Use the Subset plot since it will show lighting
  • Apply a Tube operator to turn the lines into tubes that will be shaded
Lines rendered as tubes