【问题标题】:Upwards tangent vector of triangle in 3D spaceUpwards tangent vector of triangle in 3D space
【发布时间】:2022-12-02 00:09:38
【问题描述】:

I have a triangle in 3D cartesian space, it forms a surface. I have a normal vector of that surface. What I want to find out, is a vector tangent to that surface, which points the most "upwards". (The orange one on image, forgive my paint skills)

【问题讨论】:

    标签: vector 3d geometry normals


    【解决方案1】:

    Let one triangle edge vector isA. Get perpendicular vector in the plane

    P = N x A
    

    and normalizePandA

    p = P / len(P)    
    a = A / len(A)
    

    Any unit vector in the plane is combination of these base vectors

    v = p * cos(t) + a * sin(t)      (1)
    

    We want that Z-component ofvto be maximal (as far as I understand most "upwards")

    vz = pz * cos(t) + az * sin(t)    (2)
    

    has extremum when it's derivative by t is zero

    0 = (pz * cos(t) + az * sin(t))' = -pz * sin(t) + az * cos(t)
    tan(t) = az / pz
    t = atan2(az , pz)
    

    put t values into (1) and get needed vectorv

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-12-02
      • 2020-10-29
      • 2022-12-27
      • 1970-01-01
      相关资源
      最近更新 更多