rapid-sdk
    Preparing search index...

    Function vecLengthSquare

    • Returns the length of a vector squared This is the same as vecLength but without the Math.sqrt step, thus avoiding an unnecessary calculation.

      Parameters

      • a: Vec2
      • Optionalb: Vec2

        If not passed, defaults to [0,0].

      Returns number

      vector length squared

      The scalar overload can avoid temporary tuple allocations in tight loops.

      vecLengthSquare([0, 0], [4, 3]);   // returns 25
      vecLengthSquare([4, 3]); // returns 25
    • Returns the length of a vector squared This is the same as vecLength but without the Math.sqrt step, thus avoiding an unnecessary calculation.

      Parameters

      • ax: number
      • ay: number
      • Optionalbx: number
      • Optionalby: number

      Returns number

      vector length squared

      The scalar overload can avoid temporary tuple allocations in tight loops.

      vecLengthSquare([0, 0], [4, 3]);   // returns 25
      vecLengthSquare([4, 3]); // returns 25