How to use the @antv/matrix-util.vec2.angle 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 / g2 / src / plot / controller / axis.ts View on Github external
private _getCircleCfg(coord): CircleCFG {
    const { x: rangeX, y: rangeY, isTransposed, circleCenter: center, innerRadius } = coord;
    const isReflectY = rangeY.start > rangeY.end;
    let start;
    if (isTransposed) {
      start = { x: isReflectY ? 0 : 1, y: 0 };
    } else {
      start = { x: 0, y: isReflectY ? 0 : 1 };
    }

    start = coord.convert(start);
    const startVector = [ start.x - center.x, start.y - center.y ];
    const normalVector = [ 1, 0 ];
    let startAngle;
    if (start.y > center.y) {
      startAngle = vec2.angle(startVector, normalVector);
    } else {
      startAngle = vec2.angle(startVector, normalVector) * -1;
    }
    const endAngle = startAngle + (rangeX.end - rangeX.start);

    return {
      startAngle,
      endAngle,
      center,
      radius: Math.sqrt(Math.pow(start.x - center.x, 2) + Math.pow(start.y - center.y, 2)),
      inner: innerRadius || 0,
    };
  }
github antvis / G2 / packages / g2 / src / plot / controller / axis.ts View on Github external
const isReflectY = rangeY.start > rangeY.end;
    let start;
    if (isTransposed) {
      start = { x: isReflectY ? 0 : 1, y: 0 };
    } else {
      start = { x: 0, y: isReflectY ? 0 : 1 };
    }

    start = coord.convert(start);
    const startVector = [ start.x - center.x, start.y - center.y ];
    const normalVector = [ 1, 0 ];
    let startAngle;
    if (start.y > center.y) {
      startAngle = vec2.angle(startVector, normalVector);
    } else {
      startAngle = vec2.angle(startVector, normalVector) * -1;
    }
    const endAngle = startAngle + (rangeX.end - rangeX.start);

    return {
      startAngle,
      endAngle,
      center,
      radius: Math.sqrt(Math.pow(start.x - center.x, 2) + Math.pow(start.y - center.y, 2)),
      inner: innerRadius || 0,
    };
  }