partial81
partial81

Reputation: 495

Graphics3D refinement for intersection of cone and line

Encouraged by this question, I dare to ask something similar.

I am trying to plot with mathematica a cone which is intersected by a line. The start point of the line is on the lateral surface of the cone and its endpoint inside of the cone. As long as the endpoint of the line is far away from the tip of the cone, everything looks quite nice (use e.g. endpointOfLine = 0.007 in my example). But if the endpoint approaches the tip (endpointOfLine < 0.007 in my example), it seems that a big part of the line would be on the surface of the cone. Sure, for endpoint values which are very close to the cone tip, the line is almost parallel to the surface so that this effect has probably to appear. But the effect appears also if the endpoint is not so close to cone tip.

Here the example:

totalLength = 10^-2;(*length of the cone*)
theta = 17*10^-3;(*half opening angle of the cone*)
radius[theta_, l_] := Tan[theta]*l;(*radius of the cone as function of its length*)
endpointOfLine = 0.0015;(*endpoint of the test line, to be varied*)

testLine = Line[{{radius[theta, totalLength], 0, totalLength},{0, 0, endpointOfLine}}, 
                VertexColors -> {Orange, Orange}
           ];
Graphics3D[
  {
     {
       RevolutionPlot3D[{radius[theta, l], 0, l}, {l, 0, totalLength}, 
             Mesh -> None, 
             PlotStyle -> Directive[Opacity[0.5], Gray], 
             PlotPoints -> 60][[1]]
     }, 
     {testLine}
  }, 
  Boxed -> True,BoxRatios -> {1, 1, 3}, 
  Lighting -> None(*ugly, but makes the problem well visible*)
]

ConeAndLine

Is there any way to reduce this effect? Increasing the PlotPoints to 60 has reduced the effect a bit, but I would be happy if I could reduce it more. Any ideas?

Upvotes: 2

Views: 425

Answers (1)

Sjoerd C. de Vries
Sjoerd C. de Vries

Reputation: 16232

Try to place the endpoint at the base of the cone close but not on the radius like:

testLine = 
  Line[{{0.97 radius[theta, totalLength], 0, totalLength}, {0, 0, endpointOfLine}}, 
      VertexColors -> {Orange, Orange}
  ];

enter image description here

I feel this is not a problem fundamentally different from the one you were referring to.

Upvotes: 1

Related Questions