public void GetHashCodeTest4() { var original = new CardanFrame(new Position3D(10, 20, 30), 10.0.DegToRad(), 20.0.DegToRad(), 30.0.DegToRad()); var cardan = new CardanFrame(new Position3D(30, 20, 10), 30.0.DegToRad(), 10.0.DegToRad(), 20.0.DegToRad()); Assert.NotEqual(original.GetHashCode(), cardan.GetHashCode()); }
public static CardanFrame ToCardanFrame(this CardanFrameDto cardanFrameDto) { var cardanFrame = new CardanFrame( new Position3D(cardanFrameDto.OffsetX, cardanFrameDto.OffsetY, cardanFrameDto.OffsetZ), cardanFrameDto.AlphaAngleAxisX, cardanFrameDto.BetaAngleAxisY, cardanFrameDto.GammaAngleAxisZ); return(cardanFrame); }
public void ConstructorTest1() { var cardan = new CardanFrame(new Position3D(10, 20, 30), 10.0.DegToRad(), 20.0.DegToRad(), 30.0.DegToRad()); Assert.Equal(new Position3D(10, 20, 30), cardan.Offset); Assert.Equal(new Vector3D(10, 20, 30), cardan.Translation); Assert.Equal(10.0.DegToRad(), cardan.AlphaAngleAxisX, 4); Assert.Equal(20.0.DegToRad(), cardan.BetaAngleAxisY, 4); Assert.Equal(30.0.DegToRad(), cardan.GammaAngleAxisZ, 4); }
public static Matrix44D ToMatrix44D(this CardanFrame eulerFrame) { var alphaRotation = Matrix44D.CreateRotation(new Vector3D(1.0, 0.0, 0.0), eulerFrame.AlphaAngleAxisX); var betaRotation = Matrix44D.CreateRotation(new Vector3D(0.0, 1.0, 0.0), eulerFrame.BetaAngleAxisY); var gammaRotation = Matrix44D.CreateRotation(new Vector3D(0.0, 0.0, 1.0), eulerFrame.GammaAngleAxisZ); var translation = Matrix44D.CreateTranslation(eulerFrame.Translation); var matrix = translation * gammaRotation * betaRotation * alphaRotation; return(matrix); }
public void ToCardanTest2() { var cardanFrame = new CardanFrame(new Position3D(), 45.0.DegToRad(), 45.0.DegToRad(), 45.0.DegToRad()); var mat = cardanFrame.ToMatrix44D(); var ex1 = mat * new Vector3D(1, 0, 0); var cardan = mat.ToCardanFrame(); var rot = cardan.ToMatrix44D(); Assert.Equal(mat, rot); }
public void EqualsTest() { var original = new CardanFrame(new Position3D(10, 20, 30), 10.0.DegToRad(), 20.0.DegToRad(), 30.0.DegToRad()); var cardan = new CardanFrame(new Position3D(10, 20, 30), 10.0.DegToRad(), 20.0.DegToRad(), 30.0.DegToRad()); object originalObject = original; object cardanObject = cardan; Assert.True(original == cardan); Assert.True(cardan == original); Assert.True(original.Equals(cardan)); Assert.True(originalObject.Equals(cardanObject)); }
public static CardanFrameDto ToCardanFrameDto(this CardanFrame cardanFrame) { var cardanFrameDto = new CardanFrameDto() { OffsetX = cardanFrame.Offset.X, OffsetY = cardanFrame.Offset.Y, OffsetZ = cardanFrame.Offset.Z, AlphaAngleAxisX = cardanFrame.AlphaAngleAxisX, BetaAngleAxisY = cardanFrame.BetaAngleAxisY, GammaAngleAxisZ = cardanFrame.GammaAngleAxisZ }; return(cardanFrameDto); }
public void ToCardanTest3() { var cardanFrame = new CardanFrame(new Position3D(), 269.96510228042916.DegToRad(), 0.00030437000552928036.DegToRad(), 89.0006093665338.DegToRad()); var mat = cardanFrame.ToMatrix44D(); var ex1 = mat * new Vector3D(1, 0, 0); var cardan = mat.ToCardanFrame(); var alpha = cardan.AlphaAngleAxisX.RadToDeg(); var beta = cardan.BetaAngleAxisY.RadToDeg(); var Gamma = cardan.GammaAngleAxisZ.RadToDeg(); var rot = cardan.ToMatrix44D(); Assert.Equal(mat, rot); }