public static void ToAngle_Returns_Angle_of_Offset() { Angle angle1 = new Angle(Numbers.PiOver2); Angle angle2 = new Angle(Numbers.PiOver4); AngularOffset offset = new AngularOffset(angle1, angle2); Angle angleFromOffset = offset.ToAngle(); Assert.AreEqual(-Numbers.PiOver4, angleFromOffset.Radians, Tolerance); }
[TestCase(4, 3, 3, 2, 1, 2, 45)] // obtuse deg rotated public static void CreateFromPoints_Creates_Angular_Offset_Formed_by_3_Points( double x1, double y1, double x2, double y2, double x3, double y3, double expectedAngleDegrees) { CartesianCoordinate point1 = new CartesianCoordinate(x1, y1); CartesianCoordinate point2 = new CartesianCoordinate(x2, y2); CartesianCoordinate point3 = new CartesianCoordinate(x3, y3); AngularOffset offset = AngularOffset.CreateFromPoints(point1, point2, point3); Assert.AreEqual(expectedAngleDegrees, offset.ToAngle().Degrees, Tolerance); }
public static void Initialization_with_Coordinates_Results_in_Object_with_Immutable_Coordinates_Properties_List() { CartesianCoordinate localOriginInGlobal = new CartesianCoordinate(3, 2); CartesianCoordinate localAxisXPtInGlobal = new CartesianCoordinate(5, 4); Transformations transformations = new Transformations(localOriginInGlobal, localAxisXPtInGlobal); AngularOffset angularOffset = new AngularOffset(Numbers.Pi / 4); CartesianOffset offset = localOriginInGlobal.OffsetFrom(CartesianCoordinate.Origin()); Assert.AreEqual(localOriginInGlobal, transformations.LocalOrigin); Assert.AreEqual(localAxisXPtInGlobal, transformations.LocalAxisX); Assert.AreEqual(offset, transformations.Displacement); Assert.AreEqual(angularOffset.ToAngle().Degrees, transformations.Rotation.ToAngle().Degrees, Tolerance); }