createFlattenAlongVectorToPlane MethodStatic

Create a matrix which sweeps a vector along sweepVector until it hits the plane through the origin with the given normal.

  • To sweep an arbitrary vector U0 along direction W to the vector U1 in the plane through the origin with normal N:
    • U1 = U0 + W * alpha
    • U1 DOT N = (U0 + W * alpha) DOT N = 0
    • U0 DOT N = - alpha * W DOT N
    • alpha = - U0 DOT N / W DOT N
  • Insert the alpha definition in U1:
    • U1 = U0 - W * N DOT U0 / W DOT N
  • Write vector dot expression N DOT U0 as a matrix product (^T indicates transpose):
    • U1 = U0 - W * N^T * U0 / W DOT N
  • Note W * N^T is an outer product, i.e. a 3x3 matrix. By associativity of matrix multiplication:
    • U1 = (I - W * N^T / W DOT N) * U0
  • and the matrix to do the sweep for any vector in place of U0 is I - W * N^T / W DOT N.

createFlattenAlongVectorToPlane(sweepVector: Vector3d, planeNormal: Vector3d): undefined | Matrix3d

Parameter Type Description
sweepVector Vector3d sweep direction
planeNormal Vector3d normal to the target plane

Returns - undefined | Matrix3d

Defined in

Last Updated: 13 May, 2024