3

In planar geometry plot question, I asked how to draw planar geometric constructs. Now I want to extend it to 3D. Not only those geometry packages are not doing well, I am also facing quite a few obstacles in Mathematica.

  1. Locator is not usable in 3d, as far as i know.

  2. Manipulate does not seem to work in 3d too.

Let me give a concrete example. I have a right circular cone with a height h and an aperture 2 theta. Its circular base is on the horizontal plane. Given a cone element, draw a circle with a diameter d in the tangent plane to this cone passing the cone element. Then draw the horizontal diameter of this circle. Thank you for your help.

Community
  • 1
  • 1
Qiang Li
  • 10,593
  • 21
  • 77
  • 148
  • 1
    Item 1 is correct: Mathematica has no support for a 3d Locator. Manipulate handles three dimensional plots just fine (subject to the speed of plotting, etc.), so I do not know what you might be claiming in item 2. – Daniel Lichtblau Mar 15 '11 at 22:19
  • 1
    Just a question, how would you want a 3d locator to work on a 2d screen? You can use other controls to move something in 3d, but not a locator. I suggest you browse the Demonstrations Project (eg [this one](http://demonstrations.wolfram.com/PlaneSectionsOfSurfaces/) and [this one](http://demonstrations.wolfram.com/DandelinSpheresForAnEllipse/)) to see what's out there. – Simon Mar 15 '11 at 22:54
  • Ohhh Loooord / won't you buy me / a 3D screeen .... – Dr. belisarius Mar 15 '11 at 23:35
  • btw I'm sure you could hook something like [this](http://www.blendernation.com/2010/11/15/using-an-ipad-as-a-3d-input-controller/) up to Mma using `Controller*` – Simon Mar 16 '11 at 00:33
  • @Simon I forgot to post the link http://www.youtube.com/watch?v=C-GFqhCq2HA – Dr. belisarius Mar 16 '11 at 00:41
  • @Simon But thinking again, for this question this one is more appropriate. http://www.youtube.com/watch?v=R5e1vfaST2I – Dr. belisarius Mar 16 '11 at 00:44
  • 2
    @Simon Mathematica has built-in support for [SpaceNavigator](http://www.3dconnexion.com/products/spacenavigator.html), a 3D input device. (I haven't ever used one, but there's a reference in the docs [here](http://reference.wolfram.com/mathematica/tutorial/IntroductionToManipulate.html)) – Brett Champion Mar 16 '11 at 04:09
  • @Brett Now I'm thinking really hard what project could I devise to bring them to buy one of those for me :D – Dr. belisarius Mar 16 '11 at 12:00
  • @belisarius: are you still able to read messages directed with @? Since the website has changed its appearance a little bit, I am not able to find my new messages/answers to my questions. – Qiang Li Mar 18 '11 at 01:00
  • @quiang yep. they appear as red circled numbers top left of this page, near the "Stack Exchange" label – Dr. belisarius Mar 18 '11 at 01:08
  • @belisarius: great that I can recover it. But how could anyone **on earch** be able to find it there??? – Qiang Li Mar 18 '11 at 01:12
  • @Qiang The powers that be are enhancing Stack Overflow. Stay tuned and keep your helmet on – Dr. belisarius Mar 18 '11 at 01:15
  • @belisarius: but where is the destination... – Qiang Li Mar 18 '11 at 01:17

1 Answers1

5

This is really not that hard. First we define a 3D circle, given by a position of its center, and two vectors which span the plane it is in:

Circle3D[{x_, y_, z_}, {v1 : {_, _, _}, v2 : {_, _, _}}, r_] :=
 Line[Table[{x, y, z} + {r Cos[2 Pi t], r Sin[2 Pi t]}.{v1, v2}, {t, 
    0, 1, 1/120}]]

Then given a point {x,y,z} on a cone with tip at {0,0,h} tangents are {x,y,z-h} and {-y,x,0}. The rest is just drawing:

ConeQuestion[h_, theta_, pt : {x_, y_, z_}, 
   d_] /; (x^2 + y^2) Cos[theta]^2 == Sin[theta]^2 (z - h)^2 := 
 Module[{tangents},
  tangents = {Normalize[{0, 0, h} - pt], Normalize[{-y, x, 0}]};
  {{Opacity[0.8, Yellow], Cone[{{0, 0, 0}, {0, 0, h}}, h*Tan[theta]]},
   {Thick, Dashed, Circle3D[pt, tangents, d]},
   {Red, Sphere[pt, 1/10]},
   {Orange, 
    Line[{pt - d Normalize[{-y, x, 0}], 
      pt + d Normalize[{-y, x, 0}]}]}}
  ]

enter image description here

Sasha
  • 5,935
  • 1
  • 25
  • 33
  • About time someone answered this. +1 ! – Mr.Wizard Apr 15 '11 at 19:48
  • can you help to make the circle shaded? – Qiang Li Apr 17 '11 at 05:17
  • @Qiang Replace `Circle3D` with the following `Circle3D[{x_, y_, z_}, {v1 : {_, _, _}, v2 : {_, _, _}}, r_] := {EdgeForm[Black], FaceForm[Opacity[0.5, Gray]], Polygon[ Table[{x, y, z} + {r Cos[2 Pi t], r Sin[2 Pi t]}.{v1, v2}, {t, 0, 1, 1/120}]]}`. – Sasha Apr 17 '11 at 05:28