How to use the @antv/matrix-util.vec2.length function in @antv/matrix-util

To help you get started, we’ve selected a few @antv/matrix-util examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github antvis / G2 / packages / component / src / axis / helix.ts View on Github external
getSideVector(offset, point) {
    const center = this.get('center');
    const vector = [ point.x - center.x, point.y - center.y ];
    if (!Util.isNil(offset)) {
      const vecLen = vec2.length(vector);
      vec2.scale(vector, vector, offset / vecLen);
    }
    return vector;
  }
github antvis / G2 / packages / component / src / axis / circle.ts View on Github external
getSideVector(offset, point) {
    const center = this.get('center');
    const vector = [ point.x - center.x, point.y - center.y ];
    if (!Util.isNil(offset)) {
      const vecLen = vec2.length(vector);
      vec2.scale(vector, vector, offset / vecLen);
    }
    return vector;
  }