在圆锥体上获取法线点

Getting normal point on a Cone

我正在尝试让锥体基元在我的光线追踪器中工作。我得到了圆锥体和射线的交叉点。但是,我不知道如何从定义圆锥体的方式中获取圆锥体的法线。 我用以下内容定义我的圆锥体:

pos -- The vertex  of the cone
size -- Height of the cone
direction -- A unit vector that defines the direction of the cone
angle --  The angle of the cone

(有关更多信息,我遵循了 Intersection of line and Cone 的定义方式作为参考)。

据我所知,我可以使用 two tangents of a point with the parametric eqn,并使用他们的叉积得到正常值。但是,我不知道如何按照我定义圆锥体的方式获得参数方程,以及参数方程的两条切线。

如果有另一种方法可以找到法线,那就太好了。

我最终将 grad 函数应用于圆锥方程 (x*a+y*b+z*c)^2-(a^2+b^2+c^2)(x^2+y^2+z^2)cos(t)^2 其中

  1. {x,y,z} = 3d 点(所讨论的法线点)
  2. {a,b,c} = 方向矢量
  3. t = 圆锥角

然后使用 wolframalpha,这最终给了我

  • x = (2 a (a x+b y+c z)-2 (a^2+b^2+c^2) x cos^2(t))
  • y = (2 b (a x+b y+c z)-2 (a^2+b^2+c^2) y cos^2(t))
  • z = (2 c (a x+b y+c z)-2 (a^2+b^2+c^2) z cos^2(t))

normal={x,y,z}