All files _caseUtils.js

100% Statements 30/30
20% Branches 2/10
100% Functions 4/4
100% Lines 25/25

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 682x               3x 3x 111x 111x 111x   3x                 1x 1x 37x 37x 37x   1x                   1x 1x 37x 37x 37x   1x                     2x 2x 32x 32x 32x   2x          
const _CaseUtils = {
  /**
   * 创建 xz 平面的圆形路径
   * @param {number} [radius=1000]
   * @param {number} [y=0]
   * @returns
   */
  circlePathXZ(radius = 1000, y = 0){
    const pathArr = [];
    for (let degree = 0; degree <= 360; degree += 10) {
      const x = Math.cos((degree * 2 * Math.PI) / 360) * radius;
      const z = Math.sin((degree * 2 * Math.PI) / 360) * radius;
      pathArr.push([x, y, z]);
    }
    return pathArr;
  },
  /**
   * 创建 xy 平面的圆形路径
   * @param {number} [radius=1000]
   * @param {number} [z=0]
   * @returns
   */
  circlePathXY(radius = 1000, z = 0){
    const pathArr = [];
    for (let degree = 0; degree <= 360; degree += 10) {
      const x = Math.cos((degree * 2 * Math.PI) / 360) * radius;
      const y = Math.sin((degree * 2 * Math.PI) / 360) * radius;
      pathArr.push([x, y, z]);
    }
    return pathArr;
  },
 
  /**
   * 创建 yz 平面的圆形路径
   * @param {number} [radius=1000]
   * @param {number} [x=0]
   * @returns
   */
  circlePathYZ(radius = 1000, x = 0){
    const pathArr = [];
    for (let degree = 0; degree <= 360; degree += 10) {
      const y = Math.cos((degree * 2 * Math.PI) / 360) * radius;
      const z = Math.sin((degree * 2 * Math.PI) / 360) * radius;
      pathArr.push([x, y, z]);
    }
    return pathArr;
  },
 
  /**
   * 创建一个不断上升的螺旋路径
   * @param {*} yStart
   * @param {*} radius
   * @param {*} degreeSpan
   * @param {*} yUp
   */
  screwUpPath(yStart = -250, radius = 520, degreeSpan = 10, yUp = 15){
    const points = [];
    for (let degree = 0, y = yStart; degree <= radius; degree += degreeSpan, y += yUp) {
      const x = Math.cos(degree * 2 * Math.PI / 360) * radius;
      const z = Math.sin(degree * 2 * Math.PI / 360) * radius;
      points.push([x, y, z]);
    }
    return points;
  }
};
 
export default _CaseUtils;