public Coordinate GetRotationNormalizedDiff(ScannerMatch scannerMatch, int probe1, int probe2, int rotation) { var myP1 = scannerMatch.probeMatches[probe1].myProbe; var myP2 = scannerMatch.probeMatches[probe2].myProbe; var myRotationNormalizedDiff = myScanner.RelativeCoordinates[myP1][myP2]; var result = rotation switch { 0 => new Coordinate(myRotationNormalizedDiff.X, myRotationNormalizedDiff.Y, myRotationNormalizedDiff.Z), 1 => new Coordinate(myRotationNormalizedDiff.Y, myRotationNormalizedDiff.Z.Value, myRotationNormalizedDiff.X), 2 => new Coordinate(myRotationNormalizedDiff.Z.Value, myRotationNormalizedDiff.X, myRotationNormalizedDiff.Y), 3 => new Coordinate(myRotationNormalizedDiff.X, myRotationNormalizedDiff.Z.Value, myRotationNormalizedDiff.Y), 4 => new Coordinate(myRotationNormalizedDiff.Z.Value, myRotationNormalizedDiff.Y, myRotationNormalizedDiff.X), 5 => new Coordinate(myRotationNormalizedDiff.Y, myRotationNormalizedDiff.X, myRotationNormalizedDiff.Z.Value), _ => null }; if (result.X == 0) { return(null); } if (result.Y == 0) { return(null); } if (result.Z == 0) { return(null); } return(result); } }
public void NormalizeShifts(ScannerMatch scannerMatch) { var pair = scannerMatch.probeMatches.First(); var mine = normalizedCoordinates[pair.myProbe]; var theirs = scannerMatch.otherScanner.Coordinates[pair.theirProbe]; normalizationShifts = new long[3]; normalizationShifts[0] = theirs.X - mine.X; normalizationShifts[1] = theirs.Y - mine.Y; normalizationShifts[2] = theirs.Z.Value - mine.Z.Value; DoShifts(normalizationShifts); }
public (int first, int second, Coordinate myDiff) GetRotationNormalizedDiff(ScannerMatch scannerMatch) { for (int n = 0; n < scannerMatch.probeMatches.Count; n++) { for (int i = 0; i < scannerMatch.probeMatches.Count; i++) { var myRotationNormalizedDiff = GetRotationNormalizedDiff(scannerMatch, n, i, scannerMatch.rotation); if (myRotationNormalizedDiff != null) { return(n, i, myRotationNormalizedDiff); } } } return(-1, -1, null); }
public void NormalizeFlips(ScannerMatch scannerMatch) { (int first, int second, Coordinate myRotationNormalizedDiff) = GetRotationNormalizedDiff(scannerMatch); var theirP1 = scannerMatch.probeMatches[first].theirProbe; var theirP2 = scannerMatch.probeMatches[second].theirProbe; var theirDiff = scannerMatch.otherScanner.RelativeCoordinates[theirP1][theirP2]; normalizationFlips = new bool[3]; if (myRotationNormalizedDiff.X != theirDiff.X) { normalizationFlips[0] = true; } if (myRotationNormalizedDiff.Y != theirDiff.Y) { normalizationFlips[1] = true; } if (myRotationNormalizedDiff.Z != theirDiff.Z) { normalizationFlips[2] = true; } DoFlips(normalizationFlips); }