本文整理匯總了TypeScript中neuroglancer/util/geom.vec3.subtract方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript vec3.subtract方法的具體用法?TypeScript vec3.subtract怎麽用?TypeScript vec3.subtract使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類neuroglancer/util/geom.vec3
的用法示例。
在下文中一共展示了vec3.subtract方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: getSources
getSources(vectorGraphicsSourceOptions: VectorGraphicsSourceOptions) {
const voxelSize = this.stackInfo.voxelResolution;
const chunkSize = vec3.subtract(
vec3.create(), this.stackInfo.upperVoxelBound, this.stackInfo.lowerVoxelBound);
vec3.multiply(chunkSize, chunkSize, voxelSize);
chunkSize[2] = voxelSize[2];
const spec = VectorGraphicsChunkSpecification.make({
voxelSize,
chunkSize,
lowerChunkBound: vec3.fromValues(0, 0, this.stackInfo.lowerVoxelBound[2]),
upperChunkBound: vec3.fromValues(1, 1, this.stackInfo.upperVoxelBound[2]),
vectorGraphicsSourceOptions
});
const source = this.chunkManager.getChunkSource(PointMatchSource, {
spec,
parameters: {
'baseUrls': this.baseUrls,
'owner': this.ownerInfo.owner,
'project': this.stackInfo.project,
'stack': this.stack,
'encoding': 'points',
'matchCollection': this.matchCollection,
'zoffset': this.zoffset
}
});
return [[source]];
}
示例2: formatBoundingBoxVolume
export function formatBoundingBoxVolume(pointA: vec3, pointB: vec3, transform: mat4) {
let dimensionText = '';
const vector = vec3.create();
for (let axis = 0; axis < 3; ++axis) {
vec3.set(vector, 0, 0, 0);
vector[axis] = pointB[axis] - pointA[axis];
const spatialVector = transformVectorByMat4(vector, vector, transform);
const length = vec3.length(spatialVector);
if (axis !== 0) {
dimensionText += ' Ă ';
}
dimensionText += formatLength(length);
}
const preTransformVolume = Math.abs(prod3(vec3.subtract(vector, pointB, pointA)));
const det = mat3.determinant(mat3.fromMat4(mat3.create(), transform));
const postTransformVolume = det * preTransformVolume;
return `${dimensionText} [${formatVolume(postTransformVolume)}]`;
}