MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Parametric cylinder plots round in one instance and elliptical in

  • To: mathgroup at smc.vnet.net
  • Subject: [mg101406] Re: [mg101392] Parametric cylinder plots round in one instance and elliptical in
  • From: "David Park" <djmpark at comcast.net>
  • Date: Sun, 5 Jul 2009 04:47:57 -0400 (EDT)
  • References: <1583057.1246705223225.JavaMail.root@n11>

I'm not certain of your objective here, and I don't understand your
parametrization, but I take it that you want a cylinder of radius r with the
the top and bottom center points at the two point specifications.

I'm going to draw your cylinders by defining a unitcylinder and then using
geometric transformations to put it into place. I'm also going to use the
Presentations package. (I apologize for this to those that don't have it, or
are tired of hearing about it, but it is much easier and there are a bunch
of people who follow MathGroup who do have it. This can certainly be done
without the package and some of the people will probably do it, but it think
it will be more convoluted.)

Needs["Presentations`Master`"]

unitcylinder = 
  ParametricDraw3D[{Cos[\[Theta]], Sin[\[Theta]], z}, {\[Theta], 0, 
    2 \[Pi]}, {z, 0, 1}, Mesh -> None];

p1 = {2, 3, 4};
p2 = {6, 7, 8};
radius = 5;
scalez = Norm[p2 - p1];
Draw3DItems[
 {unitcylinder // ScaleOp[{1, 1, 7}, {0, 0, 0}],
  unitcylinder
     // ScaleOp[{radius, radius, scalez}, {0, 0, 0}]
    // RotateOp[{{0, 0, 1}, p2 - p1}]
   // TranslateOp[p1]},
 NiceRotation,
 Axes -> True,
 ImageSize -> 300]


David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark/  



From: Bill [mailto:WDWNORWALK at aol.com] 

Ref: Parametric cylinder plots round in one instance and elliptical in
another


Hi:

I have the following Mathematica 6.0.1 code:


ParaCyl[ {x1_, y1_, z1_}, {x2_, y2_, z2_}, r_] := ParametricPlot3D[{
   
r*Cos[s] + x1 + t*(x2 - x1),
r*Sin[s] + y1 + t*(y2 - y1),
z1 + t*(z2 - z1)},
   
{s, 0, 2*Pi}, {t, 0, 1}, Mesh -> False, Axes -> True, 
AxesLabel -> {"x", "y", "z"}, 
PlotRange -> {{-10, 10}, {-10, 10}, {-10, 10}}, 
ViewPoint -> {9, 10, 8}]
  
(*I used the following which looks good wrt roundess:*)

ParaCyl[ {0, 0, 0}, {0, 0, 7}, 5]
(*Plot looks good.*)

Show[%, ViewPoint -> Top]
(*Plot looks round, as expected. *)

(*I change the next plot to:*)
ParaCyl[ {2, 3, 4}, {6, 7, 8}, 5]
(*Plot: Cylinder looks elliptical. Expected a round cylinder.*)

Show[%, ViewVector -> {{12, 13, 14}, {7, 8, 9}}]
(*This is a look down the throat of the elliptical looking cylinder.*)


Question: How can I code this to show a round cylinder, regardless of
cylinder orientation?



Thanks in advance,

Bill




  • Prev by Date: Re: Re: Union slowdown when SameTest is
  • Next by Date: Re: Re: Union slowdown when SameTest is
  • Previous by thread: Parametric cylinder plots round in one instance and elliptical in
  • Next by thread: Help with FindRoot