private void EliminateBeComponent(HexGridCoordinate position) { int beMagnitude = _hexVectorUtility.GetMagnitudeAlongCardinalDirection(position, HexAxis.B); if (beMagnitude == 0) { return; } position.CfCoordinate = position.CfCoordinate + beMagnitude; position.DaCoordinate = position.DaCoordinate - beMagnitude; _hexVectorUtility.EliminateComponentsAlongCardinalDirection(position, HexAxis.B); }
public void TestVectorDirectionValuesCalculation() { var vectorA = new RawHexVector(); vectorA.AddComponent(HexAxis.B, 5); vectorA.AddComponent(HexAxis.B, 3); vectorA.AddComponent(HexAxis.E, 2); int bMagnitude = _utilityLibrary.GetMagnitudeAlongDirection(vectorA, HexAxis.B); bMagnitude.Should().Be(8); int beMagnitude = _utilityLibrary.GetMagnitudeAlongCardinalDirection(vectorA, HexAxis.B); beMagnitude.Should().Be(6); }