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 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | // return conversion matrix given crystal unit cell parameters import { Matrix3 } from "../math"; import { square } from "./square"; /** * * @param {number} a * @param {number} b * @param {number} c * @param {number} alpha * @param {number} beta * @param {number} gamma * @returns {Matrix3} */ export function conversionMatrix3( a: any, b: number, c: number, alpha: number, beta: number, gamma: number ) { // convert to radians alpha = (alpha * Math.PI) / 180; beta = (beta * Math.PI) / 180; gamma = (gamma * Math.PI) / 180; const sqr = square; const cosAlpha = Math.cos(alpha); const cosBeta = Math.cos(beta); const cosGamma = Math.cos(gamma); const sinGamma = Math.sin(gamma); const conversionMatrix = new Matrix3( a, b * cosGamma, c * cosBeta, 0, b * sinGamma, (c * (cosAlpha - cosBeta * cosGamma)) / sinGamma, 0, 0, (c * Math.sqrt( 1 - sqr(cosAlpha) - sqr(cosBeta) - sqr(cosGamma) + 2 * cosAlpha * cosBeta * cosGamma )) / sinGamma ); return conversionMatrix; } |