簡體   English   中英

圓錐和線相交的Graphics3D改進

[英]Graphics3D refinement for intersection of cone and line

這個問題的鼓勵,我敢問類似的問題。

我正在嘗試用mathematica繪制一條由一條線相交的圓錐。 線的起點在圓錐的側面及其端點在圓錐內部。 只要直線的端點遠離圓錐體的尖端,一切看起來就很好(例如在我的示例中使用endpointOfLine = 0.007)。 但是,如果端點接近尖端(在我的示例中,endpointOfLine <0.007),則似乎線的很大一部分將位於圓錐體的表面上。 當然,對於非常靠近圓錐體尖端的端點值,該線幾乎與曲面平行,因此可能必須出現這種效果。 但是,如果端點距離錐尖不太近,也會出現這種效果。

這里的例子:

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

有什么辦法可以減少這種影響? 將PlotPoints增加到60會稍微降低效果,但是如果我可以進一步降低效果,我會很高興。 有任何想法嗎?

嘗試將端點靠近圓錐體的底部放置,但不要放置在半徑上,例如:

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

在此處輸入圖片說明

我覺得這與您所指的問題根本沒有不同。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM