3D geometry graph in Mathematica

To the question of planar geometry of the question , I asked how to draw flat geometric designs. Now I want to expand it to 3D. Not only in those geometry packages is not very good, I also encounter quite a few obstacles in Mathematica.

  • Locator not applicable in 3d, as far as I know.

  • Manipulatedoesn't seem to work in 3d either.

Let me give you a concrete example. I have a right circular cone with height hand aperture 2 theta. Its round base is on a horizontal plane. For a conical element, draw a circle with a diameter din the tangent plane to this cone passing through the conical element. Then draw the horizontal diameter of this circle. Thank you for your help.

+3
source share
1 answer

It really is not that difficult. First, we define a three-dimensional circle defined by the position of its center, and two vectors that span the plane in which it is located:

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 the point {x,y,z}on the cone with the tip in {0,0,h}, the 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

+5
source

All Articles