當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript vec3.equals方法代碼示例

本文整理匯總了TypeScript中neuroglancer/util/geom.vec3.equals方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript vec3.equals方法的具體用法?TypeScript vec3.equals怎麽用?TypeScript vec3.equals使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在neuroglancer/util/geom.vec3的用法示例。


在下文中一共展示了vec3.equals方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: constructor

  constructor(public baseUrls: string[], public key: string, public response: any) {
    verifyObject(response);
    this.dataType = verifyObjectProperty(response, 'dataType', x => verifyEnumString(x, DataType));
    this.volumeType =
        verifyObjectProperty(response, 'volumeType', x => verifyEnumString(x, VolumeType));
    this.numChannels = verifyObjectProperty(response, 'numChannels', verifyPositiveInt);
    this.encoding =
        verifyObjectProperty(response, 'encoding', x => verifyEnumString(x, VolumeChunkEncoding));
    let maxVoxelsPerChunkLog2 = verifyObjectProperty(
        response, 'maxVoxelsPerChunkLog2',
        x => x === undefined ? DEFAULT_MAX_VOXELS_PER_CHUNK_LOG2 : verifyPositiveInt(x));

    /**
     * Scales used for arbitrary orientation (should be near isotropic).
     *
     * Exactly one of threeDimensionalScales and twoDimensionalScales should be specified.
     */
    let threeDimensionalScales = verifyObjectProperty(
        response, 'threeDimensionalScales',
        x => x === undefined ? undefined : parseArray(x, parseScaleInfo));

    /**
     * Separate scales used for XY, XZ, YZ slice views, respectively.  The chunks should be flat or
     * nearly flat in Z, Y, X respectively.  The inner arrays must have length 3.
     */
    let twoDimensionalScales = verifyObjectProperty(
        response, 'twoDimensionalScales', x => x === undefined ?
            undefined :
            parseArray(x, y => parseFixedLengthArray(new Array<ScaleInfo>(3), y, parseScaleInfo)));
    if ((twoDimensionalScales === undefined) === (threeDimensionalScales === undefined)) {
      throw new Error(
          `Exactly one of "threeDimensionalScales" and "twoDimensionalScales" must be specified.`);
    }
    if (twoDimensionalScales !== undefined) {
      if (twoDimensionalScales.length === 0) {
        throw new Error(`At least one scale must be specified.`);
      }
      this.scales = twoDimensionalScales.map(levelScales => levelScales.map((scale, index) => {
        const {voxelSize, sizeInVoxels} = scale;
        const flatDimension = 2 - index;
        let {
            chunkDataSize = getTwoDimensionalBlockSize(
                {voxelSize, upperVoxelBound: sizeInVoxels, flatDimension, maxVoxelsPerChunkLog2})} =
            scale;
        return {
          key: scale.key,
          offset: scale.offset, sizeInVoxels, voxelSize, chunkDataSize,
        };
      }));
      if (!vec3.equals(this.scales[0][0].voxelSize, this.scales[0][1].voxelSize) ||
          !vec3.equals(this.scales[0][0].voxelSize, this.scales[0][2].voxelSize)) {
        throw new Error(`Lowest scale must have uniform voxel size.`);
      }
    }
    if (threeDimensionalScales !== undefined) {
      if (threeDimensionalScales.length === 0) {
        throw new Error(`At least one scale must be specified.`);
      }
      this.scales = threeDimensionalScales.map(scale => {
        let {voxelSize, sizeInVoxels} = scale;
        let {chunkDataSize = getNearIsotropicBlockSize(
                 {voxelSize, upperVoxelBound: sizeInVoxels, maxVoxelsPerChunkLog2})} = scale;
        return [{key: scale.key, offset: scale.offset, sizeInVoxels, voxelSize, chunkDataSize}];
      });
    }
  }
開發者ID:funkey,項目名稱:neuroglancer,代碼行數:66,代碼來源:frontend.ts


注:本文中的neuroglancer/util/geom.vec3.equals方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。