MathGroup Archive 2007

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

Search the Archive

Re: Can i render a Disk[] in Graphics3D?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg81397] Re: Can i render a Disk[] in Graphics3D?
  • From: "David Park" <djmpark at comcast.net>
  • Date: Sat, 22 Sep 2007 03:21:37 -0400 (EDT)
  • References: <fcvqqc$7ll$1@smc.vnet.net>

To draw a disk in 3D we have to specify its orientation as well as its 
position.

Here is the way I would do it in DrawGraphics:

Needs["DrawGraphics6`DrawingMaster`"]

Disk3D::usage =
  "Disk3D[position, normal, radius, plotoptions will draw a disk with \
the specified position and radius. The orientation of the disk is \
given by the normal vector.]";
Options[Disk3D] =
  Complement[Options[ParametricPlot3D], Options[Graphics3D]];
SyntaxInformation[
   Disk3D] = {"ArgumentsPattern" -> {{_, _, _}, {_, _, _}, _,
     OptionsPattern[]}};
Disk3D[position_, normal_, radius_, plotopts : OptionsPattern[]] :=
 Module[{s},
  ParametricDraw3D[{s Cos[\[Theta]], s Sin[\[Theta]], 0}, {s, 0,
       radius}, {\[Theta], 0, 2 \[Pi]}, plotopts,
      PlotPoints -> {12, 32}] //
     RotationTransformOp[{{0, 0, 1}, normal}] //
    TranslationTransformOp[position] // Quiet
  ]


The following draws one disk in the starting position and another disk in a 
general position. Normal vectors were added to the disks.

Draw3DItems[
 {Opacity[0.8],
  Lighter@Brown,
  Disk3D[{0, 0, 0}, {0, 0, 1}, 2, Mesh -> {5, 10}],
  Pink,
  Disk3D[{2, 2, 2}, {2, 0, 2}, 1, Mesh -> None],
  Green,
  Arrow3D[{0, 0, 0}, {0, 0, 1}, {0.3}],
  Arrow3D[{2, 2, 2}, {2, 2, 2} + Normalize[{2, 0, 2}], {0.3}]},
 NeutralLighting[0, 0.5, 0.1],
 PlotRange -> All,
 Axes -> True,
 ImageSize -> 400]


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


"robert prince-wright" <robertprincewright at yahoo.com> wrote in message 
news:fcvqqc$7ll$1 at smc.vnet.net...
>
> Is there a way of rendering a Disk[] primitive in Mathematica 6.0.1 using
> Graphics3D? It seems like the new version restricts Disk[], Circle[], etc 
> to
> 2-D graphics. I'm also surprised at how limited the primitives are
> or rendering 3D images - is this a limitation of Java or Mathematica?
> Robert
> 



  • Prev by Date: Wish to add "chapter.section.Code a" to Textbook style
  • Next by Date: Re: FullSimplify regress?
  • Previous by thread: Re: Can i render a Disk[] in Graphics3D?
  • Next by thread: Re: Can mathematica do a log-log contour plot?