本文整理汇总了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}];
});
}
}