【问题标题】:Getting normal point on a Cone在圆锥上获得法线点
【发布时间】:2015-03-20 19:04:27
【问题描述】:

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

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,并使用他们的叉积得到正常。但是,鉴于我定义圆锥的方式,以及参数 eqn 的两条切线,我不知道如何获得参数 eqn。

如果有另一种方法可以找到很好的法线。

【问题讨论】:

    标签: graphics


    【解决方案1】:

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

    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}

    【讨论】:

      猜你喜欢
      • 2012-08-21
      • 1970-01-01
      • 1970-01-01
      • 2011-02-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多