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 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x | /**
*
* @fileOverview
* Checks for valid inputs
*/
/**
* Checks input (point sets). Checks:
* - Both point sets have equal number of points
* - Points sets are compatible for matrix multiplication
* @param setA
* @param setB
* @param pointDimension
* @returns
*/
export function checkValidPointSets(
setA: number[][],
setB: number[][],
pointDimension = 3
) {
const colSizeA = setA[0].length;
const colSizeB = setB[0].length;
const rowSizeA = setA.length;
const rowSizeB = setB.length;
if (colSizeA != pointDimension || colSizeB != pointDimension) {
throw `point dimension size must be ${pointDimension}`;
}
if (rowSizeA != rowSizeB) {
throw `both point sets must have same number of points`;
}
return (
colSizeA == pointDimension && colSizeA == colSizeB && rowSizeA == rowSizeB
);
}
|