Tube Plot
- To: mathgroup at smc.vnet.net
- Subject: [mg17684] Tube Plot
- From: Joseph & Donna Post <jpost at panix.com>
- Date: Fri, 21 May 1999 23:59:01 -0400
- Sender: owner-wri-mathgroup at wolfram.com
I've been looking for a routine that does "tube plots" in Mathematica, i.e., 3D plots showing cylindrical tubes, possibly of variable radius, constructed around parametrically described space curves. One routine that I looked at in Mathsource, as well as others that I've seen, are based on the construction of a three-D coordinate system at every point in the curve, with the three unit vectors being the normalized versions of: (a) tangent vector to the curve, (b) a second vector based on the derivative of the tangent vector (which is perpendicular to the tangent vector and follows the "twist" of the curve), and (c) a third vector equal to the cross product of the first two. Once this coordinate system is defined for each point on the curve, points on the tube surface are defined as (Sin[theta] * tube radius * second coordinate vector) + (Cos[theta] * tube radius * third coordinate vector). The tube surface is draw by ParametricPlot3D, with the two parameters being theta (which varies from 0 to 2Pi), and the single parameter defining the curve. Well and good. The problem comes when trying to draw a tube around a straight line. Although plotting a cylinder might seem like too trivial a problem to use a Tube Plot routine for, tube plotting is in fact a very easy way to plot surfaces that can be described by a tube of variable radius tube around a straight line. I solved this problem by writing a separate routine for tubes around straight lines, and then using that routine or the original one depending upon whether the derivative of the tangent vector with respect to the space curve parameter was or was not identically zero. That works fine, mostly. This still leaves a problem, however, where the derivative of the tangent vector with respect to the space curve parameter is zero not identically, but at a point. An example is the space curve {t, Sin[t], 0}, a simple sine wave. The tube plotting routine squeezes the tube to a point at the inflection points of the curve (i.e., where it crosses the x axis), because the derivative of the tangent vector (and therefore the second coordinate vector) become zero vectors at that point. There are also a number of error messages generated that result from divide-by-zero's during the normalization process. Any suggestions for how to deal with this problem? Thanks. -- Joseph Post
- Follow-Ups:
- Re: Tube Plot
- From: Daniel Lichtblau <danl>
- Re: Tube Plot