rapid-sdk
    Preparing search index...

    Function vecCross

    • Returns the 2D cross product of OA and OB vectors

      Parameters

      • a: Vec2

        A

      • b: Vec2

        B

      • Optionalorigin: Vec2

        If not passed, defaults to [0,0]

      Returns number

      magnitude of Z vector - A positive value, if OAB makes a counter-clockwise turn, negative for clockwise turn, and zero if the points are collinear.

      The scalar overload can avoid temporary tuple allocations in hot code paths.

      vecCross([2, 0], [0, 2]);   // returns 4
      
    • Returns the 2D cross product of OA and OB vectors

      Parameters

      • ax: number
      • ay: number
      • bx: number
      • by: number

      Returns number

      magnitude of Z vector - A positive value, if OAB makes a counter-clockwise turn, negative for clockwise turn, and zero if the points are collinear.

      The scalar overload can avoid temporary tuple allocations in hot code paths.

      vecCross([2, 0], [0, 2]);   // returns 4